Forums

[resolved] Changing "Site Admin" link (3 posts)

  1. Monkeyboy
    Member
    Posted 1 year ago #

    When a subscriber logs in, a "Site Admin" link is displayed, so that they can amend their profile.

    Whilst I think a "Site Admin" link makes sense if you're the Administrator, it seems wrong somehow if you're a subscriber, or indeed anything below an Admin.

    Instead of reading...

    Site Admin | Log Out

    I think...

    Profile | Log Out

    would make more sense. Any way of doing this?

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    try to add this code to functions.php of your theme:

    add_filter('register','adapt_site_admin_link');
    function adapt_site_admin_link($link) {
    global $current_user;
    get_currentuserinfo();
    $user_roles = $current_user->roles;
    $user_role = array_shift($user_roles);
    if($user_role == 'administrator') $link = str_replace('Site Admin','Site Admin',$link);
    elseif($user_role == 'editor') $link = str_replace('Site Admin','Editor Admin',$link);
    elseif($user_role == 'author') $link = str_replace('Site Admin','Author Admin',$link);
    elseif($user_role == 'contributor') $link = str_replace('Site Admin','Contributor Admin',$link);
    elseif($user_role == 'subscriber') $link = str_replace('Site Admin','Profile',$link);
    return $link;
    }
  3. Monkeyboy
    Member
    Posted 1 year ago #

    Excellent stuff. That worked.

    :-)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags