Page tree
Skip to end of metadata
Go to start of metadata

Description


Api\User\Object user()


Using our user() function will give you access to the active users information using class properties.

Examples


<?php

// Prints the users ID
echo user()->id;

// Prints the users email
echo user()->email;

In case you want to get information from other user:

$user = (new \Api\User())->get(19);
echo $user->email;
//or
echo (new \Api\User())->get(19)->email;
//with 19 is user_id of other user.

 

Methods


PropertyTypeDescription

id

int

Unique user ID#.

urlstring

Permalink to users profile.

name

string

Full name.

 

emailstringEmail
name_linkstringHTML link to the users profile with wrapped around their name.
photoarray

An associative array of photos of the user.


Available sizes: 50px, 120px, 200px & original

Usage:

echo user()->photo['50px']
photo_linkstringHTML link to a users profile wrapped around their profile image.
locationarray

An associative array of a users location.


Available values: iso

Usage:

user()->location['iso']
genderarrayAn associative array of a users gender. 

Available values: id = Gender ID, name = Gender phrase

Usage:

user()->gender['name']
dobarrayAn associative array of a users date of birth.

Available values: day = Gender ID, month = Gender phrase, year = Year

Usage:

echo user()->dob['day'] . '/' . user()->dob['month'] . '/' . user()->dob['year'];
groupobject

An associative object of a users user group.


Available values: id = User Group ID

Usage:

echo user()->group->id;
  • No labels