User objects quick guide

From Dreamwidth Notes
Revision as of 22:40, 21 August 2012 by Foxfirefey (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The user object is one of the main components of the LJ code. Here is a quick tour of some commonly used functions.

Get an account

Most useful function for this:

 LJ::load_user_or_identity

This will get the user object for a user OR for an OpenID identity URL.

Find out what kind of account it is

$u->is_community
$u->is_personal
$u->is_syndicated
$u->is_identity

Managing WTF relationships

Managing watch/trust/friend relationships: see WTF Backend.

Community functions

Getting members:

$u->member_userids

Display the account

This gives the HTML to render the username complete with the little profile icon:

$u->ljuser_display