• Resolved [email protected]

    (@sheyess-heyescom)


    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???

    https://www.ads-software.com/extend/plugins/admin-menu-editor/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Janis Elsts

    (@whiteshadow)

    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 “https://testsite.com/author/%5Bcurrent_user_login%5D”
    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');
    Thread Starter [email protected]

    (@sheyess-heyescom)

    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.

    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?

    Plugin Author Janis Elsts

    (@whiteshadow)

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

    It works!

    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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Adding a link to current logged in Authors Page’ is closed to new replies.