BuddyDev

Search

[Resolved] BP Profile vis questions

  • Participant
    Level: Initiated
    Posts: 2
    Matt Stubbs on #12404

    Hi!

    I just purchased the plugin. Seems to be working well.

    I have a couple of questions on implementation if thats ok:

    1) in settings it has added a new component, ‘profile privacy’ which is great. However, i now no longer need the default component ‘profile viability’. Could you tell me how to remove this component (maybe a function)?

    2) I worked out how to change the ‘protected’ message in profile-visibility-notice.php, but there is still a component title above it which says ‘protected’ which i can’t work out how to change. Could you advise me?

    3) How can i remove options from the privacy drop down (i dont want to offer ‘everyone’ or ‘my group members’ for profile and friends list visibility.

    After that im all set!

    Thanks for the help

    Matt

  • Keymaster
    (BuddyDev Team)
    Posts: 22178
    Brajesh Singh on #12405

    Hi Matt,
    Thank you for purchasing the plugin.

    1. That is added by BuddyPress.
    We can use the following code to remove it from settings as well as adminbar

    
    /**
     * Remove the 'Profile Visibility' added by BuddyPress in settings.
     */
    function buddydev_disable_bp_profile_visibility_settings() {
        bp_core_remove_subnav_item('settings', 'profile');
    }
    add_action( 'bp_setup_nav', 'buddydev_disable_bp_profile_visibility_settings', 1001 );
    
    /**
     * Remove the Settings->profile from adminbar menu
     */
    function buddydev_disable_bp_profile_visibility_adminbar() {
        global $wp_admin_bar;
    
    	if ( ! is_admin_bar_showing() || ! is_object( $wp_admin_bar ) ) {
    		return;
    	}
    
    	$wp_admin_bar->remove_node('my-account-settings-profile');
    
    }
    add_action( 'wp_before_admin_bar_render', 'buddydev_disable_bp_profile_visibility_adminbar', 1001 );
    
    

    2. I am not able to understand it. Can you please link me to a screenshot.

    3. Please use the following code

    
    
    /**
     * Filter Privacy option dropdown for BP profile Visibility.
     *
     * @param $privacy_options
     *
     * @return array
     */
    function buddydev_customize_profile_privacy_list( $privacy_options ) {
    	unset( $privacy_options['public'] );
    	unset( $privacy_options['groups'] );
    	return $privacy_options;
    }
    // Yes, the spelling is incorrect for this hook. 'visiility' should be 'visibility'. It is still there due to legacy code.
    add_filter( 'bp_profile_visibility_visiility_levels', 'buddydev_customize_profile_privacy_list' );
    
    

    I have tested by putting it in bp-custom.php.
    Hope that helps.

    Regards
    Brajesh

    • This reply was modified 4 years, 11 months ago by Brajesh Singh. Reason: Fix the bug in code specified in step 3
  • Participant
    Level: Initiated
    Posts: 2
    Matt Stubbs on #12474

    perfect- thank you!

  • Participant
    Level: Initiated
    Posts: 2
    Matt Stubbs on #12475

    Ah – i just tried this. 1 works perfectly, but i put the code from point 3 into bp-custom and now i have no options in drop down menus (they are both empty). Any ideas??

    Thanks in advance,

    Matt

  • Keymaster
    (BuddyDev Team)
    Posts: 22178
    Brajesh Singh on #12479

    Hi Matt,
    I am sorry for the code issue with part three. I had missed to add the return statement. Have updated the code in part three.

    Please update code from the above and it will work.

    Thank you
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved