Forum Replies Created
-
@andrew_long15 , you can simply add this to remove the invites tab from all the groups.
add_filter( ‘bp_groups_user_can_send_invites’, ‘__return_false’ );
@Kokiri
Please change this function name “custom_bp_avatar_activity” and keep it unique and please remember this also that this will create a new activity So, you will get two activity for single profile uploads.// Add action to show new avatar in activity stream function bp_generate_custom_avatar_activity($user_id, $args) { // Get the user data $user = get_userdata($user_id); $user_link = bp_core_get_userlink($user_id); // Create the activity entry bp_activity_add(array( ‘user_id’ => $user_id, ‘action’ => sprintf(__(‘ % s has updated their avatar newly.’, ‘buddypress’), $user_link), ‘component’ => ‘profile’, ‘type’ => ‘new_avatar’, ‘item_id’ => $user_id, )); } add_action(‘bp_members_avatar_uploaded’, ‘bp_generate_custom_avatar_activity’, 10, 2);
If you want to hide currunt loggedin user from member directory you can easily use this code snippet.
`function buddyx_exclude_users( $args ) {
if ( is_admin() && ! defined( ‘DOING_AJAX’ ) ) {
return $args;
}$excluded = isset( $args[‘exclude’] ) ? $args[‘exclude’] : array();
if ( ! is_array( $excluded ) ) {
$excluded = explode( ‘,’, $excluded );
}
$user_id = bp_loggedin_user_id();$user_ids = array(‘user_id’ => $user_id); // user ids to exclude.
$excluded = array_merge( $excluded, $user_ids );
$args[‘exclude’] = $excluded;
return $args;
}add_filter( ‘bp_after_has_members_parse_args’, ‘buddyx_exclude_users’ );
Buddypress by default provide the creating activity on profile uploads.
If you want to add your custom activity as you have given in your code snippet you can use it like this because hook is deprecated.
// Add action to show new avatar in activity stream
function custom_bp_avatar_activity($user_id, $args) {
// Get the user data
$user = get_userdata($user_id);
$user_link = bp_core_get_userlink($user_id);// Create the activity entry
bp_activity_add(array(
‘user_id’ => $user_id,
‘action’ => sprintf(__(‘ % s has updated their avatar newly.’, ‘buddypress’), $user_link),
‘component’ => ‘profile’,
‘type’ => ‘new_avatar’,
‘item_id’ => $user_id,
));
}
add_action(‘bp_members_avatar_uploaded’, ‘custom_bp_avatar_activity’, 10, 2);
https://prnt.sc/GdVvz9bqfmdM
First Go to appearance section click on widgets and remove all widgets from the ” Members Directory Right Sidebar “.
It will remove all widgets from member directory