User

Functions


// Retrieve all users
get_user();

// Retrieve user by id = 7
get_user(['id' => 7]);

mixed get_user ( $options = [] )
$options array
  • id (int/array) - user id
  • email (string/array) - user slug
  • order (string) - user order (by default id ASC)
  • group_by (string) - group by
  • limit (int) - user limit
  • offset (int) - offset
  • user_status (int/array) - user status
  • post_group_limit (int) - use when you need to retrieve a certain number of posts for each user
  • with (string/array) - relations (available relations: profile, post)
  • where (mixed) - additional condition, details
Returns array of User object collection or single User object.

// Retrieve user by email = 'admin@admin.com'
get_user_by(['email', 'admin@admin.com']);

mixed get_user_by ( $key, $value, $options = [] )
$key string
  • id - user id
  • email - user slug
  • author - user author
  • user_status - user status
$value mixed The value
$options array
  • id (int/array) - user id
  • email (string/array) - user slug
  • order (string) - user order (by default id ASC)
  • group_by (string) - group by
  • limit (int) - user limit
  • offset (int) - offset
  • user_status (int/array) - user status
  • post_group_limit (int) - use when you need to retrieve a certain number of posts for each user
  • with (string/array) - relations (available relations: profile, post)
  • where (mixed) - additional condition, details
Returns array of User object collection or single User object. On failure return an empty array and if value was the string or integer then returns null.

User Object

$id int User id
$username string User username
$email string User email
$role string User role
$status int User status
$auth_key string User auth key
$password_hash string User password hash
$password_reset_token string User password reset token
$created_at string User created date
$profile object User profile (relation)
$posts object collection Related posts (relation)

Profile Object

$user_id int User id
$name string User name
$surname string User surname
$language string User language
$avatar_url string User avatar link
$last_login_on string User last login date
$last_login_ip string User last login ip

Post Object

$id int Post id
$category_id int Post related category id
$status int Post status
$title string Post title
$slug string Post slug
$introtext string Post intro text
$fulltext string Post full text
$hits int Post view counter
$image string Post image
$post_type string Post type
$published_at string Post published date
$publish_up string Post published up date
$publish_down string Post published down date
$language string Post language
$view string Post view
$version int Post version (update counter)
$reference mixed Post reference
$created_by int Post author id
$created_at string Post created date
$modified_by int Post edited user id
$modified_at string Post edited date
$meta_title string Post meta title
$meta_keywords string Post meta keywords
$meta_description string Post meta description
$category object Category object (relation)
$author object User object (relation)