New
PeoplePress is here. Community building for WordPress, reimagined. Fast, modern, and built for the communities you've always wanted to run.
See it live

BuddyDev

Search

Replies

  • Keymaster
    (BuddyDev Team)
    Posts: 25509

    Please post the values for “Male” and the “Female” and also the field name/id( I need to fetch the value for logged in user).

    We can make it work by using xprpofile_query. It won’t be as efficient as the member type though.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25509

    Hi Matt,
    Welcome to BuddyDev.
    You are setting the visibility for the data using the ‘xprofile_set_field_visibility_level’. Please try setting it for field using the following

    
    
    bp_xprofile_update_field_meta( $field_id, 'default_visibility', 'adminsonly' );
    bp_xprofile_update_field_meta( $field_id, 'allow_custom_visibility', 'disabled' );
    
    

    After you get the field id. That should do it.
    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25509
    Brajesh Singh on in reply to: Mediapress Activity notifications #11775

    Hi Andreas,
    I am sorry for the delayed reply. We will have a fix this week.

    regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25509

    Thank you.
    I am sorry I could not reply earlier. It seems like a bug and looks bad. Please allow me to look at this and provide a fix.

    Thank you
    brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25509

    Hi Beuza,
    Welcome to BuddyDev.

    I am sorry to hear that you were unable to find a solution. I will help as much as possible.

    First, I assume you already have the member types registered. Still, here is the code that I am using for registering member type for this example.

    
    
    /**
     * Register member types.
     */
    function buddydev_register_member_types() {
    	bp_register_member_type( 'player', array(
    		'labels'        => array(
    			'name'          => 'Players',
    			'singular_name' => 'Player',
    		),
    		'has_directory' => true,
    	) );
    
    	bp_register_member_type( 'agent', array(
    		'labels'        => array(
    			'name'          => 'Agents',
    			'singular_name' => 'Agent',
    		),
    		'has_directory' => true,
    	) );
    
    	bp_register_member_type( 'scout', array(
    		'labels'        => array(
    			'name'          => 'Scouts',
    			'singular_name' => 'Scout',
    		),
    		'has_directory' => true,
    	) );
    }
    add_action( 'bp_register_member_types', 'buddydev_register_member_types' );
    
    

    That registers member types. The important things to note is “agent”, “player” and “scout” is the actual name of member type(unique identifier) in this case. rest of the code will use them.

    Step 1:- Remove the groups form all user’s profile who don’t have the member type as ‘agent’

    
    
    /**
     * Remove groups from user profile based on member type.
     */
    function buddydev_remove_group_based_on_member_types() {
    	if ( ! bp_is_user() ) {
    		return;
    	}
    
    	$user_id = bp_displayed_user_id();
    
    	if ( ! bp_has_member_type( $user_id, 'agent' ) ) {
    		bp_core_remove_nav_item( 'groups' );
    	}
    
    }
    
    add_action( 'bp_setup_nav', 'buddydev_remove_group_based_on_member_types', 1001 );
    
    

    And it will only show the “Groups” nav on the user who have agent member type.

    We still have an issue. The adminbar for all users show “groups” and leads to page not found. let us fix that.

    Step 2:-

    
    
    /**
     * Remove groups from adminbar based on member type.
     *
     * @param array $nav nav items.
     *
     * @return array
     */
    function buddydev_filter_show_hide_groups_in_adminbar( $nav ) {
    	if ( ! is_user_logged_in() ) {
    		return $nav;
    	}
    
    	if ( ! bp_has_member_type( bp_loggedin_user_id(), 'agent' ) ) {
    		$nav = array();
    	}
    
    	return $nav;
    }
    
    add_filter( 'bp_groups_admin_nav', 'buddydev_filter_show_hide_groups_in_adminbar' );
    
    

    That’s all.

    Please put the code in your bp-custom.php and It will work.

    Hope you have a great time working with BuddyPress 🙂

    Regards
    Brajesh

    • This reply was modified 8 years, 11 months ago by Brajesh Singh. Reason: updating code
  • Keymaster
    (BuddyDev Team)
    Posts: 25509

    hi Naomi,
    I am glad you found the solution. I was also going to suggest the same(like in other thread about member-loop). Please make sure to copy the template to your current theme/child theme top avoid any overriding in future.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25509
    Brajesh Singh on in reply to: [Resolved] Quota no longer showing #11768

    Hi Graham,
    I am sorry for the inconvenience.
    I am looking at it. It may be an issue on our part. Will update you later today.

  • Keymaster
    (BuddyDev Team)
    Posts: 25509
    Brajesh Singh on in reply to: [Resolved] Lightbox problems again #11766

    Thank you for updating. Glad it is resolved.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25509
    Brajesh Singh on in reply to: Activity Feed Posts And Commenting #11765

    Hi Charlie,
    Welcome to BuddyDev.

    I believe we are following the normal procedure and the activity needs to be set in threaded view to fix it. I will check and update you later today.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25509
    Brajesh Singh on in reply to: Personalized type of user profile #11750

    Hi Leslie,
    I will today.

    Regards
    Brajesh