5 votes
Accepted

How to display random users with avatars

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 ...
  • 3,173
5 votes
Accepted

BuddyPress: Allow only one email domain to register

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->...
  • 1,350
4 votes
Accepted

How to modify an add_action() inside a loop of core function

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"&...
  • 4,923
4 votes
Accepted

How to delete user roles?

$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 ...
  • 2,249
4 votes
Accepted

How can visitors redirect wp-admin to the homepage?

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 ...
  • 957
4 votes

How to override BuddyPress 3.0 bp-nouveau theme files?

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 ...
  • 41
4 votes
Accepted

How do I find the bbpress forum ID for a forum in a buddypress group?

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, ...
  • 131
3 votes

How to get member list based on role by using buddypress?

To preserve pagination, try: <?php $authors = get_users( array( 'fields' => 'ID', 'role' => 'author' ) ); $authors = implode(',', $authors); ?> <?php if ( bp_has_members( ...
  • 4,923
3 votes

how to get current user name by user_id in buddypress?

This may not be an answer to this question, but in the end I reached for this question when I am looking for a way to fetch the display name for the user through the ID $user_displayname = get_user_by(...
3 votes

How to get a buddypress user profile link and a certain user profile field for the current post author?

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() ...
  • 209
3 votes
Accepted

add_filter : Passing an array instead of the callback function?

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 ...
  • 22.9k
2 votes
Accepted

How to increase password requirements for registration

Use a hook that fires later and add the $bp global to the function. Try this: function bp_password_beefing() { global $bp; if ( !empty( $_POST['signup_password'] ) ) if ( strlen( $_POST['...
  • 4,923
2 votes

Replacing default display name to login name

Based on this this answer: add_action( 'wp_login', 'wpse_9326315_format_user_display_name_on_login' ); function wpse_9326315_format_user_display_name_on_login( $username ) { $user = get_user_by(...
  • 388
2 votes
Accepted

Change Buddypress Admin Profile Page Permalink

This is a WP issue, not a BP issue. User names cannot be changed via WP. You could create another administrator account, using the user name you want, and then delete the 'admin' user. Or you ...
  • 4,923
2 votes
Accepted

BuddyPress | Check if user is in current group

function is_user_a_member_of_this_group($user_id, $group_id) //return: bool return groups_is_user_member( $user_id, $group_id ); }
  • 4,923
2 votes

Table 'wp_signups' doesn't exist

You should create it. you can find the schema in /wp-admin/includes/schema.php file. While it is used by core only in network mode, BP always uses it to track registration requests.
  • 22.9k
2 votes
Accepted

Search buddypress groups with querystring in url

Not in the url, but you can pass other parameters in the groups loop. There is a search_terms parameter in bp_has_groups(). It also has an orderby parameter that accepts total_member_count as the ...
  • 4,923
2 votes
Accepted

Remove / overwrite some functions in buddypress.js

Usually it is bp-legacy-js. But if you place a buddypress.js in wp-content/themes/your-theme/buddypress/js/ this file will be taken instead. The handle will be bp-parent-js The same goes for CSS ...
  • 2,869
2 votes
Accepted

how to make a profile entry read only except for site managers

You can hide profile fields on the edit screen from everyone except site admins - therefore they can only be edited by site admins. They will still be visible on the public profile screen. You can get ...
  • 4,923
2 votes
Accepted

Buddypress activity id

That function is called right in entry.php as follows: <li class="<?php bp_activity_css_class(); ?>" id="activity-<?php bp_activity_id(); ?>"> Note that bp_activity_id() will echo ...
  • 4,923
2 votes
Accepted

How to get all logged in user id in buddypress

This $bp->loggedin_user->id will only give you a single id, of the current logged in user. btw - it also requires use of the $bp global. You don't need to use that global. Use ...
  • 4,923
2 votes
Accepted

The acction hook stop working if i move it from plugin file to theme's functions.php file

Think about what you've written: The acction hook stop working if i move it from plugin file to theme's functions.php file And: bp_includes is buddypress action and hooked on plugins_loaded ...
  • 63.9k
2 votes
Accepted

Save buddypress xprofile data to author meta

Use this action hook found in buddypress/bp-xprofile/classes/class-bp-xprofile-profiledata.php do_action_ref_array( 'xprofile_data_after_save', array( $this ) ); You'll need to use the actual ...
  • 4,923
2 votes

User logged-in from front end is logged out automatically accessing wp-admin

have you tried by setting the second argument of wp_signon() to true or blank? set false will prevent wp_signon() from setting secure cookie which is essential for accessing wp-admin if your using ssl....
2 votes

Fire curl command everytime new user is created

//This action hook allows you to access data for a new user immediately after they are added to the database. The user id is passed to hook as an argument. do_action( 'user_register', $user_id ); ...
2 votes
Accepted

Delete images uploaded by 'Subscriber' role

Here's some code which pulls all subscriber IDs, then pulls all attachments from those subscribers and attempts to delete them. If it can't delete them it'll write to the error log letting you know. $...
  • 19.8k
2 votes

How to delete user roles?

A nice, user-friendly way of deleting your custom roles is using the Members plugin. Once you install and activate it, go to Users > Roles and here you can delete an custom roles that you do not need,...
2 votes

BuddyPress User Profile Menu

I solved it with my own effort. function bp_remove_nav_item() { global $bp; $current_user = wp_get_current_user(); $role_name = $current_user->roles[0]; if($role_name==='...
  • 31
2 votes

Set maximum number of letters limit on xprofile fields

Try this code, if it will helps: function filtered_profile_data( $args ) { $data = bp_get_member_profile_data( $args ); $defaults = array( 'field' => false, // Field name 'user_id' => ...
2 votes

New Post Notifications for Users - BUDDYPRESS

If you check the function for 'publish_post' action. function bp_post_published_notification( $post_id, $post ) { $author_id = $post->post_author; /* Post author ID. */ if ( bp_is_active( ...

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