BuddyDev

Search

How to redirect only newly registered users to a welcome page

  • Participant
    Level: Guru
    Posts: 701
    Tosin on #19451

    Hello Brajesh,

    Please how can I redirect new registered users to a custom page. I am currently using your plugin Auto Activate Autologin Redirect To Profile On Signup (Version 1.4.7) and BP Force Profile Photo (Version 1.0.7). I want to achieve this registration process when new users register.

    Step 1. BuddyPress force follow 6 members
    Step 2. BP Force Profile Photo upload
    Step 3. Redirect new user to a custom welcome page (This is the step I want to achieve now)

    For step 1 I am currently using your custom snippet

     /**
     * BuddyPress force follow 6 members function.
     */
    function buddydev_check_or_redirect() {
    
    	if ( ! function_exists( 'bp_follow_get_the_following_count' ) || ! is_user_logged_in() || is_super_admin() ) {
    		return;
    	}
    
    	$fp_active = class_exists( 'BD_Force_User_Avatar_Helper') ;
    	$is_dir =  bp_is_members_directory();
    
    	// if we are on directory and force profile is not active
    	// return.
    	if (  $is_dir && ! $fp_active ) {
    		return ;
    	}
    
    	$follow_count = bp_follow_get_the_following_count( array( 'object_id' => get_current_user_id() ) );
    
    	if ( $follow_count >= 6 ) {
    		return;
    	}
    
    	if ( $is_dir && $fp_active ) {
    		remove_action( 'bp_template_redirect', array( BD_Force_User_Avatar_Helper::get_instance(), 'check_or_redirect' ), 1 );
    		return;
    	}
    
    	bp_core_add_message( __( 'Please follow 3 more members to continue.' ), 'error' );
    
    	bp_core_redirect( bp_get_members_directory_permalink() );
    }
    
    add_action( 'bp_template_redirect', 'buddydev_check_or_redirect', 0 );
     
    
    /**
     * Example to show skipping urls from the BuddyPress Force Profile Photo plugin
     *
     * @param boolean $skip
     *
     * @return bool whether to skip or not?
     */
    function buddydev_skip_urls_from_force_profile_photo( $skip ) {
     
        if ( bp_is_members_directory() ) {
            $skip = true;
        }
     
        return $skip;
    }
    add_filter( 'bp_force_profile_photo_skip', 'buddydev_skip_urls_from_force_profile_photo' ); 

    My goal now is to redirect the new user to a custom welcome page with the url slug (new-member) after the user has followed 3 users and uploaded his profile picture.

    Thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 21785
    Brajesh Singh on #19468

    Hi Tosin,
    With your setup, It will be difficult to detect what is newly registered users.

    The Auto Activate Auto login plugin has a filter ‘bpdev_autoactivate_redirect_url’ but it is for when the user registers the account.

    In your case, The neaw user means the user after completing the setup.

    It can be done but it needs modification to the above two functions you have posted.

    I will be glad to modify it for you in next couple of days(Sorry, I am not able to assist with it today/tomorrow).

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved