Dynamically populated field
Posted:
August 14th, 2011, 6:39 pm
by mochajen
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
Re: Dynamically populated field
Posted:
August 14th, 2011, 8:48 pm
by Bruce C
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!
Re: Dynamically populated field
Posted:
August 15th, 2011, 3:09 pm
by Cristián Lávaque
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?