• Hey there,

    I’m looking to setup a re-direct to a certain page after someone has registered and is logging in for the first time. Any other time they login I need them to end up on the home page, which is easy enough, but I can’t think how to achieve re-directing to a different page when someone’s logging in after registering for the first time…

    Any ideas? they would be much appreciated!

    cheers

Viewing 7 replies - 1 through 7 (of 7 total)
  • I’m looking for something similar. Show a pop-up or re-direct a user that’s logged in for the first time. In my case I want to direct them to change there password.

    That will forward every time instead of just once for new members actually.

    Found this though …

    https://www.ads-software.com/support/topic/357901?replies=2

    global $user_ID;
    if( $user_ID ) {
    	$user_info = get_userdata( $user_ID );
    	// If user_registered date/time is less than 48hrs from now
    	// Message will show for 48hrs after registration
    	if ( strtotime( $user_info->user_registered ) < ( time() + 172800 ) )
    		echo 'Welcome, ' . $user_info->display_name . '. Thanks for registering.';
    }

    I tried that, but it shows up even if they have been a member for longer than 48 hours.

    try replacing the plus sign with a minus ??

    global $user_ID;
    if( $user_ID ) {
    	$user_info = get_userdata( $user_ID );
    	// If user_registered date/time is less than 48hrs from now
    	// Message will show for 48hrs after registration
    	if ( strtotime( $user_info->user_registered ) < ( time() - 172800 ) )
    		echo 'Welcome, ' . $user_info->display_name . '. Thanks for registering.';
    }

    Tried it with a minus, no change .. mmmm

    Well, I would like to chime in and say I too would love to have a first login redirect to change password and update a few custom fields the first go-around. I am probably looking at creating a custom form page with just the fields I need and making some custom validation to require/not-require certain fields.

    As far as the first login redirect goes, I think the only way to do it would be to store a custom per-user field in the database, like “hasLoggedIn” that is set to false by default. Then a custom action (I assume – I have not really delved into WordPress development-wise very deeply yet) would need to be added to wp-login that would check that variable, and if false, redirect to the special page and set it to true. If the variable is true, it just does nothing.

    That would be my guess, but like I said as far as actual implementation I would have to be a lot further along with my PHP skills and my familiarity with wordpress before I could tackle a full-blown plugin.

    I will post here if I have a chance to make any head-way. Any tips on the subject would be greatly appreciated!

    Thanks
    Scott

    The minus is correct, but the < should be a >

    I did a neat little JQuery twitter-style dropdown welcome message to users who have just registered… I have a short tutorial on my site if anyone finds it useful:

    https://www.brycecorkins.com/blog/2010/jquery-dropdown-message-on-first-login/

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘redirect after first login only’ is closed to new replies.