Difference between revisions of "S2 Cookbook: Users"
Foxfirefey (Talk | contribs) (Created page with 'Classes that represent users are [http://www.dreamwidth.org/customize/advanced/layerbrowse?id=core2#class.UserLite UserLite] and [http://www.dreamwidth.org/customize/advanced/lay…') |
Foxfirefey (Talk | contribs) (add in basic viewer helper functions) |
||
Line 6: | Line 6: | ||
== Viewer information == | == Viewer information == | ||
+ | |||
+ | All of the below functions return True or False. | ||
=== Is the viewer logged in === | === 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 === | === 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 === | === 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 === | === 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 === | === 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 === | === Is the viewer a member of the community === | ||
− | === Is the viewer a | + | 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 === | === 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() | ||
[[Category: S2 Cookbook]] | [[Category: S2 Cookbook]] |
Latest revision as of 07:45, 2 March 2013
Classes that represent users are UserLite and User.
Contents
- 1 Creating a UserLite object from a username
- 2 Get the User object of the journal being viewed
- 3 Viewer information
- 3.1 Is the viewer logged in
- 3.2 Does the viewer subscribe
- 3.3 Does the viewer have access
- 3.4 Can the viewer search the journal
- 3.5 Does the viewer see the control strip
- 3.6 Is the viewer a member of the community
- 3.7 Is the viewer a maintainer of the community
- 3.8 Is the viewer an administrator of the community
- 3.9 Does the viewer own the content being viewed
- 3.10 Can the viewer manage tags
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()