Plugin Directory

User meta shortcodes

Use user meta as shortcode in post content without editing your theme files.

USAGE:

use [userinfo field="fieldname"]some content[/userinfo] or [authorinfo field="fieldname"]some content[/authorinfo] shortcodes in your post content to show the "fieldname" meta value from the user-meta for the current logged-in user or for the post author without editing your theme files.

EXAMPLES:

[userinfo field="last_name"]{{empty}}[/userinfo]

returns the last name of the current logged-in user. If no user is logged in then the value is empty string

[userinfo field="user_login" if="admin"]You are the admin[/userinfo]

this shortcode tests the field against the value and if true it displays the included content

[userinfo field="user_login"] is your username and you are reading a post by [authorinfo field="user_login"]{{empty}}[/authorinfo].[/userinfo]

this will display the username followed with the processed content. Note: never use the nested shortcode same as the enclosing shortcode. This will produce unexpected results!

[userinfo nospan="true"] should eliminate the surrounding span tag so the output can be used inside URLs or similar applications

[userinfo field="avatar" size="50"] will display the logged-in user's avatar with the size of 50px. The display depends of theme's css class 'avatar'

List of some of the available meta field names: ID, user_login, user_pass, user_nicename, user_email, user_url, user_registered, display_name, first_name, last_name,nickname, description, user_level, admin_color (Theme of your admin page. Default is fresh.), closedpostboxes_page, nickname, primary_blog, rich_editing, source_domain

[authorinfo field="last_name"]

returns the last name of the current post/page author.

[authorinfo field="ID"]

returns the user ID of the current post/page author.

[authorinfo field="avatar" size="50"] will display the post author's avatar with the size of 50px. The display depends of theme's css class 'avatar'

[authorinfo field="posts"] will display the author's posts link

List of some of the available meta field names: user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_activation_key, user_status, display_name,nickname, first_name, last_name, description, jabber, aim, yim, user_level, user_firstname, user_lastname, user_description, rich_editing, comment_shortcuts, admin_color,plugins_per_page, plugins_last_view, ID

If you add custom user meta via additional plugins, then the meta should be available for the above shortcodes

Requires: 2.7 or higher
Compatible up to: 3.5.1
Last Updated: 2013-1-20
Downloads: 3,569

Ratings

5 stars
5 out of 5 stars

Support

0 of 2 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1
100,1,1 100,1,1 0,3,0 0,1,0
0,1,0
0,2,0
100,1,1
100,1,1
100,1,1