Shape the future of Social networking with WordPress: Join Project Midnight Sun! The next generation platform for community building with WordPress!

BuddyDev

Search

Replies

  • Keymaster
    (BuddyDev Team)
    Posts: 25347
    Brajesh Singh on in reply to: Hide profile administrator #6721

    Hi Julien,
    Please add the following code to your bp-custom.php too

    
    
    function buddydev_redirect_from_admin_profile() {
    	//not a profile page or viewing own profile page,  no redirect
    	if ( ! bp_is_user() || bp_is_my_profile() ) {
    		return;
    	}
    
    	//check if the user is admin?
    	//there are multiple ways to do it, I will show for Super admin
    	//You can use user_can(bp_displayed_user_id(), 'cap_name' ) too, Make sure to change cap name to appropriate cap
    
    	$redirect_url = site_url('/why-did-i-get-redirected');//or any url
    
    	if ( is_super_admin( bp_displayed_user_id() ) ) {
    		bp_core_redirect( $redirect_url );
    	}
    
    }
    
    add_action( 'bp_template_redirect', 'buddydev_redirect_from_admin_profile' );
    
    

    Change the redirect url as you please.

    Hope that helps.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25347

    Hi Ian,
    Welcome to BuddyDev.

    Please put this in your bp-custom.php

    
    /**
     * Set default redirect to profile group id of your choice on the Edit Profile
     *  instead of teh profile group 1 when someone opens members/name/profile/edit page
     *
     */
    function buddydev_custom_default_redirect_profile_group () {
    
    	if ( ! bp_is_my_profile() && ! bp_current_user_can( 'bp_moderate' ) ) {
    		return false;
    	}
    
    	$profile_group_id = 2;//change it to whatever
    
    	// Make sure a group is set.
    	if ( ! bp_action_variable( 1 ) ) {
    		bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/'. $profile_group_id ) );
    	}
    }
    add_action( 'bp_screens', 'buddydev_custom_default_redirect_profile_group', 2 );
    
    

    You can change the profile_group_id to the id of the default group you want to be visible.

    Hope that helps.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25347
    Brajesh Singh on in reply to: No Featured Image Option #6719

    Hi Justin,
    Sure. I won’t update today on your site though. Will do that early tomorrow.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25347
    Brajesh Singh on in reply to: [Resolved] Extended user groups plugin suggestion #6717

    🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 25347
    Brajesh Singh on in reply to: [Resolved] Personal not linking to personal #6716

    Hi Chris,
    Thank you.

    Well, now I understand the reason too. It is because you are using the Facebook like activity stream. I will check and find a way.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25347
    Brajesh Singh on in reply to: No Featured Image Option #6708

    Hi Justin,

    1. Please ask your theme developer. It is the theme css that is conflicting with WordPress media modelbox and causing it.

    2. I am sorry but at the moment, there is no way to do it. May be we can use some js and disable the submit button if the featured image is not selected, that won’t be a perfect solutin but will work for most of the cases.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25347
    Brajesh Singh on in reply to: Hide profile administrator #6707

    Hi Julien,
    There are multiple ways to do it.
    Here is one way(I just updated the above code)

    
    function bpdev_exclude_users( $qs = false, $object = false ) {
    
    	//if not members, let us return
    	if ( $object != 'members' ) {
    		return $qs;
    	}
    
    	$args = wp_parse_args($qs);
    	//we are looking into friends list if the user id is given, do not hide here
    	if ( ! empty( $args['user_id'] ) ) {
    		return $qs;
    	}
    
    	$excluded_users = get_users( array(
    		'role'      => 'administrator',
    		'fields'    => 'ID'
    	) );
    
    	if ( ! empty( $args['exclude'] ) ) {
    
    		if ( ! is_array( $args['exclude'] ) ) {
    			$args['exclude'] = explode( ',', $args['exclude'] );
    		}
    
    		$args['exclude'] = array_merge( $args['exclude'], $excluded_users );
    
    	} else {
    		$args['exclude'] = $excluded_users;
    	}
    
    	$args['exclude'] = join(',', $args['exclude'] );
    
    	$qs = build_query($args);
    
    	return $qs;
    
    }
    add_action( 'bp_ajax_querystring','bpdev_exclude_users', 20, 2 );
    
    

    Please put it in your bp-custom.php and all the admins will be invisible in the members directory.

    Hope that helps.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25347

    Hi Joshua,
    Thank you for the details. I did check the site and It seems perhaps you have figured out the registration link redirection.

    Still, if you are going to use BuddyPress, if you enable BP_ENABLE_MULTIBLOG in bp-custom.php, the registration page will be available per site basis. I will suggest that we redirect to the accounting site if it accessed from other sites

    Hope that helps.

  • Keymaster
    (BuddyDev Team)
    Posts: 25347

    You are most welcome.

  • Keymaster
    (BuddyDev Team)
    Posts: 25347
    Brajesh Singh on in reply to: [Resolved] Extended user groups plugin suggestion #6696

    Wow, is that the left block. Looks great 🙂