solved Redirect on first login

alt=
@hello77957
5 years ago
56 posts
Hi, is it possible to redirect users to a welcome page the first time they login? With subsequent logins taking them straight to their profile pages?
updated by @hello77957: 08/10/19 01:20:51PM
paul
@paul
5 years ago
4,325 posts
Not sure if this is possible without something custom. How are you verifying their signups?
Thanks


--
Paul Asher - JR Developer and System Import Specialist
alt=
@hello77957
5 years ago
56 posts
Hi Paul, I'm creating their accounts for them then sending them the login info.
The site is only for a very small group, so not worth making a custom redirect, i'll just tell them to go to the page instead.

Thanks for your input!
paul
@paul
5 years ago
4,325 posts
In that case try adding this at the top of your skin's profile_header.tpl template -

{if !isset($_user['user_has_logged_in'])}
	{jrCore_array name='_x' key='user_has_logged_in' value=1}
    {jrCore_db_update_item('jrUser', $_user['_user_id'], $_x)}
    {jrCore_location("`$jamroom_url`/new_user_welcome_page")}
{/if}

Its a bit of a sprag in that it updates the user's datastore directly, but it works!!
Set the jrCore_location URL to wherever your welcome page is.
hth


--
Paul Asher - JR Developer and System Import Specialist
michael
@michael
5 years ago
7,692 posts
You could probably get by without updating the database if you used the
user_last_login
key instead.

If that is 0 then they haven't logged in. so
{if isset($_user['user_last_login']) && $_user['user_last_login'] == 0 }
    {jrCore_location("`$jamroom_url`/new_user_welcome_page")}
{/if}
might be worth a go too.
last_login.jpg
last_login.jpg  •  202KB


updated by @michael: 05/02/19 10:23:46PM
paul
@paul
5 years ago
4,325 posts
That was my first thought Michael but user_last_login does get set to the current time upon login


--
Paul Asher - JR Developer and System Import Specialist
michael
@michael
5 years ago
7,692 posts
Ah, right. We're too late to use that. gotcha.
alt=
@hello77957
5 years ago
56 posts
Perfect! Thanks Paul and Michael!

Tags