Page 1 of 1

How to display the membership level for other users?

PostPosted: August 27th, 2011, 9:29 am
by candy
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!

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

PostPosted: August 27th, 2011, 3:57 pm
by candy
Anyone?

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

PostPosted: August 27th, 2011, 11:12 pm
by Cristián Lávaque
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. :)

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

PostPosted: August 27th, 2011, 11:22 pm
by candy
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!

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

PostPosted: August 28th, 2011, 2:37 am
by Cristián Lávaque
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.