Skip to:
Content
Pages
Categories
Search
Top
Bottom

short tags > display user’s username is posts/pages

  • Avatar of Usergnome
    usergnome
    Member

    @usergnome

    Hi, I’ve created a short tag that I have added to buddypress-home/functions.php

    The function should enable me to add the shortcode [uname] in posts and pages and display the current user’s username. Unfortunately it doesn’t bloody work! Can anyone point me in the right direction?

    function displayusername() {
    global $current_user;
    return($current_user->user_login);
    }
    add_shortcode('uname', 'displayusername');

You must be logged in to reply to this topic.