Viewing 1 replies (of 1 total)
  • Hi @amerlin,

    Greetings and thanks for your question!

    Membership doesn’t currently provide a shortcode to display usernames. The shortcodes it provides are on an access level basis and accessible at Membership > Members in the shortcodes column.

    You could use a plugin like the following to display user info though:
    http://ww.wp.xz.cn/plugins/user-meta-shortcodes/

    Or you could use code like so:

    // shortcode to display user's first name via [firstname_shortcode]
    function firstname_shortcode( $atts ){
    	$current_user = wp_get_current_user();
    	if ( !($current_user instanceof WP_User) )
    		return;
    	return $current_user->user_firstname;
    }
    add_shortcode( 'firstname_shortcode', 'firstname_shortcode' );

    That could be added to your theme’s functions.php or using a plugin:
    http://ww.wp.xz.cn/plugins/code-snippets/

    Would that work for you?

    Cheers,
    David

Viewing 1 replies (of 1 total)

The topic ‘ShortCode’ is closed to new replies.