Joomla User Shortcode [user], [usercontent]

 

Feb
13

1


The user shortcode displays content based on information about the current user.

You can use this to show the users their name, for example “Hi! Name”, username, or registered date.
You can also provide content based on whether the user is registered and logged in or not. This is perfect for providing teaser text for membership sites.
Task: Print the uses name, or “Anonymous” if it isn’t available:
[user echo=”name” default=”Anonymous”] [user echo=”username” default=”Unregistered”] [user echo=”registerDate”]

Task: To display content:
[usercontent loggedin=”true” default=”Please reigster!”] This text is displayed only to LOGGED IN users! The words “Please Reigister” are displayed to users who are not logged in.
[/usercontent]

OR

[usercontent loggedin=”false”] This text is displayed only to Anonymous (not logged in visitors). Users who are logged in see nothing.
[/usercontent]

Output is:
Anonymous
Unregistered
To display content:
Please reigster!
This text is displayed only to Anonymous (not logged in visitors). Users who are logged in see nothing.

How to get the Shortcode:

1.) Get the Joomla Shortcode Pack from the Extension Web Store
2.) Using the Joomla! extension Manager, install and activate the
3.) Install and activate the shortcode_user.zip plugin
4.) Add the text above to any article to trigger the shortcode. Modify to your liking.

One Response to “Joomla User Shortcode [user], [usercontent]”

  • Ian Phillips says:

    June 9, 2012 at 3:08 AM

    usercontent – have fiddled for a while, and think the test that is being applied is whether the user is a ‘registered’ user, rather than whether they are logged in (ie fails on ‘Special’). What would make it more useful if the test that was applied was for an acl group; ie could be more targeted and specific then – with eg shortcode like this: [usercontent loggedin=”true” acl=”rosters” default=”Please reigster!”]