latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

custom login redirection

Home Forums Community Forum custom login redirection

This topic contains 10 replies, has 2 voices. Last updated by  Seamus Donohue 3 years, 8 months ago.

Topic Author Topic
Posted: Sunday Apr 21st, 2013 at 3:20 pm #48054

I am setting up a free site for my students and I would like students registering to select their class and this selection automatically redirecting them to the correct welcoming page and onward to their area. I have put in a custom profile field which they select their class from and if I could feed this into the custom welcome page URL it would be over and done with in seconds. It does not seem possible to do this. Is there a way?

List Of Topic Replies

Viewing 10 replies - 1 through 10 (of 10 total)
Author Replies
Author Replies
Posted: Monday Apr 22nd, 2013 at 7:22 am #48082

You could have just one Login Welcome page with a conditional that checks that custom profile field and shows a different message based on its value.

[hilite path]Dashboard -› s2Member® -› API / Scripting -› Advanced PHP Conditionals[/hilite]
[hilite path]Dashboard -› s2Member® -› API / Scripting -› PHP/API Constants -> S2MEMBER_CURRENT_USER_FIELDS[/hilite]
http://www.s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_get_user_field%28%29

Posted: Tuesday Apr 23rd, 2013 at 3:14 am #48154

Is there a knowledge base link that shows me how to use these. Do I need to get the field then use the conditional. There is no example of using a custom field with a conditional.
many thanks

Posted: Tuesday Apr 23rd, 2013 at 7:07 am #48167

You’d get the value for the custom field and then check the value in a condition…

If you custom field’s ID is “class”, it’d be something like this, I guess:

[hilite pre_code]

Content for Class 1

[/hilite]

It may be different depending on the type of custom field you created.

Anyway, that example should give you an idea of how it is. You may need to do some tests, but it won’t be too hard.

Posted: Tuesday Apr 23rd, 2013 at 8:39 am #48184

It doesn’t seem to be retrieving the custon field “year”. This is a field I added to the registration field, but I have since upgraded to pro. Would this make a difference?
many thanks

Posted: Tuesday Apr 23rd, 2013 at 8:44 am #48186

No, Pro doesn’t change this at all.

Did you make sure the field has a value? And did you test if you could retrieve it successfully?

[hilite pre_code]
$year = get_user_field('year');
echo $year;
[/hilite]

You may need to play around with it and test a bit until you get it right.

Posted: Tuesday Apr 23rd, 2013 at 9:26 am #48189

I can’t get it to retrieve the “year” information.
many thanks

Posted: Tuesday Apr 23rd, 2013 at 7:29 pm #48226

I can take a look if you submit your site’s info. Let me know when you do. s2Member® » Private Contact Form

Posted: Wednesday Apr 24th, 2013 at 3:30 am #48263

Thank you, what do you need? logins?

Posted: Wednesday Apr 24th, 2013 at 7:52 am #48280

Thanks, got the email.

I see, your “year” field is multioption with checkboxes. That’d give you an array, not a string. Would someone select more than one year? If not, you may prefer to use a dropdown.

Anyway, you can see the format of your array doing:

[hilite pre_code]
$year = get_user_field('year');
print_r($year);
[/hilite]

outputs

Array
(
	[0] => year11
)

So your condition would go like something this:

[hilite pre_code]

Content for year 11.

[/hilite]

http://php.net/in_array

You may need to add some extra checks in the condition, for those that didn’t select a year.

I hope that helps.

Posted: Wednesday Apr 24th, 2013 at 8:39 am #48281

I did have a dropdown but I read somewhere that pro didn’t support dropdowns. At that time I was trying to add capabilities via the free registration pro form.
I will try this.
Thanks again

Viewing 10 replies - 1 through 10 (of 10 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.