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™

Dynamically populated field

s2Member Plugin. A Membership plugin for WordPress®.

Dynamically populated field

Postby mochajen » August 14th, 2011, 6:39 pm

Hello. In a Gravity form, I'd like to dynamically populate a field with with the user's membership level. I can't seem to find parameters for variables like member level. Could you tell me what that might be or direct me to a page/documentation where I can find official database calls?
Thanks,
Jen
User avatar
mochajen
Registered User
Registered User
 
Posts: 22
Joined: August 13, 2011

Re: Dynamically populated field

Postby Bruce C » August 14th, 2011, 8:48 pm

Found this on http://wordpress.org/support/topic/how- ... rrent-user.

Code: Select all
<?php
global $current_user, $wpdb;
$role = $wpdb->prefix . 'capabilities';
$current_user->role = array_keys($current_user->$role);
$role = $current_user->role[0];
echo $role;
?>


It's kind of complex since WordPress doesn't have a built-in function for that. I'm not sure why.

Hope I helped!
:D
~Bruce ( a.k.a. Ace )

If you're interested in a Professional Installation, or Custom Coding Job, you can send your request here.

Proud Supporter of:
The Zeitgeist Movement
and Occupy Everything
User avatar
Bruce C
Experienced User
Experienced User
 
Posts: 337
Joined: July 20, 2011

Re: Dynamically populated field

Postby Cristián Lávaque » August 15th, 2011, 3:09 pm

s2Member provides a constant for that. WP Admin -> s2Member -> API / Scripting -> s2Member PHP/API Constants -> S2MEMBER_CURRENT_USER_ACCESS_LEVEL or S2MEMBER_CURRENT_USER_ACCESS_LABEL

Or do you need to find the level for a user that's not the current one?
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: Exabot [Bot], Google [Bot] and 1 guest

cron