S2 Cookbook: Users

From Dreamwidth Notes
Revision as of 07:45, 2 March 2013 by Foxfirefey (Talk | contribs)

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

Classes that represent users are UserLite and User.

Creating a UserLite object from a username

Get the User object of the journal being viewed

Viewer information

All of the below functions return True or False.

Is the viewer logged in

Returns true if the user viewing the page is logged in. It's recommended that your page links to the site login page if the user isn't logged in.

viewer_logged_in()

Does the viewer subscribe

Returns true if the user viewing the page is logged in and can search that journal.

viewer_is_subscribed()

Does the viewer have access

Returns true if the user viewing the page is logged in and has access to the journal being viewed. In communities, returns true if the viewer is a member of the community.

viewer_has_access()

Can the viewer search the journal

Returns true if the user viewing the page is logged in and can search that journal.

viewer_can_search() 

Does the viewer see the control strip

Returns true if reader will see the built in control strip.

viewer_sees_control_strip()

Is the viewer a member of the community

Returns true if the user viewing the page is both logged in, and is a member of the community being viewed. Always returns false for personal journals, since they cannot have members.

viewer_is_member()

Is the viewer a maintainer of the community

Returns true if the user viewing a community is logged in and a maintainer of the community.

viewer_is_moderator()

Is the viewer an administrator of the community

Returns true if the user viewing a community is logged in and is an admin of the community.

viewer_is_admin() 

Does the viewer own the content being viewed

Returns true if the user viewing the page is both logged in, and is the owner of the content in question. Useful for returning links to manage information, or edit entries.

viewer_is_owner()

Can the viewer manage tags

Returns true if the user viewing the page can add, edit, and delete tags on the journal being viewed.

viewer_can_manage_tags()