BuddyDev

Search

[Resolved] Tab not moving / default sub nav not changing

  • Participant
    Level: Initiated
    Posts: 10
    Andreas Englowski on #17632

    Hi, i am trying to change the friends tab name and reposition it. Renaming works fine but its not changing position. Did check the “Buddypress Tab positions” help and did enter 15 as value which should place it as second between activity and profile, aint?

    Next thing is that i want to rename the default sub nav for the friends tab (which just shows the friends) but i dont get how to achieve because i cant find a slug. Is there a slug for the default sub nav? Did try play around with the default subnav setting in tab but i dont get it. Hope you can help?

    Thanks in advance,
    Andi

    My Settings:
    https://www.dropbox.com/s/mo4ew8lqfe028ab/Edit%20Profile%20Tab%20%E2%80%B9%20AdviZZr%C2%AE%20%E2%80%94%20WordPress.pdf?dl=0

    Missing Slug / Sub nav to rename:
    https://www.dropbox.com/s/1lft8ep0sk8jqy2/Screen1.png?dl=0

    https://www.dropbox.com/s/1lft8ep0sk8jqy2/Screen1.png?dl=0

  • Keymaster
    (BuddyDev Team)
    Posts: 21779
    Brajesh Singh on #17645

    Hi Andreas,
    Welcome to BuddyDev Forums.

    Here is the stepwise guide to help you.

    1. Changing label and position:- If 15 does not work, THere is a possibility that some plugin is using a lower value. Try using a lower value like 9 or so.

    2. For sub nav, Please use ‘my-friends’ as shown below.

    a. https://i.imgur.com/hlL4dqA.png

    b. https://i.imgur.com/unbqgke.png

    c. https://i.imgur.com/G3wgCnf.png

    d. https://i.imgur.com/7AoWjeL.png

    Please try it and let me know if it works or not?

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 10
    Andreas Englowski on #17651

    Hi, many thanks for your fast reply, thats awesome!

    1. Did try different values, still nothing changing. I did also try to create all tabs in the backend and did only change the number for position – but still nothing is changing. Hope you can help 🙂

    2. That worked just great, thank you. One more question: need to rename the default profile tab aswell, can you tell me which slug to use here? Please see image:
    https://www.dropbox.com/s/smsopip7tht3rwn/screen2.png?dl=0

    Thanks in advance,
    Andi

  • Keymaster
    (BuddyDev Team)
    Posts: 21779
    Brajesh Singh on #17656

    Hi Andi,
    I am sorry for the delayed reply.

    1. It seems to me there is another tab there which is using the position. Can you please tell me what is the “Berater Dashboard”?

    2. Sure, Please use ‘public’.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 10
    Andreas Englowski on #17673

    Hi Brajesh, no worries your support is blazing fast, many thanks for that!!

    1. i did deactivate all third party plugins which add a tab to buddypress profile and its still not working. but its okay since most important to me was to reposition and rename my additional tabs and that is working great so all good!

    2. works 🙂

    3. One last question: i have made a additional subnav to the profile tab which i like to replace with the default “public” subnav for some user roles (vendors). so i did deactivate the “public” subnav for those users but now i get an error because the default subnav is missing. is it possible to have default subnav items based on user role? i know thats a bit tricky but maybe you have a idea 🙂

    Many thanks,
    Andi

  • Participant
    Level: Initiated
    Posts: 10
    Andreas Englowski on #17674

    Update: Did find this one but seems to do not work anymore.
    https://buddydev.com/changing-default-subnav-buddypress-component/#comment-1976527

    Where do i have the code snippet, to my themes functions.php? 🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 21779
    Brajesh Singh on #17687

    Hi Andi,

    Thank you for the kind words.

    1. I am still not sure as I have never found this issue. Try using 2 or 3 and see what happens.

    2. That’s good.

    3. I am sorry but the function ‘bp_core_new_nav_default’ is broken in BuddyPress 3.x . It is not working with 3.2 too and I have seen a ticket where it seems it will be available in 3.3. We will have to wait for it to use it again.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 10
    Andreas Englowski on #17713

    Many many thanks Brajesh! So i am gonna wait for 3.3 =)

    One (hopefully) last question: i am refering to https://buddydev.com/exclude-users-from-members-directory-on-a-buddypress-based-social-network/ to remove all customers from the friend list which is working fine on the members directory. But with the code below the members are also hidden from the friendlist on the userprofile (did seperate the if statements for testing). Do you have a idea?

    
    
    add_action('bp_ajax_querystring','bpdev_exclude_users',20,2);
    function bpdev_exclude_users($qs=false,$object=false){
        //list of users to exclude
         
        if($object!='members')//hide for members only
            return $qs;
            
        $excluded_user=join(',',bpdev_get_customer_user_ids());//comma separated ids of users whom you want to exclude
      
        
        $args=wp_parse_args($qs);
        
        //check if we are are listing friends?, do not exclude in this case
     	if(!empty($args['user_id']))
     	return $qs;
    	
        //check if we are searching?, do not exclude in this case
     	if(!empty($args['search_terms']))
     	return $qs;
    	
    	
        
        if(!empty($args['exclude']))
            $args['exclude']=$args['exclude'].','.$excluded_user;
        else 
            $args['exclude']=$excluded_user;
          
        $qs=build_query($args);
       
       
       return $qs;
        
    }
    
    function bpdev_get_customer_user_ids(){
      
        $customers= get_users( array( 'role' => 'customer', 'fields' => 'ID' ) );
      
       return $customers;
    }
    
    
  • Participant
    Level: Initiated
    Posts: 10
    Andreas Englowski on #17715

    oh and one more question (sorry for not opening a new topic): is it possible to remove the “All Members” from the groups->send invites tab? i read that normally you can only invite friends to groups (which is what a want) but in my buddypress all users have the possible to invite all members… see screenshot:

    https://www.dropbox.com/s/jf4hwdqdssepji2/screen.png?dl=0

    after all those questioning – and i am sorry i know it got quite offtopic and you still provide fast and excellent support: is it possible to buy you a pizza or something? i would love to donate a little money via paypal if thats possible =)

  • Keymaster
    (BuddyDev Team)
    Posts: 21779
    Brajesh Singh on #17721

    Hi Andi,

    Thank you.

    1. Here is a slightly cleaned code. The actual change is only one line(adding bp_is_user())

    
    
    /**
     * Filter Members list.
     *
     * @param string|array $qs query string.
     * @param string       $object object type.
     *
     * @return bool|string
     */
    function bpdev_exclude_users( $qs = '', $object = '' ) {
    	// list of users to exclude.
    
    	if ( $object != 'members' || bp_is_user() ) { // hide for members only in the directory.
    		return $qs;
    	}
    
    	$excluded_user = join( ',', bpdev_get_customer_user_ids() );//comma separated ids of users whom you want to exclude
    
    	$args = wp_parse_args( $qs );
    
    	// check if we are are listing friends?, do not exclude in this case.
    	if ( ! empty( $args['user_id'] ) ) {
    		return $qs;
    	}
    
    	// check if we are searching?, do not exclude in this case.
    	if ( ! empty( $args['search_terms'] ) ) {
    		return $qs;
    	}
    
    	if ( ! empty( $args['exclude'] ) ) {
    		$args['exclude'] = $args['exclude'] . ',' . $excluded_user;
    	} else {
    		$args['exclude'] = $excluded_user;
    	}
    
    	$qs = build_query( $args );
    
    	return $qs;
    }
    
    add_action( 'bp_ajax_querystring', 'bpdev_exclude_users', 20, 2 );
    
    function bpdev_get_customer_user_ids() {
    
    	$customers = get_users( array( 'role' => 'customer', 'fields' => 'ID' ) );
    
    	return $customers;
    }
    
    

    2. Are you using invite anyone? It is coming from that plugin most probably.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved