PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

How to display the membership level for other users?

s2Member Plugin. A Membership plugin for WordPress®.

How to display the membership level for other users?

Postby candy » August 27th, 2011, 9:29 am

Hi,

I couldn't find this anywhere, how can I display the Membership name of an user?

All I found is this
<?php echo S2MEMBER_CURRENT_USER_ACCESS_LABEL; ?>

but I am not interested to show the user what membership level he has, just want to display what membership level the OTHER users have. So if the user X looks into the profile of user Y, I want userX to see which membership level user Y has.

I tried <?php echo S2MEMBER_USER_ACCESS_LABEL; ?> but it does not work, which is the right code please?

Thanks!
User avatar
candy
Registered User
Registered User
 
Posts: 102
Joined: November 16, 2010

Re: How to display the membership level for other users?

Postby candy » August 27th, 2011, 3:57 pm

Anyone?
User avatar
candy
Registered User
Registered User
 
Posts: 102
Joined: November 16, 2010

Re: How to display the membership level for other users?

Postby Cristián Lávaque » August 27th, 2011, 11:12 pm

Code: Select all
<?php
$user_id 
123;
$user = new WP_User($user_id);
echo 
c_ws_plugin__s2member_user_access::user_access_label($user);
?>


viewtopic.php?f=40&t=12916&src_doc_v=110815#src_doc_user_access_label%28%29

I hope that helps. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: How to display the membership level for other users?

Postby candy » August 27th, 2011, 11:22 pm

Thanks :), but I do not have the user ID :-(
Should be all of them other than the loged in user ...

Guess I should replace that 123 with some sort of string, but which !?? :cry:

Thanks!
User avatar
candy
Registered User
Registered User
 
Posts: 102
Joined: November 16, 2010

Re: How to display the membership level for other users?

Postby Cristián Lávaque » August 28th, 2011, 2:37 am

When you're showing a user's information in the page, you should have his ID available to use it for this. In my example I hardcoded 123 to show you a value, but you can take it from the user's information.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 2 guests

cron