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,370
4
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()
...
- 219
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,259
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 ...
- 997
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, ...
- 141
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,981
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(...
- 141
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 ...
- 23.1k
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(...
- 398
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,909
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,981
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
...
- 64.4k
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,981
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,981
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,981
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,981
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....
- 681
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 );
...
- 1,367
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.
$...
- 20.2k
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,...
- 3,949
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' => ...
- 41
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( ...
- 1,223
2
votes
How to display posts in hyperlink with nested slugs?
This can be achieved by adding rewrite rules.
First, add the query vars that will store the custom values in our rules:
function wpd_family_query_var( $query_vars ) {
$query_vars[] = 'wpd_family'...
- 77.3k
2
votes
Accepted
Showing content to specific BuddyPress Member Types
Your answer is on the codex page link in your question.
// Get the member type of user 5412.
$member_type = bp_get_member_type( 5412 );
So you could do something like this:
$member_type = ...
- 4,981
2
votes
Duplicate New User Registration notices (BuddyPress and bbPress both installed)
I fixed this with suggestion from here: https://buddypress.org/support/topic/how-can-i-hide-new-registered-member-update-from-activity-streams/
Adding this to functions.php removed one of the copies: ...
- 21
2
votes
Accepted
Patient portal using wordpress
Yes its possible to link a file to buddypress member as admin.
An important piece of the API is the BP_Attachment class. You can extend it to be ready to receive user submitted files, validate these ...
2
votes
How to override BuddyPress 3.0 bp-nouveau theme files?
Inside your wordpress theme (hopefully a custom or child theme) create a "buddypress" folder.
Then you can override files from the /plugins/buddypress/bp-templates/[buddypress theme] folder. But you ...
- 142
2
votes
Buddypress update user avatar image via REST
I finally found a SOLUTION and i want to post it because can be useful for someone!
public function update_user_avatar()
{
global $json_api;
if (!$json_api->query->user_id)
{
$...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
buddypress × 500plugins × 44
php × 34
profiles × 33
user-registration × 26
users × 24
multisite × 22
functions × 18
bbpress × 18
menus × 13
avatar × 13
plugin-development × 12
posts × 12
customization × 12
login × 11
filters × 10
templates × 10
redirect × 10
search × 10
custom-post-types × 9
theme-development × 9
hooks × 9
user-meta × 9
members × 9
loop × 8