WordPress.org

Support

Support » Plugins and Hacks » Hacks » [Resolved] Admin Bar Modification

[Resolved] Admin Bar Modification

  • I want to edit the my-account in admin-bar.php, because I hided the back-end from the users, but the href in my-account is :
    ‘href’ => $profile_url,

    I want to make it link to http://site.com/author/USERNAME , where USERNAME is the username of the logged in user.
    So , what would the href become ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • come on I dont think my question is that complicated, cant anyone help me ?

    Keep in mind I have no idea what I am doing… this returns the url that you want:

    $current_user = wp_get_current_user();
    $current_name = $current_user->user_login;
    $url = site_url('/author/');
    
    echo $url . $current_name;

    So after adding all but the last line of that to define the two partsabove the ‘href’ I think you could then say:

    'href' => $url . $current_name;

    or one more step (probably unnecessary)

    $current_user = wp_get_current_user();
    $current_name = $current_user->user_login;
    $url = site_url('/author/');
    $new_url = $url . $current_name;
    
    'href' =>$new_url;

    I am sure someone else probably knows a better way but at least this should get you going in the right direction.

    thanks alot man, it works.
    THANK YOU

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Admin Bar Modification’ is closed to new replies.