@thesun2012 bp_legacy_theme_ajax_messages_star_handler is not mandatory; you can also create your custom handler based on it
for example
function wbcom_custom_buddypress_ajax_handler() {
check_ajax_referer('custom-bp-ajax-nonce', 'security');
$displayed_user_id = isset($_POST['displayed_user_id']) && !empty($_POST['displayed_user_id'])
? (int) sanitize_text_field($_POST['displayed_user_id'])
: get_current_user_id();
$message_id = isset($_POST['message_id']) ? (int) sanitize_text_field($_POST['message_id']) : 0;
$star_status = isset($_POST['star_status']) ? sanitize_text_field($_POST['star_status']) : '';
$bulk = isset($_POST['bulk']) && !empty($_POST['bulk']);
if (!bp_is_active('messages', 'star') || empty($message_id) || !is_user_logged_in() || !bp_core_can_edit_settings()) {
wp_send_json_error(array('message' => 'Invalid request or insufficient permissions.'));
return;
}
$result = bp_messages_star_set_action(array(
'action' => $star_status,
'message_id' => $message_id,
'bulk' => $bulk,
'user_id' => $displayed_user_id
));
if ($result) {
wp_send_json_success();
} else {
wp_send_json_error(array('message' => 'Failed to update message status.'));
}
}
add_action('wp_ajax_wbcom_custom_buddypress_action', 'wbcom_custom_buddypress_ajax_handler');
AJAX Request Adjustments like this
jQuery.ajax({
url: ajaxurl,
type: 'POST',
data: {
'action': 'wbcom_custom_buddypress_action',
'displayed_user_id': displayedUserId, // Include if available
'message_id': messageId,
'star_status': starStatus,
// Additional data...
},
success: function(response) {
// Handle success
},
error: function(error) {
// Handle error
}
});
We can suggest modifying the bp_legacy_theme_ajax_messages_star_handler() function to handle the displayed user ID and use the logged-in user ID as a fallback.
function bp_legacy_theme_ajax_messages_star_handler() {
if ( false === bp_is_active( 'messages', 'star' ) || empty( $_POST['message_id'] ) ) {
return;
}
// Check nonce.
check_ajax_referer( 'bp-messages-star-' . (int) $_POST['message_id'], 'nonce' );
// Check capability.
if ( ! is_user_logged_in() || ! bp_core_can_edit_settings() ) {
return;
}
// Get the displayed user ID or fallback to the logged-in user ID.
$user_id = isset($_POST['displayed_user_id']) && !empty($_POST['displayed_user_id'])
? (int) $_POST['displayed_user_id']
: get_current_user_id();
if ( true === bp_messages_star_set_action( array(
'action' => $_POST['star_status'],
'message_id' => (int) $_POST['message_id'],
'bulk' => ! empty( $_POST['bulk'] ) ? true : false,
'user_id' => $user_id // Use the determined user ID
) ) ) {
echo '1';
die();
}
echo '-1';
die();
}
The issue I’m facing is related to integrating BuddyPress into my theme. I’ve relocated the entire Messages component to a custom page that isn’t the default BuddyPress page. When users click on the Star and Unstar buttons, the functionality doesn’t work as intended. This is because it is loaded via AJAX using the bp_legacy_theme_ajax_messages_star_handler function, and this function calls bp_messages_star_set_action with the default user ID being the displayed user ID, You know, the bp_displayed_user_id() function doesn’t recognize the displayed user ID when called through AJAX.
It would be more appropriate to change bp_displayed_user_id() to bp_loggedin_user_id() in this context 🙂
I acknowledge that I could rewrite the code, but it’s preferable to maintain everything in its default state.
Thank you.
Hello Team,
I have explored a minor issue while working with BP, please have a look https://github.com/buddypress/buddypress/blob/8478bd9366c28015b5a2c3d91aef08ce49c32bc3/src/bp-messages/bp-messages-star.php#L249
I guess it should be the logged-in user ID instead of the displayed user ID, could you solve this please?
Thanks.
Now updated Buddypress to v12.2 ……..Issue still there.
Wordpress v6.4.2
Buddypress v12.1.1
BP Classic v1.2.0
Page Builder by SiteOrigin
Theme SiteOrigin Corp
Hi @imath,
I have a similar / related issue. I’m using Restrict Content Pro’s registration page with the latest Buddypress version (12.1.1) on a staging site and my registration page broke. It told me “Member registration is currently not allowed”, even if I disable the buddypress plugin.
I tried the gist you posted https://gist.github.com/imath/c5c34feb5d3c9b3070f7a11bc339f103 in my child theme’s functions.php but the registration page still does not work. Any ideas?
*Update* – I read through the earlier post and found the first workaround – going to Buddypress Settings -> URLs, but did not see any option to change the register slug. I had to briefly turn on wordpress general settings “Anyone can register” so that more options would appear in “URLs”. I was able to set the slug to something else like ‘sign-in’ and that seemed to allow my RCP registration to function again.
Just to check, I disabled “Anyone can register”. Seems like the BP slug change stuck and my RCP registration is operational.
Hi all,
I am German and ma English is not the best, but I try to discribe my problem as good as possible. But a small warning about my self: I have no idea about coding and I love plug’n’play!
My site is : https://pinselcrew.de/
I tried to start a forum with bbpress and buddypress. It worked perfectly together until last week. I got an email from my site that told me about a big problem. The memberlist was empty and the forum was totaly broken. So I asked my hoster for a backup.
When I startet the debug mode, it told me that there is an error in the bbpress code that points to buddypress. After I deactivatet BuddyPress everything was fine again. So I deinstalled and installed it again. But the error is the same.
Maybe aomeone has an idea. The first members really loved BuddyPress and now the miss it!
Best regards from Hamburg
Markus
__________________________________________________
This is the mail I received:
Aktives Theme: Astra (Version 4.6.3)
Aktuelles Plugin: bbPress (Version 2.6.9) PHP-Version 7.4.33 Fehler-Details ============== Ein Fehler vom Typ E_ERROR wurde in der Zeile 229 der Datei /www/htdocs/w01d4e65/pinselcrew.de/wp-content/plugins/bbpress/includes/extend/buddypress/members.php verursacht. Fehlermeldung: Uncaught Error: Call to undefined function bp_core_get_user_domain() in /www/htdocs/w01d4e65/pinselcrew.de/wp-content/plugins/bbpress/includes/extend/buddypress/members.php:229
Stack trace:
#0 /www/htdocs/w01d4e65/pinselcrew.de/wp-content/plugins/bbpress/includes/extend/buddypress/members.php(100): BBP_BuddyPress_Members->get_profile_url(131)
#1 /www/htdocs/w01d4e65/pinselcrew.de/wp-includes/class-wp-hook.php(324): BBP_BuddyPress_Members->get_user_profile_url(131)
#2 /www/htdocs/w01d4e65/pinselcrew.de/wp-includes/plugin.php(205): WP_Hook->apply_filters(131, Array)
#3 /www/htdocs/w01d4e65/pinselcrew.de/wp-content/plugins/bbpress/includes/core/abstraction.php(471): apply_filters(‘bbp_pre_get_use…’, 131)
#4 /www/htdocs/w01d4e65/pinselcrew.de/wp-content/plugins/bbpress/includes/users/template.php(560): bbp_maybe_intercept(‘bbp_pre_get_use…’, Array)
#5 /www/htdocs/w01d4e65/pinselcrew.de/wp-content/plugins/bbpress/includes/admin/users.php(260): bbp_get_user_profile_url(131)
#6 /www/htdocs/w01d4e65/pinselcrew.de
@puresaian To mention all group members simultaneously, you must implement a custom solution. This could be a special shortcode or command that automatically translates into individual mentions for all group members when used by the admin.
/**
* Handles the custom mention "@everyone" within BuddyPress groups.
* When @everyone is used in a group's post or comment, it replaces it with mentions of all group members.
*/
function wbcom_custom_everyone_mention_handler( $content ) {
// Check if BuddyPress is loaded and @everyone is used in the content
if ( function_exists( 'groups_get_current_group' ) && strpos( $content, '@everyone' ) !== false ) {
// Get the current group details
$group = groups_get_current_group();
// Proceed only if we are in a group context
if ( $group ) {
// Fetch all members of the group
$group_members = groups_get_group_members( array( 'group_id' => $group->id ) );
$mentions = array();
// Loop through each member to build the mentions array
foreach ( $group_members['members'] as $member ) {
$mentions[] = '@' . $member->user_nicename; // Prepares the mention syntax for each member
}
// Replace @everyone in the content with the individual member mentions
$content = str_replace('@everyone', implode(' ', $mentions), $content);
}
}
// Return the modified (or unmodified, if no changes were made) content
return $content;
}
// Add filters to apply the custom mention handler in different BuddyPress content types
add_filter( 'the_content', 'wbcom_custom_everyone_mention_handler' ); // For regular WordPress content
add_filter( 'bp_activity_new_update_content', 'wbcom_custom_everyone_mention_handler' ); // For new BuddyPress activity updates
add_filter( 'bp_activity_comment_content', 'wbcom_custom_everyone_mention_handler' ); // For comments on BuddyPress activities
It’s not a tested code; it’s just giving implementation directions.
@investbuddy123 Based on your description of issues with BuddyPress on your WordPress site, you’re encountering problems with group updates and public messaging functionalities.
Here is a step-by-step guide to debug the issue:
Check for Plugin Conflicts: Deactivate all plugins except BuddyPress and BP Classic. If the issue is resolved, reactivate each plugin individually to identify the conflicting plugin.
Theme Compatibility: You’ve tried switching to the Twenty-Three theme with no success, which is good. It rules out theme-specific issues.
Inspect JavaScript Errors: Use the browser’s Developer Tools (usually accessible by pressing F12) to check for JavaScript errors in the Console tab. JavaScript issues often cause features like loading updates or activating functions to fail.
Server and PHP Error Logs: Check your server and PHP error logs for any relevant errors. Your hosting provider can assist you in accessing these if you’re unsure how.
Test on a Staging Site: If possible, clone your site to a staging environment. This allows you to test without affecting your live site.
Cache and Optimization Plugins: If you use caching or optimization plugins, clear the cache and temporarily disable them to see if they are causing the issue.
Check for Custom Code: If you have any custom code (like snippets in your theme’s functions.php file or a custom plugin), comment to see if it is causing the issue.
Hello,
Since I am also using BuddyPress and bbPress on my website, I installed the BP Classic as guided.
When I activate the BP Classic it fix my issue with bbPress.
However, it creates another issue now!
This is how my widgets area looks like in admin when BP Classic is disactivated – http://tinyurl.com/ymrpz5sk
And this is how it looks like when BP Classic is activated – http://tinyurl.com/ysmcw22f
As you can see, it disables all my available widget areas and widget settings once the BP Classic is activated.
This BB Classic fixed my issue with bbPress but creates another issue and it’s impossible for me to manage my widgets when the plugin is activated!
Thank you for creating this topic
I think, if possible, that the system of historiography
Change BuddyPress to the default WordPress system, it’s better
(Things like choosing the date of birth and…)
So that users who use other history systems can also benefit from it
To edit a BuddyPress theme file, you will need to access the theme files on your WordPress installation. You can do this by logging into your WordPress admin dashboard, navigating to the Appearance > Themes page, and clicking the editor link of male delusion calculator for the theme you want to edit. This will open the theme files in the text editor, where you can make the changes you need. After making the changes, make sure to save the file, and then check to see how it looks on the front end of your site.
Hello,
While trying to access users from admin menu, I am getting a fatal error and when enabling the debug mode, I am getting this error message:
Fatal error: Uncaught Error: Call to undefined function bp_core_get_user_domain() in /home/islandbnb/public_html/wp-content/plugins/bbpress/includes/extend/buddypress/members.php:229 Stack trace: #0 /home/islandbnb/public_html/wp-content/plugins/bbpress/includes/extend/buddypress/members.php(100): BBP_BuddyPress_Members->get_profile_url(2) #1 /home/islandbnb/public_html/wp-includes/class-wp-hook.php(324): BBP_BuddyPress_Members->get_user_profile_url(2) #2 /home/islandbnb/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(2, Array) #3 /home/islandbnb/public_html/wp-content/plugins/bbpress/includes/core/abstraction.php(471): apply_filters('bbp_pre_get_use...', 2) #4 /home/islandbnb/public_html/wp-content/plugins/bbpress/includes/users/template.php(560): bbp_maybe_intercept('bbp_pre_get_use...', Array) #5 /home/islandbnb/public_html/wp-content/plugins/bbpress/includes/admin/users.php(260): bbp_get_user_profile_url(2) #6 /home/islandbnb/public_html/wp-includes/class-wp-hook.php(324): BBP_Users_Admin->user_row_actions(Array, Object(WP_User)) #7 /home/islandbnb/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array) #8 /home/islandbnb/public_html/wp-admin/includes/class-wp-users-list-table.php(520): apply_filters('user_row_action...', Array, Object(WP_User)) #9 /home/islandbnb/public_html/wp-admin/includes/class-wp-users-list-table.php(415): WP_Users_List_Table->single_row(Object(WP_User), '', '', 0) #10 /home/islandbnb/public_html/wp-admin/includes/class-wp-list-table.php(1709): WP_Users_List_Table->display_rows() #11 /home/islandbnb/public_html/wp-admin/includes/class-wp-list-table.php(1636): WP_List_Table->display_rows_or_placeholder() #12 /home/islandbnb/public_html/wp-admin/users.php(814): WP_List_Table->display() #13 {main} thrown in /home/islandbnb/public_html/wp-content/plugins/bbpress/includes/extend/buddypress/members.php on line 229
I’m currently working on an Arabic version of our BuddyPress website.
In order to create a complete user experience in Arabic, I’d like to duplicate some important BuddyPress-related pages, such as “Members”, “Activity”, “Groups”, “User Profile” and “Forums”, and translate them into Arabic, the pages must be displayed in Arabic, but the provider link displays it in English, when I translate the page, it translates the French version too.
However, I’m encountering difficulties in implementing this duplication, and am seeking your assistance in guiding me on the best approach to take. Could you please provide me with detailed instructions or relevant resources to help me accomplish this task successfully?
I would like to thank you in advance for your valuable assistance. Your expertise will be of great importance in ensuring the success of this initiative.
WP version 6.4.2, BuddyPress v. 12.1.1 and BP classic 1.2.0 site is learn.knityourdog.com (login required) running reservoir/fluida theme.
Have 3 groups set up so far, all show “loading group updates, please wait” and nothing ever loads. Private messaging between members is working, public messaging is not. Cannot even click to activate the function.
No change when using Twenty Twenty-Three theme. Same problems exactly.
Have never had this issue on a BP site before and this is my 4th. Unsure how to remedy.
I deactivated BuddyPress and then selected ‘favorites’ from the generic bbPress profile page. Within the list of favorited topics, the ‘X’ has the following URL:
https://[site-url]/forums/users/admin/favorites/?action=bbp_favorite_remove&object_id=55&redirect_to=https%3A%2F%2F[site-url]%2Fforums%2Fusers%2Fadmin%2Ffavorites%2F&_wpnonce=198716f56b
When I click the ‘X’ it unfavorites is. I’m beginning to see what’s happening here. Thanks for your help so far.
@vapvarun I changed the ‘Favorites’ slug in bbPress settings to ‘saved’, and then saved the settings. Then, I went into the Forums section of the profile and, in the ‘Favorites’ tab clicked the ‘X’ to unfavorite the topic. It didn’t work.
The URL behind the ‘X’ link is:
https://[site-url]/members/admin/forums/saved/?action=bbp_favorite_remove&object_id=55&redirect_to=https%3A%2F%2F[site-url]%2Fmembers%2Fadmin%2Fforums%2Fsaved%2F&_wpnonce=3e81531050
The URL to unsubscribe from within the bbPress list of topics is:
https://[site-url]/forums/topic/itching/?action=bbp_favorite_remove&object_id=55&_wpnonce=3e81531050
It looks like maybe the URL is not constructed correctly in BuddyPress?
Hi @portalciencia
Some plugins might not be ready with BuddyPress 12.0 or up. For this case we’ve built a Backwards compatibility Add-on. You can try to download and activate it to see it it’s fixing your issue:
BP Classic
Hi,
I have integrated buddypress with Tutor LMS pro. When user enroll, completes course, etc. there is a default message triggered, like ‘I just completed learning <course name>. It was super insightful!’. How do I customize these messages? Kindly assist.
Thanks,
Vidhya
Hi @priyam1234
Thanks for your feedback 😍. My company has nothing to do with WordPress actually, I don’t make a living with code. I’m a hobbyist and contribute freely to BuddyPress, just like the other members of the team.
For everyone reading this topic:
Quick update about the 12.1.1 issue reported by @manni65929 when first installing BuddyPress with this version:
We’re actively working on it, I’ve tested the fix we built with various scenarios to make sure we don’t generate side effects. The ticket we use to track this issue contains a 12.2.0-beta version with this fix, we still need to run some tests but I’m confident we’ll be able to package the next 12.2.0 minor release very soon (I believe early next week).
hello @imath
i appreciate your team work.
you have list of plugins which handle by your company or compatible with buddypress. it helps me a lot.
thank you
Hi @priyam1234
I’m aware of the issue, see: https://buddypress.org/support/topic/buddypress-12-1-1-maintenance-security-release/
I’m currently working on it from https://buddypress.trac.wordpress.org/ticket/9075. I need to make sure the fix is taking care of all possible cases, which means a lot of tests.
As soon as I have something solid I’ll package a new minor release. It will happen faster than 12.1.1 (which took a month). I hope I’ll make it happen early next week.
@ayayron sorry to read about it: please do participate to our beta testing period. We extended 12.0.0 to 5 months without receiving any issues from you or other Themeforest developers. It’s better to anticipate imho.
@roberthemsing I’m not sure, my guess is we’re not strict enough about the rewrite rule so I’ll need to review this asap.
I’m going to close this topic, please carry on giving us your feedbacks and issues from this topic:
BuddyPress 12.1.1 Maintenance & Security Release