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

Use wp_redirect() and admin_url() to redirect the user to his profile page if the custom buddypress user meta data isn't completely filled. From another answer, I've seen that there's the following function: bp_get_profile_field_data(). So you can easily build a template tag, that gives you either the full buddy user meta data set, or simply a FALSE back. ...


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

As th @kaiser's comment "Btw: A quick search on Google brought this plugin by Themekraft. – kaiser Jul 25 at 14:30" I bought this PLUGIN WooCommerce – BuddyPress Integration: Your Social Network Shop Its working well and fulfills my need Thanks to @kaiser.


4

Maybe you need this: bp_displayed_user_id(). Also see playing with the user’s ID in different contexts in BuddyPress documentation.


4

I found this: Exclude Users from Members directory on a BuddyPress based social network We will need to hook to 'bp_ajax_querystring' filter. The following code will allow to exclude the users from the members directory. They will be still listed in the friends list of other users with whom they are friends with. add_action('bp_ajax_querystring','...


4

Try this function: function get_user_role($user_id){ global $wpdb; $user = get_userdata( $user_id ); $capabilities = $user->{$wpdb->prefix . 'capabilities'}; if ( !isset( $wp_roles ) ){ $wp_roles = new WP_Roles(); } foreach ( $wp_roles->role_names as $role => $name ) { if ( array_key_exists( $role, $...


4

I have created a function to get user role from userid. function get_user_role( $user_id ){ $user_data = get_userdata( $user_id ); if(!empty( $user_data->roles )) return $user_data->roles[0]; return false; } call get_user_role() function to get the role of the user and pass the userid as parameter. It will return user role else will ...


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

As far as I know bbPress uses custom post types. So all the data are in the regular posts and post_meta tables. A look at the source code should tell you more. From the bbPress Codex: bbPress creates three custom post types and adds them to the navigation menu: Forums, Topics, and Replies. Use these menu items to create and manage your forums.


3

You can use the very same get_userdata function of WordPress to code a specific function. Stick this in your functions.php: function get_display_name($user_id) { if (!$user = get_userdata($user_id)) return false; return $user->data->display_name; } So you can do something like: $display_name = get_display_name($some_user_id); echo $...


3

Check out the BuddyPress Custom Profile Menu plugin. You should be able to add tabs just by creating a regular Wordpress menu.


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

You should be using a filter outside of your template for this: add_filter( 'template_include', 'wpa62226_template_include', 1, 1 ); function wpa62226_template_include( $template ){ if( is_page( 'some-page' ) ) : global $wp_query; $wp_query->set_404(); status_header( 404 ); $template = locate_template( '404.php' ); ...


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

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


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&...


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