WordPress.org

Ready to get started?Download WordPress

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. use [otheruserinfo field="fieldname" login="userlogin" uservar="userloginvariable"]some content[/otheruserinfo] and use login attribute if you want a fixed user login or uservar attribute if you need to dynamically supply user login via query string, where userloginvariable is the name of the query string variable such as: http://mysite.com/mypage/?userloginvariable=userlogin You may also search for a rewrite plugin to make things nice such as http://mysite.com/mypage/userloginvariable/userlogin

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

[otheruserinfo field="user_firstname" uservar="theuserlogin"] will display the user_firstname for the user specified via query string, in the theuserlogin variable

[otheruserinfo field="user_firstname" login="admin"] will display the user firstname for the user specified in the login attribute

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.6.1
Last Updated: 2013-10-16
Downloads: 7,272

Ratings

5 stars
5 out of 5 stars

Support

0 of 1 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
100,1,1
100,1,1
100,1,1
0,1,0