includesum-short-functions.php

Functions

um_trim_string()

um_trim_string( $s, int  $length = 20) : string

Trim string by char length

Parameters

$s
int $length

Returns

string

um_dynamic_login_page_redirect()

um_dynamic_login_page_redirect(string  $redirect_to = '') : bool|mixed|string|void

Get where user should be headed after logging

Parameters

string $redirect_to

Returns

bool|mixed|string|void

um_is_session_started()

um_is_session_started() : bool

Checks if session has been started

Returns

bool

um_clean_user_basename()

um_clean_user_basename( $value) : mixed|void

User clean basename

Parameters

$value

Returns

mixed|void

um_replace_placeholders()

um_replace_placeholders() : array

Getting replace placeholders array

Returns

array

um_convert_tags()

um_convert_tags( $content, array  $args = array(), bool  $with_kses = true) : mixed|string

Convert template tags

Parameters

$content
array $args
bool $with_kses

Returns

mixed|string

account_activation_link_tags_patterns()

account_activation_link_tags_patterns( $placeholders) : array

UM Placeholders for activation link in email

Parameters

$placeholders

Returns

array

account_activation_link_tags_replaces()

account_activation_link_tags_replaces( $replace_placeholders) : array

UM Replace Placeholders for activation link in email

Parameters

$replace_placeholders

Returns

array

um_user_ip()

um_user_ip() : string

Returns

string —

The user's IP address.

Examples

The example below can retrieve the user's IP address <?php $user_ip = um_user_ip(); echo 'User IP address is: ' . $user_ip; // prints the user IP address e.g. 127.0.0.1 ?>

                                                

um_field_conditions_are_met()

um_field_conditions_are_met( $data) : bool

If conditions are met return true;

Parameters

$data

Returns

bool

um_redirect_home()

um_redirect_home(string  $requested_user_id = '', string  $is_my_profile = '') : mixed

Exit and redirect to home

Parameters

string $requested_user_id
string $is_my_profile

Returns

mixed

um_js_redirect()

um_js_redirect( $url) : mixed

Parameters

$url

Returns

mixed

um_get_snippet()

um_get_snippet( $str, int  $wordCount = 10) : string

Get limit of words from sentence

Parameters

$str
int $wordCount

Returns

string

um_user_submitted_registration_formatted()

um_user_submitted_registration_formatted(bool  $style = false) : string

Format submitted data for Info preview & Email template

Parameters

bool $style

Returns

string

um_user_submited_display()

um_user_submited_display(string  $k, string  $title, array  $data = array(), bool  $style = true) : string

Prepare template

Parameters

string $k
string $title
array $data
bool $style

Returns

string

um_filtered_social_link()

um_filtered_social_link(string  $key, null|string  $match = null) : string

Show filtered social link

Parameters

string $key
null|string $match

Returns

string

um_filtered_value()

um_filtered_value( $key, bool  $data = false) : mixed|string|void

Get filtered meta value after applying hooks

Parameters

$key
bool $data

Returns

mixed|string|void

um_profile_id()

um_profile_id() : int

Returns requested User ID or current User ID

Returns

int

um_is_temp_upload()

um_is_temp_upload(string  $url) : bool|string

Check that temp upload is valid

Parameters

string $url

Returns

bool|string

um_is_temp_image()

um_is_temp_image( $url) : bool|string

Check that temp image is valid

Parameters

$url

Returns

bool|string

um_is_file_owner()

um_is_file_owner(string  $url, int|null  $user_id = null, string|bool  $image_path = false) : bool

Check user's file ownership

Parameters

string $url
int|null $user_id
string|bool $image_path

Returns

bool

um_is_temp_file()

um_is_temp_file(string  $filename) : bool

Check if file is temporary

Parameters

string $filename

Returns

bool

um_user_last_login_timestamp()

um_user_last_login_timestamp(int  $user_id) : int|string

Get user's last login timestamp

Parameters

int $user_id

Returns

int|string

um_user_last_login()

um_user_last_login(int  $user_id) : string

Get user's last login (time diff)

Parameters

int $user_id

Returns

string

um_get_core_page()

um_get_core_page( $slug, bool  $updated = false) : bool|mixed|string|void

Get core page url

Parameters

$slug
bool $updated

Returns

bool|mixed|string|void

um_is_core_page()

um_is_core_page(string  $page) : bool

Check if we are on a UM Core Page or not

Default um core pages slugs 'user', 'login', 'register', 'members', 'logout', 'account', 'password-reset'

Parameters

string $page

UM core page slug

Returns

bool

um_is_core_post()

um_is_core_post( $post,  $core_page) : bool

Parameters

$post
$core_page

Returns

bool

um_styling_defaults()

um_styling_defaults( $mode) : array

Get styling defaults

Parameters

$mode

Returns

array

um_get_metadefault()

um_get_metadefault( $id) : string

Get meta option default

Parameters

$id

Returns

string

um_submitting_account_page()

um_submitting_account_page() : bool

boolean for account page editing

Returns

bool

um_get_display_name()

um_get_display_name( $user_id) : string

Get a user's display name

Parameters

$user_id

Returns

string

um_reset_user_clean()

um_reset_user_clean() : mixed

Clears the user data. You need to fetch a user manually after using this function.

Returns

mixed

Examples

You can reset user data by using the following line in your code <?php um_reset_user_clean(); ?>

                                                

um_reset_user()

um_reset_user() : mixed

Clears the user data. If a user is logged in, the user data will be reset to that user's data

Returns

mixed

Examples

You can reset user data by using the following line in your code <?php um_reset_user(); ?>

                                                

um_queried_user()

um_queried_user() : mixed

Gets the queried user

Returns

mixed

um_set_requested_user()

um_set_requested_user( $user_id) : mixed

Sets the requested user

Parameters

$user_id

Returns

mixed

um_get_requested_user()

um_get_requested_user() : bool|null

Gets the requested user

Returns

bool|null

um_edit_my_profile_cancel_uri()

um_edit_my_profile_cancel_uri(string  $url = '') : mixed|string|void

Remove edit profile args from url

Parameters

string $url

Returns

mixed|string|void

um_is_on_edit_profile()

um_is_on_edit_profile() : bool

boolean for profile edit page

Returns

bool

um_can_view_field()

um_can_view_field( $data) : bool

Can view field

Parameters

$data

Returns

bool

um_can_view_profile()

um_can_view_profile(int  $user_id) : bool

Checks if user can view profile

Parameters

int $user_id

Returns

bool

um_is_user_himself()

um_is_user_himself() : bool

boolean check for not same user

Returns

bool

um_can_edit_field()

um_can_edit_field( $data) : bool

Can edit field

Parameters

$data

Returns

bool

um_is_myprofile()

um_is_myprofile() : bool

Check if user is in his profile

Returns

bool

um_edit_profile_url()

um_edit_profile_url(int  $user_id = null) : string

Returns the edit profile link

Parameters

int $user_id

Returns

string

um_can_edit_my_profile()

um_can_edit_my_profile() : bool

Checks if user can edit his profile

Returns

bool

um_admin_email()

um_admin_email() : mixed|string|void

Short for admin email

Returns

mixed|string|void

um_multi_admin_email()

um_multi_admin_email() : array

Get admin emails

Returns

array

um_user_profile_url()

um_user_profile_url(int|bool  $user_id = false) : bool|string

Display a link to profile page

Parameters

int|bool $user_id

Returns

bool|string

um_get_roles()

um_get_roles() : array

Get all UM roles in array

Returns

array

um_fetch_user()

um_fetch_user( $user_id) : mixed

Sets a specific user and prepares profile data and user permissions and makes them accessible.

Parameters

$user_id

(required) A user ID is required. This is the user's ID that you wish to set/retrieve

Returns

mixed

Examples

The example below will set user ID 5 prior to retrieving his profile information. <?php um_fetch_user(5); echo um_user('display_name'); // returns the display name of user ID 5 ?>

                                            
In the following example you can fetch the profile of a logged-in user dynamically. <?php um_fetch_user( get_current_user_id() ); echo um_user('display_name'); // returns the display name of logged-in user ?>

                                                

um_profile()

um_profile( $key) : bool|string

Load profile key

Parameters

$key

Returns

bool|string

um_youtube_id_from_url()

um_youtube_id_from_url(string  $url) : bool|string

Get YouTube video ID from URL.

Parameters

string $url

Returns

bool|string

um_closest_num()

um_closest_num( $array,  $number) : mixed

Find closest number in an array

Parameters

$array
$number

Returns

mixed

um_get_cover_uri()

um_get_cover_uri( $image,  $attrs) : bool|string

get cover uri

Parameters

$image
$attrs

Returns

bool|string

um_get_avatar_url()

um_get_avatar_url( $get_avatar) : mixed

get avatar URL instead of image

Parameters

$get_avatar

Returns

mixed

um_get_avatar_uri()

um_get_avatar_uri( $image, string|array  $attrs) : bool|string

get avatar uri

Parameters

$image
string|array $attrs

Returns

bool|string

um_get_default_avatar_uri()

um_get_default_avatar_uri() : string

Default avatar URL

Returns

string

um_get_user_avatar_data()

um_get_user_avatar_data( $user_id = '',  $size = '96') : bool|string

get user avatar url

Parameters

$user_id
$size

Returns

bool|string

um_get_user_avatar_url()

um_get_user_avatar_url( $user_id = '',  $size = '96') : bool|string

get user avatar url

Parameters

$user_id
$size

Returns

bool|string

um_get_default_cover_uri()

um_get_default_cover_uri() : mixed|string|void

default cover

Returns

mixed|string|void

um_user()

um_user( $data, null  $attrs = null) : int|string|array

Parameters

$data
null $attrs

Returns

int|string|array

um_get_domain_protocol()

um_get_domain_protocol() : string

Get server protocol

Returns

string

um_secure_media_uri()

um_secure_media_uri(string  $url) : string

Set SSL to media URI

Parameters

string $url

Returns

string

um_force_utf8_string()

um_force_utf8_string(mixed  $value) : mixed

Force strings to UTF-8 encoded

Parameters

mixed $value

Returns

mixed

um_get_host()

um_get_host() : mixed

Get user host

Returns the webhost this site is using if possible

Returns

mixed —

string $host if detected, false otherwise

um_let_to_num()

um_let_to_num(string  $v) : int|string

Let To Num

Does Size Conversions

Parameters

string $v

Returns

int|string

is_ultimatemember()

is_ultimatemember() : bool

Check if we are on UM page

Returns

bool

um_maybe_unset_time_limit()

um_maybe_unset_time_limit() : mixed

Maybe set empty time limit

Returns

mixed

um_is_profile_owner()

um_is_profile_owner( $user_id = false) : bool

Parameters

$user_id

Returns

bool

um_is_amp()

um_is_amp(bool  $check_theme_support = true) : bool

Check whether the current page is in AMP mode or not.

We need to check for specific functions, as there is no special AMP header.

Parameters

bool $check_theme_support

Whether theme support should be checked. Defaults to true.

Returns

bool

um_safe_redirect()

um_safe_redirect(string  $url) : mixed

UM safe redirect. By default, you can be redirected only to WordPress installation Home URL. Fallback URL is wp-admin URL.

But it can be changed through filters and extended by UM Setting "Allowed hosts for safe redirect (one host per line)" and filter um_wp_safe_redirect_fallback.

Parameters

string $url

redirect URL.

Returns

mixed

um_allowed_redirect_hosts()

um_allowed_redirect_hosts(array  $hosts) : array

UM allowed hosts

Parameters

array $hosts

Allowed hosts.

Returns

array

um_wp_safe_redirect_fallback()

um_wp_safe_redirect_fallback(string  $url, string  $status) : string

UM fallback redirect URL

Parameters

string $url

Fallback URL.

string $status

Redirect status.

Returns

string