Category Archives: API

Set Badge To User

set_badge_to_user($user_id, $badge_url, $badge_title)

This function let’s you assign badges to your users.

Options:

OPTIONS DEFAULT ALTERNATIVES
user_id any user is should passed as parameter none
badge_url a valid URL for your badge file empty
badge_title any valid text for the title of your bage cannot be empty

Example:

			
global $xoouserultra;
			

$user_id = 11;	//use your custom user id.
$badge_url = 'http://usersultra.com/uultra-testing/wp-content/plugins/users-ultra-pro/addons/badges/badges/trophy.png';
$badge_title = 'Pro Member';			
$xoouserultra->api->set_badge_to_user($user_id, $badge_url, $badge_title);
			

Set User Meta Data

set_custom_meta_info($user_id, $meta, $value)

This function let’s you update the user’s meta data.

Options:

OPTIONS DEFAULT ALTERNATIVES
user_id any user is should passed as parameter none
meta any valid user’s meta field empty
value any information you would like to set empty

Example:

			
global $xoouserultra;
			
/
$user_id = 11;	//use your custom user id.
			
$xoouserultra->api->set_custom_meta_info($user_id, 'description', "My custom description for this user goes here.");
			

Get User’s Rating

get_user_rating($user_id)

This function returns the user’s rating.

Options:

OPTIONS DEFAULT ALTERNATIVES
user_id any user is should passed as parameter none

Example:

			
global $xoouserultra;
			
//get user avatar
$user_id = get_current_user_id();	
			
$rating= $xoouserultra->api->get_user_rating($user_id);
			
echo $rating;

Get User

load_user($value, $method)

This function returns one user from the database.

Options:

OPTIONS DEFAULT ALTERNATIVES
value There is no default value. One value should be specified You should use an id or an email address or an username
method There is no default method. One method should be specified. id,email or login

Example:

global $xoouserultra;
			
//get user url
$user_id = get_current_user_id();				
$current_user = $xoouserultra->api->load_user($user_id, 'id' );
			
echo 'Username: ' . $current_user->user_login  ;
echo 'User email: ' . $current_user->user_email ;
echo 'User first name: ' . $current_user->user_firstname ;
echo 'User last name: ' . $current_user->user_lastname ;
echo 'User display name: ' . $current_user->display_name ;
echo 'User ID: ' . $current_user->ID ;

 

Get User’s Custom Field

get_user_field($user_id, $field)

This function returns a custom user’s meta field.

Options:

OPTIONS DEFAULT ALTERNATIVES
user_id User ID should be passed as parameter current or custom user id
field Custom meta field name. N/A

Example:

			
global $xoouserultra;
			
//get user url
$user_id = get_current_user_id();				
$user_description = $xoouserultra->api->get_user_field($user_id, 'description' );
			
echo $user_description;

Get User Badges

get_user_badges($user_id)

This function returns the user badges.

Options:

OPTIONS DEFAULT ALTERNATIVES
user_id User ID should be passed as parameter current or custom user id

Example:

			
global $xoouserultra;

$user_id = get_current_user_id();				
$badges = $xoouserultra->api->get_user_badges($user_id );
echo $badges;

Get User’s Profile Link

get_user_url($user_id)

This function returns the user’s profile url.

Options:

OPTIONS DEFAULT ALTERNATIVES
user_id User ID should be passed as parameter current or custom user id

Example:

			
global $xoouserultra;
			
//get user url
$user_id = get_current_user_id();				
$user_url = $xoouserultra->api->get_user_url($user_id );
			
echo $user_url;

Get User’s Avatar

get_user_avatar($user_id, $options)

This function returns the user’s avatar.

Options:

OPTIONS DEFAULT ALTERNATIVES
size 40  any size in pixels
pic_type avatar avatar, mainpicture
size_type fixed fixed, dynamic

Example:

			
global $xoouserultra;
			
//get user avatar
$user_id = get_current_user_id();	
			
$args = array('size' => '40', 'pic_type' => 'avatar' ,  'size_type' => 'fixed');
$avatar = $xoouserultra->api->get_user_avatar($user_id, $args );
			
echo $avatar;