My account link

Posted:
November 30th, 2011, 3:13 pm
by defeyter
Hello,
If I want the My Account link (or welcome page link) to be displayed on a page and not in a sidebar, which code would I put in? Every client has their own page, based using %%current_user_login%% as welcome page.
I have looked on this forum and in the docs, but I cannot find it.
Thanks,
Chris de Feijter
S2Member Pro user.
Re: My account link

Posted:
December 1st, 2011, 1:44 am
by Raam Dev
Hi Chris,
Under
WP Admin -> s2Member -> API/Scripting -> s2Member PHP/API Constants, you'll find this bit:
S2MEMBER_CURRENT_USER_LOGIN
This will always be a (string) containing the current User's Username. Empty if not logged in.
<?php echo S2MEMBER_CURRENT_USER_LOGIN; ?>
This may output something like: johnsmith22
( or whatever their login/username is )
---- s2member Shortcode Equivalent ----
[s2Get constant="S2MEMBER_CURRENT_USER_LOGIN" /]
So, if you were on a WordPress Page, you could construct a My Account link using something like this:
- Code: Select all
<a href="/members/[s2Get constant="S2MEMBER_CURRENT_USER_LOGIN" /]/profile/">My Account</a>
or, if you wanted to do it with PHP from a template file:
- Code: Select all
<a href="/members/<?php echo S2MEMBER_CURRENT_USER_LOGIN; ?>/profile/">My Account</a>
Does that answer your question?
Re: My account link

Posted:
December 1st, 2011, 9:17 am
by defeyter
Thanks Raam Dev, it worked. I now have a link.
Great help and have a good holiday season.
Chris
Re: My account link

Posted:
December 1st, 2011, 8:28 pm
by Raam Dev
You're welcome, Chris! Glad it worked out.

Have a great holiday season!