latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Can't get first and last name

Home Forums Community Forum Can't get first and last name

This topic contains 3 replies, has 3 voices. Last updated by  Raam Dev 4 years, 9 months ago.

Topic Author Topic
Posted: Thursday Apr 12th, 2012 at 8:08 am #10647
Angela Zou
Username: angelaz

Hi, I’m having a little trouble getting 2 constants to display. I want to get the user’s first name and last name using [s2Get constant="S2MEMBER_CURRENT_USER_FIRST_NAME" /] and [s2Get constant="S2MEMBER_CURRENT_USER_LAST_NAME" /] (I tried uppercase, lowercase, even mixed case). However, they always come back blank, even though I can see there are values in the edit profile field.

List Of Topic Replies

Viewing 3 replies - 1 through 3 (of 3 total)
Author Replies
Author Replies
Posted: Thursday Apr 12th, 2012 at 8:24 am #10650

Hi,

i use this php plugin “PHP Execution”

and that’s are my php codes

<?php
$user_login = get_user_field ("user_login");
# Username for the current User.
$user_email = get_user_field ("user_email"); 
# Email Address for the current User.
$first_name = get_user_field ("first_name"); 
# First Name for the current User.
$last_name = get_user_field ("last_name"); 
# Last Name for the current User.
$full_name = get_user_field ("full_name"); 
# First and Last Name for the current User.
$display_name = get_user_field ("display_name"); 
# Display Name for the current User.
$s2member_custom = get_user_field ("s2member_custom"); 
# Custom String value for the current User.
$s2member_subscr_id = get_user_field ("s2member_subscr_id"); 
# Paid Subscr. ID for the current User.
$s2member_subscr_or_wp_id = get_user_field ("s2member_subscr_or_wp_id"); 
# Paid Subscr. ID, else WordPress® User ID.
$s2member_subscr_gateway = get_user_field ("s2member_subscr_gateway"); 
# Paid Subscr. Gateway Code for the current User.
$s2member_registration_ip = get_user_field ("s2member_registration_ip"); 
# IP the current User had during registration.
$s2member_custom_fields = get_user_field ("s2member_custom_fields"); 
# Associative array of all Custom Registration/Profile Fields.
$s2member_file_download_access_log = get_user_field ("s2member_file_download_access_log"); 
# Associative array of all File Downloads by the current User, in the current Period ( Period is based on a specific User'sallowed_days, configured in your Basic Download Restrictions, at the User's current Membership Level ).
$s2member_file_download_access_arc = get_user_field ("s2member_file_download_access_arc"); 
# Associative array of all File Downloads by the current User, in previous Periods ( Periods are based on a specific User'sallowed_days, configured in your Basic Download Restrictions, at the User's Membership Levels in the past ).
$s2member_auto_eot_time = get_user_field ("s2member_auto_eot_time"); 
# Auto EOT-Time for the current User ( when applicable ).
$s2member_last_payment_time = get_user_field ("s2member_last_payment_time"); 
# Timestamp. Last time an actual payment was received by s2Member.
$s2member_paid_registration_times = get_user_field ("s2member_paid_registration_times"); # Timestamps. Associative array of all Paid Registration Times.
$s2member_access_role = get_user_field ("s2member_access_role"); 
# A WordPress® Role ID ( i.e. s2member_level[0-9]+, administrator, editor, author, contributor, subscriber ).
$s2member_access_level = get_user_field ("s2member_access_level"); 
# An s2Member Membership Access Level number.
$s2member_access_label = get_user_field ("s2member_access_label"); 
# An s2Member Membership Access Label ( i.e. Bronze, Gold, Silver, Platinum, or whatever is configured ).
$s2member_access_ccaps = get_user_field ("s2member_access_ccaps"); 
# An array of Custom Capabilities the current User has ( i.e. music,videos ).
$s2member_login_counter = get_user_field ("s2member_login_counter"); 
# Number of times the User has logged into your site.
?>

In the post or page use this to view

<?echo $user_login = get_user_field ("user_login"); ?>
# Username for the current User.
<?echo $user_email = get_user_field ("user_email");  ?>
# Email Address for the current User.
<?echo $first_name = get_user_field ("first_name");  ?>
# First Name for the current User.
<?echo $last_name = get_user_field ("last_name");  ?>
# Last Name for the current User.
<?echo $full_name = get_user_field ("full_name");  ?>
# First and Last Name for the current User.

Give it a try.

Christian

Posted: Thursday Apr 12th, 2012 at 12:25 pm #10670
Raam Dev
Username: Raam
Staff Member

Hi Angela,

Have you tried using a snippet of PHP instead of the shortcode to see if the problem only exists with shortcodes?

<?php echo S2MEMBER_CURRENT_USER_FIRST_NAME; ?>

(You’ll need to have the Exec-PHP Plugin installed for this to work inside pages/posts.)

Posted: Thursday Apr 12th, 2012 at 12:25 pm #10671
Raam Dev
Username: Raam
Staff Member

Hi Angela,

Have you tried using a snippet of PHP instead of the shortcode to see if the problem only exists with shortcodes?

<?php echo S2MEMBER_CURRENT_USER_FIRST_NAME; ?>

(You’ll need to have the Exec-PHP Plugin installed for this to work inside pages/posts.)

Viewing 3 replies - 1 through 3 (of 3 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.