Page 1 of 1

current_user_access_label returns incorrect result

PostPosted: June 23rd, 2011, 10:38 pm
by doctorproctor
Greetings -- I am using the below on a page to return to a logged in user the s2 membership level:

You currently have [s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LABEL" /] status.

What I've discovered upon testing, however, is that whether the user level is 1, 2, 3, or 4, the label returned is always that which corresponds to level 4. Preceding this statement I have the shortcode:

Greetings, [s2Get constant="S2MEMBER_CURRENT_USER_DISPLAY_NAME" /]!

which returns the correct result, so I'm sure s2Member is accessing the correct record for a given user.

Can you please help me diagnose? I'd sure appreciate; thanks.

Jim P.

Re: current_user_access_label returns incorrect result

PostPosted: June 23rd, 2011, 10:42 pm
by Cristián Lávaque
Could it be that you first viewed the page as an Admin and now you're getting a cached copy of it? Did you login with an account at another level for the test and refresh the page?

Re: current_user_access_label returns incorrect result

PostPosted: June 23rd, 2011, 10:51 pm
by doctorproctor
I'm using a different browser for my admin and user accounts, so I don't think the above is what's happening. Also, below the troublesome shortcode I have

Code: Select all
Your membership expires on <?php echo date('l F jS, Y', get_user_option('wp_s2member_auto_eot_time', $user_id)); ?>.


and it works fine for the user, so it's only the user access label that's not working. It's true that I'm logged in as admin at the same time I'm querying membership status on a different browser for the user, but it sounds remote that the admin status is being returned for this variable only.

Thanks for your quick reply!

Jim

Re: current_user_access_label returns incorrect result

PostPosted: June 23rd, 2011, 11:14 pm
by Cristián Lávaque
I see, yes it's odd. I'll ask Jason about the constant. In the meantime, you can try this for the label:

Code: Select all
<?php echo get_user_field('s2member_access_label', $user_id); ?>

Re: current_user_access_label returns incorrect result

PostPosted: June 23rd, 2011, 11:19 pm
by doctorproctor
Interesting, the php returns the same level 4 label. Do ask; thanks. Is anyone else experiencing this behavior? I'll try to create a few test users and verify the problem as well.

Regards,

Jim

Re: current_user_access_label returns incorrect result

PostPosted: June 23rd, 2011, 11:30 pm
by Cristián Lávaque
Could you show me a screenshot of the labels panel? WP Admin -> s2Member -> General Options -> Membership Levels/Labels

Re: current_user_access_label returns incorrect result

PostPosted: June 23rd, 2011, 11:32 pm
by Cristián Lávaque
Are you sure that the account you're testing is not at Level 4?

Re: current_user_access_label returns incorrect result

PostPosted: June 23rd, 2011, 11:35 pm
by doctorproctor
It's currently at s2Member Level 1. I've tried at all levels and it always returns level 4 label...thanks...Jim

Re: current_user_access_label returns incorrect result

PostPosted: June 24th, 2011, 12:01 am
by Jason Caldwell
Thanks for reporting this important issue.
doctorproctor wrote:Interesting, the php returns the same level 4 label. Do ask; thanks. Is anyone else experiencing this behavior? I'll try to create a few test users and verify the problem as well.
Yes, very interesting. I've been unable to reproduce this so far. Can you attach some screenshots of your code in it's entirety ( i.e. as it appears in your WordPress editor )? We'll be happy to take a closer look for you. Also, screenshots of your s2Member ->General Options -> Membership Levels/Labels as well please.

Re: current_user_access_label returns incorrect result

PostPosted: June 24th, 2011, 8:23 am
by doctorproctor
Okay, here you go (see screenshots below from bottom to top), and thanks for your help...Jim

Re: current_user_access_label returns incorrect result

PostPosted: June 25th, 2011, 2:33 am
by Jason Caldwell
Thank you so much.
Well, you've really got me puzzled on this one. I have no response to this yet, and I've been unable to reproduce it so far on my end. Is it possible for you to send me a Dashboard login for that installation so I an see this for myself? If so, please use this private contact form: http://www.s2member.com/contact/

Re: current_user_access_label returns incorrect result

PostPosted: June 25th, 2011, 10:07 am
by doctorproctor
Okay, have sent you info, and thanks again for your great support.

Jim

Re: current_user_access_label returns incorrect result

PostPosted: June 25th, 2011, 5:34 pm
by Jason Caldwell
Thank you, and you're very welcome too. Information received. Investigating now.

Re: current_user_access_label returns incorrect result

PostPosted: June 27th, 2011, 10:59 pm
by Jason Caldwell
Investigation completed.
The problem on your installation was related to a corruption of your s2Member Roles/Capabilities. It appears that you are running the User Role Editor plugin, and that you, or someone working with you modified the s2Member Roles in ways that rendered them unstable. I've restored your s2Member Roles/Capabilities for you and everything is working fine now. Please let us know if you continue to have trouble.