Skip to:
Content

BuddyPress.org

Ticket #229: bp_core_adminbar.php.adminlogoutcombo.patch

File bp_core_adminbar.php.adminlogoutcombo.patch, 1.4 KB (added by burtadsit, 16 years ago)

Patch to fix adminbar role probs with site admin and also includes the logout fix

  • bp-core-adminbar.php

     
    7575       
    7676                $alt = ( $counter % 2 == 0 ) ? ' class="alt"' : '';
    7777       
    78                 echo '<li' . $alt . '><a id="logout" href="' . site_url() . '/wp-login.php?action=logout">' . __('Log Out', 'buddypress') . '</a></li>';
     78                if ( function_exists('wp_logout_url') ) {
     79                        echo '<li' . $alt . '><a id="logout" href="' . wp_logout_url(site_url()) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';                 
     80                } else {
     81                        echo '<li' . $alt . '><a id="logout" href="' . site_url() . '/wp-login.php?action=logout&amp;redirect_to=' . site_url() . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';
     82                }
     83
    7984                echo '</ul>';
    8085                echo '</li>';
    8186        }
     
    8388
    8489// return a string indicating user's role in that blog
    8590function get_blog_role_for_user( $user, $blog ) {
     91        if (is_site_admin() ) return __( 'Admin', 'buddypress'); // roles get confused with site admin
     92       
    8693        $roles = get_usermeta( $user, 'wp_' . $blog . '_capabilities' );
    8794
    8895        if ( isset( $roles['subscriber'] ) )
     
    96103        elseif ( isset( $roles['administrator'] ) )
    97104                $role = __( 'Admin', 'buddypress' );
    98105        else
    99                 return false;
     106                $role = ""; // we wouldn't be checking if there wasn't a user rec on this blog but ...
    100107       
    101108        return $role;
    102109}