BuddyDev

Search

Replies

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115

    Hello Toury,

    Thank you for the acknowledgment. I am glad that I could help.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Auto join groups – cron job #39610

    Hello Darshan,

    Please use the following code. This code will sync the user’s group based on the group field id. Make sure to replace the group field with your field id.

    
    
    /**
     * Sync user's groups
     *
     * @param int   $user_id       User id.
     * @param array $new_group_ids New group ids.
     */
    function buddydev_sync_user_groups( $user_id, $new_group_ids ) {
    
    	if ( ! $user_id || ! $new_group_ids ) {
    		return;
    	}
    
    	$user_group              = groups_get_user_groups( $user_id );
    	$existing_user_group_ids = (array) $user_group['groups'];
    
    	$removable_group_ids = array_diff( $existing_user_group_ids, $new_group_ids );
    	$new_join_group_ids  = array_diff( $new_group_ids, $existing_user_group_ids );
    
    	foreach ( $removable_group_ids as $group_id ) {
    		groups_leave_group( $group_id, $user_id );
    	}
    
    	foreach ( $new_join_group_ids as $group_id ) {
    		groups_join_group( $group_id, $user_id );
    	}
    }
    
    /**
     * Sync user's groups on field save.
     */
    add_action( 'xprofile_data_after_save', function ( BP_XProfile_ProfileData $object ) {
    	$field_id = $object->field_id;
    
    	// Replace field id with yours field id.
    	$group_field_id = 5;
    
    	// If not our field id return.
    	if ( $group_field_id != $field_id ) {
    		return;
    	}
    
    	$new_group_ids = wp_parse_id_list( $object->value );
    
    	if ( empty( $new_group_ids ) ) {
    		// should we remove existing groups?
    		// let us avoid that for now.
    		return;
    	}
    
    	buddydev_sync_user_groups( $object->user_id, $new_group_ids );
    } );
    
    

    Please do let me know if it works or not.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115

    Hello Toury,

    Try the following code and let me know if it helps or not.

    
    
    add_action( 'bp_before_directory_activity_content', function () {
    	echo do_shortcode( '[buddypressglobalsearch]' );
    } );
    
    

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Default Profile Screen #39544

    Hello Lisa,

    Thank you for the acknowledgment. I am glad that I could help.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Change profile permalink slug #39536

    Hello Tosin,

    Thank you for posting. Just update the permalink of the ‘Members’ page from ‘members’ to ‘user’ and check.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: [Resolved] Default Profile Screen #39535

    Hello Lisa,

    Please use the following code:

    
    /**
     * Override default nav profile.
     */
    function buddydev_set_profile_default_nav() {
    
    	if ( ! bp_is_my_profile() ) {
    		return;
    	}
    
    	add_filter( 'bp_do_redirect_canonical', '__return_false' );
    
    	bp_core_new_nav_default(
    		array(
    			'parent_slug'     => bp_get_profile_slug(),
    			'subnav_slug'     => 'edit',
    			'screen_function' => 'xprofile_screen_edit_profile',
    		)
    	);
    // Determine user to use.
    	if ( bp_displayed_user_domain() ) {
    		$user_domain = bp_displayed_user_domain();
    	} elseif ( bp_loggedin_user_domain() ) {
    		$user_domain = bp_loggedin_user_domain();
    	} else {
    		return;
    	}
    
    	$slug         = bp_get_profile_slug();
    	$profile_link = trailingslashit( $user_domain . $slug );
    
    	bp_core_new_subnav_item(
    		array(
    			'name'            => _x( 'View', 'Profile header sub menu', 'buddypress' ),
    			'slug'            => 'public',
    			'parent_url'      => $profile_link,
    			'parent_slug'     => bp_get_profile_slug(),
    			'screen_function' => function () {
    				xprofile_screen_display_profile();
    			},
    			'position'        => 10,
    		)
    	);
    }
    
    add_action( 'bp_setup_nav', 'buddydev_set_profile_default_nav', 20 );
    
    

    Please do let me know if it works or not.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: BUDDYPRESS BLOCK USERS PLUGIN #39526

    Hello Deepa,

    Sorry for the inconvenience. I have tested it and it is showing fine for me. Please do let me know which theme you are using. Also, If possible please share the screenshots of the mobile view.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: BP Anonymous Activity plugin for Buddyboss App #39519

    Hello Eric,

    Thank you for posting here. As we do not deal with the apps and we do not have access to their app code. We can not help you much with this issue. You have to ask for help from BuddyBoss for sorting out this issue.

    Any other assistance is needed please let me know.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115

    Hello Omar,

    I have tested the plugin and it is working fine for me. Take a look at the following screenshots:

    https://tinyurl.com/ydm7mrhg Add Field Make sure to display in extra tab publicly.
    https://tinyurl.com/yh7xsg5j Facebook Link under extra tab.

    Regards
    Ravi

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on in reply to: BuddyPress Profile Completion plugin not working #39476

    Hello Jane,

    Sorry for the inconvenience. Please let me know the issue you are facing so that I can help you.

    Regards
    Ravi