scottdavis (@scottdavis)

Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • @scottdavis

    Member

    Solution to the Display Name bug here

    @scottdavis

    Member

    Tracked down the problem in Use Display Name. Basically, it’s a bit overzealous in replacing the user name with the display name throughout the code… including for a function that’s used to check for capabilities. Since the name doesn’t match, the capability check fails.

    Quick partial fix: comment out the following line in display-name.php:

    // add_filter( ‘get_user_name’, ‘bb_use_display_name’, 1, 2 );

    The Display Name will now be used instead of the User Name in some places, but not in others.

    A more complete fix:

    1. In display-name.php, replace:

    add_filter( ‘get_user_name’, ‘bb_use_display_name’, 1, 2 );

    WITH

    add_filter( ‘get_display_name’, ‘bb_use_display_name’, 1, 2 );

    2. In template-functions.php, add the following function:

    function get_display_name( $id = 0 ) {

    $user = bb_get_user( bb_get_user_id( $id ) );

    return apply_filters( ‘get_display_name’, $user->user_login, $user->ID );

    }

    3. In template-functions.php, find function bb_get_title(), replace the call to get_user_name() with get_display_name()

    4. In template-functions.php, find function get_full_user_link(), replace both calls to get_user_name() with get_display_name()

    5. In profile.php, replace the call to get_user_name() with get_display_name()

    Enjoy :-)

    — scott

Viewing 2 replies - 1 through 2 (of 2 total)