Admin Menu Editor
[resolved] Adding a link to current logged in Authors Page (7 posts)

  1. sheyes@s-heyes.com
    Posted 3 years ago #

    Hey! This is a default plugin for us. Totally awesome plugin!

    I do have one request.

    I would like to be able to create a top level menu item called "Your Author Page" for the currently logged in user.

    For example, Im a user logged in as sheyes, I could like the menu item to link to testsite.com/author/sheyes and if I was logged in a tjones it would be testsite.com/author/tjones

    Is this possible? or does someone know how it could be done???


  2. Janis Elsts
    Plugin Author

    Posted 3 years ago #

    This is not possible in the current version. A menu item always has the same URL for all users.

    However, it could be done with the Pro version if you're willing to add some custom code to your site. Here's how:

    1. Create a custom [current_user_login] shortcode that outputs the username of the currently logged-in user (see code below).
    2. The Pro version lets you use shortcodes in menu item settings. Set the menu URL to "http://testsite.com/author/[current_user_login]"
    3. Now the URL will be different for each user and include their login.

    Here's the snippet that creates the [current_user_login]shortcode. You can add it to your functions.php or similar:

    function current_user_login_shortcode($atts) {
        $user = wp_get_current_user();
        if ( empty($user) || !$user->exists() ) {
            return 'not_logged_in';
        return $user->user_login;
    add_shortcode('current_user_login', 'current_user_login_shortcode');
  3. sheyes@s-heyes.com
    Posted 3 years ago #

    This is why I love WordPress and the community that supports it!

    Don't you worry I have a Pro Version love it to bits!!

    Implemented your solution in under 2mins!

    Thanks a million.

  4. Mark080959
    Posted 3 years ago #

    I want to pass the ID of the actual user to the application in the frame. can i use this construction: url=www.xxx.xx/xxx?"ID=[shortcode]" ? Or is there a better method?

  5. Janis Elsts
    Plugin Author

    Posted 3 years ago #

    Yes, assuming that the application is designed to accept the ID as a query parameter, that would probably work.

  6. Mark080959
    Posted 3 years ago #

    It works!

  7. Mark080959
    Posted 3 years ago #

    and again, that is good news. a lot of plugins are desinged to let other applications work within wp. with this option this plugin a is kind of general method to let apllications work within wp.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.