Difference between revisions of "User objects quick guide"
From Dreamwidth Notes
Foxfirefey (Talk | contribs) (Created page with 'The user object is one of the main components of the LJ code. Here is a quick tour of some commonly used functions. == Find out what kind of account it is == <source lang="per...') |
Foxfirefey (Talk | contribs) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
The user object is one of the main components of the LJ code. Here is a quick tour of some commonly used functions. | 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 == | == Find out what kind of account it is == | ||
Line 17: | Line 25: | ||
<source lang="perl">$u->member_userids</source> | <source lang="perl">$u->member_userids</source> | ||
+ | |||
+ | == Display the account == | ||
+ | |||
+ | This gives the HTML to render the username complete with the little profile icon: | ||
+ | |||
+ | <source lang="perl">$u->ljuser_display</source> | ||
[[Category: Development]] | [[Category: Development]] |
Latest revision as of 22:40, 21 August 2012
The user object is one of the main components of the LJ code. Here is a quick tour of some commonly used functions.
Contents
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