Home  ›  Plugin API  ›  Profile API

Profile API

Simple:Press makes member profile data available through a simple function call that returns an array. This array is described below.
To use the Profile API, you will need to know the WordPress User ID of the member being interrogated.

Loading The Profile Array

The following code will first determine the current user’s ID and will then create an array of that user’s profile data:

global $current_user;
$userid = $current_user->ID;
$profile = array();
$profile = sfc_get_profile_data( $userid );

Using The Profile Data

The table below describes the available array elements and their contents. To display a value and assuming the variable names above, the following code fragment shows the syntax required:

echo $profile['display_name'];
if( isset( $profile['location'] )) echo $profile['location'];
Note that not all elements may be filled with data. In the above example, the member may not have supplied their location so the element may not exist. it is advised to use the isset() function which, if true, indicates the target element contains data.

The following table describes the available profile data elements:

Element NameData Description
IDThe member's Wordpress User ID
user_loginThe login name of the member
display_nameThe member's display name used in all Simple_Press dispays
user_emailThe member's email address
user_urlThe member's website address if recorded
user_registeredA php datetime stamp of the original registration date of member
descriptionA short, biographical note supplied by the member
signatureThe text component of the members signature
sigimageURL to the member's signature image
locationThe member's location
first_nameThe member's first given name
last_nameThe member's surname
photosAn array of the member's profile photograph URLs
pmSet to true (1) if this member can use the Private message system
moderatorSet to true (1) if this member is a moderator
avatarAn array containing the member's avatar information - 'uploaded' contains the name of an uploaded avatar
postsHow many forum posts a member has made
feedkeyThe member's RSS Feed Key string
aimMember's aim ID
yahooMember's yahoo ID
jabberMember's jabber-google ID
icqMember's icq ID
msnMember's msn ID
skypeMember's skype ID
facebookMember's facebook ID
myspaceMembers myspace ID
twitterMembers twitter ID
If you have defined any custom profile fields, they will also be available in this array and the element names will be the same as the ‘Data Item’ column found at Forum ☛ Profiles ☛ Profile Data


Article written by steve on January 24, 2010 and last modified by steve on February 27, 2010