Search Results for 'custom activity page'
-
Search Results
-
WP 6.6.2, BP 14.2.1, Divi theme.
I added a bunch of WordPress users to my site from a csv file using the Import and export users and customers plugin. Worked well. But those users couldn’t figure out how to make friend requests, since they couldn’t “see” the other users that they could ask. After some fumbling through this forum and googling, I came across the “/members” slug. I seemed like exactly what I needed, a list of members with a button to send a friend request to each one. The only problem was that it didn’t show all the users. More ressearch found this post from 10 years ago. Seems the issue was/is that it only shows those users who have had some BuddyPress activity recorded. But since these were mostly new users, most had no activity. So I wrote a little bp-custom.php file containing:
function make_all_users_active() { $users = get_users(); // repete_log(print_r($users, true), __FILE__, __LINE__); foreach($users as $user) { if (strlen(bp_get_user_last_activity($user->ID)) == 0) { // repete_log(sprintf("bp_update_user_last_activity(%s)", $user->ID), __FILE__, __LINE__); echo $user->ID . "<br>"; bp_update_user_last_activity($user->ID); } } } add_action ('wp_loaded', 'make_all_users_active');
This solved the problem of not showing all the other BuddyPress members, but as far as I can tell, I’ve now got to tell all the users that if they’re interested in making friend connections, they have to go to the address bar, and type /members right after the domain name. That seems ridiculous! I guess I could add a page containing a link to that slug that they could click, but it would be nicer if I could make a page they could find as one of the site’s pages that would display the information from that slug, without having to click a link. Better still would be to be able to customize the BuddyPress drop-down menu to add an item for “All Members” that would display the slug’s contents…
Hi
Is it possible to add the Activity Feed in a custom location?
I find the Activity page quite restrictive and would like to add a feed to a custom page via a shortcode.
I can gt the feed to load like this – however it seems to be missing styling and when clicking comment it redirects me.
Is there a better way to do this?
function custom_shortcode_activityfeed() { ob_start(); if ( function_exists( 'bp_has_activities' ) ) { bp_get_template_part( 'activity/activity-loop' ); } $output .= ob_get_clean(); return $output; } add_shortcode( 'custom_activityfeed', 'custom_shortcode_activityfeed' );
Hi everyone,
I’m working on customizing my BuddyPress site and would like to change the text that says “posted an update in the group” on the activity page. Specifically, I want to replace the word “group” with “Teams.”
Could someone guide me on which file I need to edit to make this change? Any tips on best practices for modifying this would also be appreciated to ensure I don’t break any future updates.
Thanks in advance!
Best,
Topic: custome query
i want to get only 2 comments , on load of activity page . wich i really get using my code
“add_filter(‘bp_use_legacy_activity_query’, function ($value, $method, $args) {
if ($method == “BP_Activity_Activity::get_activity_comments”) {
return true;
}
}, 10, 3);add_filter( ‘bp_activity_comments_user_join_filter’, function( $value, $activity_id, $left, $right, $spam = ‘ham_only’ ) {
// Modify the SQL query to fetch only two comments
global $wpdb, $bp;
$bp = buddypress();$xprofile_active = function_exists(‘bp_is_active’) && bp_is_active( ‘xprofile’ );
// Initialize fullname related variables
$fullname_select = $fullname_from = $fullname_where = ”;// Select the user’s fullname with the query if XProfile is active and user has filled the field.
if ( $xprofile_active ) {
if ( bp_has_profile() ) {
// Get the field value if user has filled it.
$field_id = 1; // Modify this according to your field ID.
$field_value = bp_get_profile_field_data( ‘field=’ . $field_id );
if ( !empty( $field_value ) ) {
$fullname_select = “, pd.value as user_fullname”;
$fullname_from = “, {$bp->profile->table_name_data} pd “;
$fullname_where = “AND pd.user_id = a.user_id AND pd.field_id = $field_id”;
}
}
}// Don’t retrieve activity comments marked as spam.
if ( ‘ham_only’ == $spam ) {
$spam_sql = ‘AND a.is_spam = 0’;
} elseif ( ‘spam_only’ == $spam ) {
$spam_sql = ‘AND a.is_spam = 1’;
} else {
$spam_sql = ”;
}// Modify the SQL query to fetch only two comments
$sql = $wpdb->prepare( “SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name{$fullname_select}
FROM {$bp->activity->table_name} a, {$wpdb->users} u{$fullname_from}
WHERE u.ID = a.user_id {$fullname_where}
AND a.type = ‘activity_comment’ {$spam_sql}
AND a.item_id = %d
AND a.mptt_left > %d
AND a.mptt_left < %d
ORDER BY a.date_recorded ASC
LIMIT 2″,
$activity_id, $left, $right );return $sql;
}, 10, 5 );”but it give me also count 2 , can i get original count.
means , any activity has 10 comment then it display only 2 but give count 10
i Have this link now: https://domain.com/member/johndoe/activity/512/
but need this: https://domain.com/512/how i can do that by some php snippet? pls help
Something like this? but its bad code i mean
function custom_activity_link($activity_id = false) { global $bp; if (!$activity_id) { $activity_id = bp_get_activity_id(); } return home_url('/' . $activity_id . '/'); } function change_buddypress_activity_permalink() { global $bp; $bp->activity->root_slug = 'activity'; add_rewrite_rule('^([0-9]+)/?$', 'index.php?pagename=activity&p=$matches[1]', 'top'); } add_action('bp_init', 'change_buddypress_activity_permalink', 2); add_filter('bp_get_activity_thread_permalink', 'custom_activity_link', 10, 2);
I have installed the buddypress plugin on my site. But there is no way to edit the generated page https://ohwhat.com/activity/ and https://ohwhat.com/members/ and others. Those two URLs are not listed in my WordPress “Page” dashboard.
According to the following document
https://github.com/imath/buddypress/blob/master/docs/user/administration/settings/urls.md
“Every BP Component using a directory gets an accordion panel to let you customize its title and permalink as well as potential single item screen URLs when supported (eg: Members and Groups).”
However, on my BuddyPress Settings->URLs screen, I see accordion panels for Members and Activity Streams. I do not see an accordion panel for User Groups, even though it is enabled in the Components screen.
I see the following message in the Network Dashboard and the Main Site Dashboard:
A BuddyPress page has been added for the following active BuddyPress Components which did not have associated BuddyPress Pages yet: Groups. You may need to refresh your permalink settings.
Hi, I got some error about the BP Classic. Before the bp’s updates, my activity page is working without activate BP Classis plugin. For now, I need to activate the BP classic plugin to work my activity page. However, I cannot customize my site now when I activate my BP Classic plugin.
May I know how to solve the problem?
This is how my activity page without activate BP Classic looks like: https://ctrlv.link/rSS8
Activity URL: https://myinvestbuddies.com/feeds/