Skip to:
Content

bbPress.org


Ignore:
Timestamp:
12/31/2012 01:21:33 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Nicename Usage:

  • Introduce template tags for getting and displaying a user nicenames. Helpful for themes that want easier access to @mentions data.
  • Improve mention filters to use 'slug' instead of 'login.' Fixes possible mismatches when login and nicename are different.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/core/functions.php

    r4579 r4672  
    282282}
    283283
     284/** Mentions ******************************************************************/
     285
    284286/**
    285287 * Searches through the content to locate usernames, designated by an @ sign.
     
    321323
    322324        // Skip if username does not exist or user is not active
    323         $user_id = username_exists( $username );
    324         if ( empty( $user_id ) || bbp_is_user_inactive( $user_id ) )
     325        $user = get_user_by( 'slug', $username );
     326        if ( empty( $user->ID ) || bbp_is_user_inactive( $user->ID ) )
    325327            continue;
    326328
    327329        // Replace name in content
    328         $content = preg_replace( '/(@' . $username . '\b)/', "<a href='" . bbp_get_user_profile_url( $user_id ) . "' rel='nofollow' class='bbp-mention-link $username'>@$username</a>", $content );
     330        $content = preg_replace( '/(@' . $username . '\b)/', "<a href='" . bbp_get_user_profile_url( $user->ID ) . "' rel='nofollow' class='bbp-mention-link {$username}'>@{$username}</a>", $content );
    329331    }
    330332
Note: See TracChangeset for help on using the changeset viewer.