12

This is how I would update a field named 'Address': function updateAddress() { global $current_user; get_currentuserinfo(); $newAddress = '123 New Street'; xprofile_set_field_data('Address', $current_user->id, $newAddress); }


9

This is one of the things you won't find in the docs, but only in the source. The source code contains only one usage of this variable. This is in bp-xprofile-template.php line 493. // First, check to see whether the user-entered value matches if ( in_array( $allowed_options, (array) $option_values ) ) { $...


7

You will want to use the $wpdb class to execute a query for users with a certain x-profile field value. I'm no MySQL expert, so someone else likely has a better way to write this query (if you do, please share it and I'll update my code), but here's one approach to it. This approach assumes you know the ID of the the BuddyPress profile field you are ...


5

When we post an empty anonymous reply, we get the following errors: The part of BBPress that's responsible for handling this, is the bbp_new_reply_handler() function, in the file /bbpress/includes/replies/functions.php. It contains these lines that are of interest to us: // User is anonymous if ( bbp_is_anonymous() ) { // Filter ...


5

I am not sure why your query is returning more IDs than necessary. The $args for get_users look correct. By default get_users does not support orderby=rand, but you can overwrite that option. See below: function random_user_query( &$query ) { $query->query_orderby = "ORDER BY RAND()"; } // Usage: [random_users how_many = 3] add_shortcode( '...


5

Finally, I found the solution. Here is the code if anyone has the same issue and want to refer it. Using Action function wf_validate_email_domain() { global $bp; $email = $bp->signup->email; $email_exploded = explode('@', $email); // split on @ and return last value of array (the domain) $domain = array_pop($email_exploded)...


4

I'm from the team that developes BuddyPress Media. Till now, capturing a video involved expensive (in various ways) setups. It depended on flash and silverlight which could reach the hardware (mic and webcam) . Html5 is the way to go, now. However, the support isn't wide enough. This might help you: https://stackoverflow.com/questions/7386675/video-capture-...


4

How to create a new tab in the Buddypress profile link with user posts? 1) create a folder /buddypress/ under your theme directory 2) create bp-custom.php file in the directory. Now your theme folder has a structure --> your Theme Directory/buddypress/bp-custom.php 2.1 Include bp-custom.php file in your theme function.php using include or ...


4

Use the filter hook bp_members_signup_error_message Try: function signup_error_change( $error_message ) { $error_message = str_replace('<div class="error">', '<span class="val-error">', $error_message); $error_message = str_replace('</div>', '</span>', $error_message); return $error_message; } add_filter('...


4

The codex entry for the admin_init hook has an example showing you how to do this. /** * Restrict access to the administration screens. * * Only administrators will be allowed to access the admin screens, * all other users will be automatically redirected to * 'example.com/path/to/location' instead. * * We do allow access for Ajax requests though, ...


4

The forum id for a group is stored in the {yourprefix}_bp_groups_groupsmeta table where group_id is the group id and the key is forum_id and the value is a serialized array. Instead of a shortcode, it may be easier to add a function call in a bp groups template. Something like: echo gauray_recent_replies( bp_get_group_id() ); function ...


3

I found the conditionals in docs :) they are like as follow, bp_is_user_profile() /* will check the current page as personal profile */ bp_is_user_activity() /* will check the current page as personal activity */


3

As @shanebp said: You can define the default avatar site-wide by using BP_AVATAR_DEFAULT For this you can define the constant(s) BP_AVATAR_DEFAULT and/or BP_AVATAR_DEFAULT_THUMB inside the bp-custom.php as described at the buddypress codex page Customizing BuddyPress Avatars, for example like this: Code: $upload_dir = wp_upload_dir(); $...


3

It's kind of a bit different, but since this thread appears first on Google, it might be usefull for someone else. To get the current logged-in user profile link, just use bp_loggedin_user_domain() Hope that helps.


3

I belive you can use a load_textdomain_mofile filter... add_filter('load_textdomain_mofile', 'custom_load_textdomain_mofile', 10, 2); function custom_load_textdomain_mofile( $mofile, $domain){ if ($domain == 'bp-ass') $mofile = 'somepath/to/your/mo/file.mo'; return $mofile; } Difference (comparing Otto) is you can actually specify your mo ...


3

It is fixed in v2.2.4. I suggest you to update your plugin. Or you can do it by adding following condition in tag rendering foreach loop RTMediaPhotoTag.php > function tag(){...} if(get_user_by('id', $tagged) === false ){ $this-> delete_tag($tagged,$media_id); continue ; } You should post this issue on rtmedia support forum


3

Buddypress' bp_has_members() function accepts several parameters to alter the output. Take a look at the Accepted Parameters section on the codex page regarding the members loop. The two parameter meta_key and meta_value might just be what you're looking for. The Code Examples section should give you an additional insight in how to do it - correct. Update: ...


3

To preserve pagination, try: <?php $authors = get_users( array( 'fields' => 'ID', 'role' => 'author' ) ); $authors = implode(',', $authors); ?> <?php if ( bp_has_members( bp_ajax_querystring( 'members' ). '&per_page=25&include=' . $authors) ) : ?> //etc


3

$wp_roles = new WP_Roles(); // create new role object $wp_roles->remove_role('name_of_role'); If you need to check the name_of_role use $wp_roles->get_names(); you will get an array of name_of_role => Nicename of Role Alternatively, you could use the global object $wp_roles global $wp_roles;


3

You can pass as the callback argument anything which is callable by PHP definition, something that might actually change between PHP versions. In this specific case the array($o,$m) type of notation indicates that the filter will call $o->$m


3

I know it is an old question but im pasting this here in case someone is looking for the same answer. Overloading Template Compatibility theme files Template compatibility also runs a check to see if two directories or folders exist in a theme: 'buddypress' 'community' If either of these two folders exist in your theme and they contain BP template files ...


2

If you need to add it in comments: <?php $author_id = get_comment(get_comment_ID())->user_id; if (function_exists('bp_get_profile_field_data')) { $bp_name = bp_core_get_userlink( $author_id ); $bp_location = bp_get_profile_field_data('field=Location&user_id='.$author_id); if ($bp_name) { echo '<div>'. $bp_name . '</div&...


2

(btw hi boone, im jacob, from vancouver). ( keyword "nice!" :) I am facing the exact same problem. Your implementation of the infinitescroll plugin seems ok. but it doesn seem to be an inifinitescroll prob to me. btw I disabled it, by simply uncommenting my item container and when i try to navigate through the pages with my navigation links, as soon as i ...


2

There are two ways to do that: From the plugin settings page On the "Loggedin Links" option, the second anchor tag is pointing to Wordpress profile by default: '<a href="http://yoursite.com/wp-admin/profile.php">Profile</a>'. You have to update this to point to Buddypress profile page, to do so, you need to know what is the members domain that ...


2

$group_id is the first argument passed to groups_join_group action hook function, the second argument is $user_id. You can use these data to obtain group creator_id like: add_action('groups_join_group', 'my_groups_join_group_action', 10, 2); function my_groups_join_group_action($group_id, $user_id) { // use $group_id and $user_id here: $group = ...


2

You can force all visitors to log in before they are allowed to see the pages. This will not work for attachments. But … if that already is a problem for your site – why did you install WordPress in a publicly accessible directory? You should plan visibility first, then run the installation. Consider HTTP Basic authentication if you think your users can ...


2

get_current_user_id() effectively does what @Giri had described in the first snippet. The internal Wordpress function-call chain eventually calls get_currentuserinfo() which already checks if there is a WP_User object, meaning a user is logged in. Thus, from what I can see in the linked code, get_current_user_id() always returns the ID of the user that is ...


2

if( is_user_logged_in() ) { global $current_user; get_currentuserinfo(); $userid = $current_user->ID; } or Use it like this if( is_user_logged_in() ) { $userid = get_current_user_id(); } is_user_logged_in() get_currentuserinfo() get_current_user_id()


2

Put the following code in your functions.php. If you want a demo i can show you. // my custom notification menu www.cityflavourmagazine.com function my_bp_adminbar_notifications_menu() { global $bp; if ( !is_user_logged_in() ) return false; echo '<li id="top-notification">'; _e( 'Alerts', 'buddypress' ); if ( $notifications = ...


2

Here's a good idea. With iCanLocalize, you can create a .po file automatically. This generator will scan PHP file(s) and create .po files, that are used for localization. It will extract all strings wrapped in __("txt", "domain") and _e("txt", "domain") calls. Strings can be enclosed in either double quotes (") ...


Only top voted, non community-wiki answers of a minimum length are eligible