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

    Hi Julia,
    Sorry, we do not plan to add it to Profile Visibility Manager. We do plan to have a successor of the Profile visibility manager in future that will have such functionality.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25509

    Hi Beuza,
    here is the code

    
    /**
     * 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' );
    
    		$access = bp_core_can_edit_settings();
    		$friends_link = bp_displayed_user_domain()? bp_displayed_user_domain() : bp_loggedin_user_domain();
    		$friends_link = trailingslashit( $friends_link . bp_get_friends_slug() );
    		bp_core_new_subnav_item(array(
    			'name'            => __( 'Invitations', 'buddypress' ),
    			'slug'            => 'invites',
    			'parent_url'      => $friends_link,
    			'parent_slug'     => bp_get_friends_slug(),
    			'screen_function' => 'buddydev_groups_screen_group_invites',
    			'user_has_access' => $access,
    			'position'        => 30
    		));
    		// move the invitations to the friends screen.
    	}
    }
    
    add_action( 'bp_setup_nav', 'buddydev_remove_group_based_on_member_types', 1001 );
    
    /**
     * Helps us detect screen.
     */
    function buddydev_groups_screen_group_invites() {
        add_action( 'groups_screen_group_invites', 'buddydev_load_invite_template' );
    	groups_screen_group_invites();
    }
    
    /**
     * Load our template.
     */
    function buddydev_load_invite_template() {
        add_action( 'bp_template_content', function () {
            bp_get_template_part('members/single/groups/invites');
        });
    
    	bp_core_load_template('members/single/plugins' );
    }
    
    /**
     * Change the invite link url for the non 'agent' users.
     *
     * @param string $link original link.
     *
     * @return string
     */
    function buddydev_update_group_invite_link( $link ) {
        // for agent, do not break it.
        if ( bp_has_member_type( bp_loggedin_user_id(), 'agent' ) ) {
           return $link;
        }
    
    	global $groups_template;
    
    	if ( empty( $group ) ) {
    		$group =& $groups_template->group;
    	}
    
    	return wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_friends_slug() . '/invites/accept/' . $group->id ), 'groups_reject_invite' ) ;
    }
    
    add_filter( 'bp_get_group_accept_invite_link', 'buddydev_replace_group_to_friends_in_group_invite' );
    
    /**
     * Change the reject link url for the non 'agent' users.
     *
     * @param string $link original link.
     *
     * @return string
     */
    function buddydev_update_group_reject_link( $link ) {
        // for agent, do not break it.
        if ( bp_has_member_type( bp_loggedin_user_id(), 'agent' ) ) {
           return $link;
        }
    
    	global $groups_template;
    
    	if ( empty( $group ) ) {
    		$group =& $groups_template->group;
    	}
    
    	return wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_friends_slug() . '/invites/reject/' . $group->id ), 'groups_reject_invite' ) ;
    }
    
    add_filter( 'bp_get_group_reject_invite_link', 'buddydev_replace_group_to_friends_in_group_invite' );
    
    /**
     * 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' );
    
    

    It should work. Can you please give it a try? I haven’t tested it but it should work.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25509
    Brajesh Singh on in reply to: [Resolved] Media Moderator not showing…? #12172

    Are you using any caching? Since the new update needs to load updated version of the js file. Can you please try clearing browser cache and see if it works?

  • Keymaster
    (BuddyDev Team)
    Posts: 25509
    Brajesh Singh on in reply to: [Resolved] Media Moderator not showing…? #12168

    Hi Richard,
    Thank you for the feedback.

    Please make sure that you have saved the settings atleast once.

    It will appear below the textbox.

    Please check and let me know.

  • Keymaster
    (BuddyDev Team)
    Posts: 25509
    Brajesh Singh on in reply to: [Resolved] Media Moderator not showing…? #12166

    Thank you Richard.

    I am looking forward to your feedback.

  • Keymaster
    (BuddyDev Team)
    Posts: 25509

    Yes, you will get a notification. I hoping to do it this weekend. Once I push the release, will post back here.

    Thank you for the patience.
    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25509
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 25509

    Will it be easier for you if I made all your activity private?

  • Keymaster
    (BuddyDev Team)
    Posts: 25509

    Hi Julia,
    Thank you for posting.

    Question 1:- By default if you do not specify a default sub nav slug, the first child tab is opened. If you do not want the first child tab to be opened by default, please specify the slug of different slug.

    In your case, It seems you have provided a default slug which is not the slugh of child tab and that’s why it is happening. Just removing the default slug value will fix it.

    Question 2:-
    The plugin provides reordering.

    1. For New parent Tab and child tabs, you can just drag and reorder child tabs.
    2. For existing Parent and new/existing child tab, you will see the position input. you can specify a number. Please see our tutorial on this
    https://buddydev.com/docs/guides/plugins/buddypress-plugins/buddypress-user-profile-tabs-creator-pro/modifying-pre-existing-sub-nav-item/

    Question 3:-
    domain.com/members/activity/all-stream:- It is coming from community Activity on profile plugin, please disable it.

    and

    
     I moved to domain.com/members/activity/my-stream (I used tab visible option, only profile owner can see this)
    

    Sorry, I am not sure I understood it correctly. Can you please help me understand it better(purpose etc).

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25509

    Hi Herve,
    Thank you for the patience.

    I have updated the gist
    https://gist.github.com/sbrajesh/238153f70f770f957fd1c4b2ba60be77

    Now, I have placed placeholder for the member type and message there. Please update that.

    About your other membership etc, I will suggest either hooking to “buddydev_bp_user_profile_completed” action or just put all the code in the set_member_type() method. That will be sufficient.

    Regards
    Brajesh