Skip to:
Content

BuddyPress.org

Changeset 4628


Ignore:
Timestamp:
07/09/2011 06:58:45 PM (13 years ago)
Author:
boonebgorges
Message:

Introduces wrapper function bp_is_username_compatibility_mode() and refactors to avoid direct constant checks throughout BP. See #3314

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-filters.php

    r4611 r4628  
    123123
    124124    foreach( (array)$usernames as $username ) {
    125         if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
     125        if ( bp_is_username_compatibility_mode() )
    126126            $user_id = username_exists( $username );
    127127        else
  • trunk/bp-activity/bp-activity-functions.php

    r4621 r4628  
    7070    if ( $usernames = bp_activity_find_mentions( strip_tags( $activity->content ) ) ) {
    7171        foreach( (array)$usernames as $username ) {
    72             if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
     72            if ( bp_is_username_compatibility_mode() )
    7373                $user_id = username_exists( $username );
    7474            else
  • trunk/bp-activity/bp-activity-notifications.php

    r4605 r4628  
    2121
    2222    foreach( (array)$usernames as $username ) {
    23         if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
     23        if ( bp_is_username_compatibility_mode() )
    2424            $receiver_user_id = bp_core_get_userid( $username );
    2525        else
  • trunk/bp-core/bp-core-catchuri.php

    r4602 r4628  
    238238               
    239239                // Switch the displayed_user based on compatbility mode
    240                 if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
     240                if ( bp_is_username_compatibility_mode() )
    241241                    $bp->displayed_user->id = (int) bp_core_get_userid( urldecode( $bp_uri[$uri_offset + 1] ) );
    242242                else
  • trunk/bp-core/bp-core-functions.php

    r4602 r4628  
    12001200}
    12011201
     1202/**
     1203 * Are we running username compatibility mode?
     1204 *
     1205 * @package BuddyPress
     1206 * @since 1.3
     1207 *
     1208 * @uses apply_filters() Filter 'bp_is_username_compatibility_mode' to alter
     1209 * @return bool False when compatibility mode is disabled (default); true when enabled
     1210 */
     1211function bp_is_username_compatibility_mode() {
     1212    return apply_filters( 'bp_is_username_compatibility_mode', defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) && BP_ENABLE_USERNAME_COMPATIBILITY_MODE );
     1213}
    12021214
    12031215/** Global Manipulators *******************************************************/
  • trunk/bp-members/bp-members-functions.php

    r4605 r4628  
    105105        $username = bp_core_get_username( $user_id, $user_nicename, $user_login );
    106106
    107         if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
     107        if ( bp_is_username_compatibility_mode() )
    108108            $username = rawurlencode( $username );
    109109
     
    242242
    243243        // Pull an audible and use the login over the nicename
    244         if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
     244        if ( bp_is_username_compatibility_mode() )
    245245            $username = $user_login;
    246246        else
     
    459459 */
    460460function bp_core_get_userlink_by_username( $username ) {
    461     if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
     461    if ( bp_is_username_compatibility_mode() )
    462462        $user_id = bp_core_get_userid( $username );
    463463    else
  • trunk/bp-messages/bp-messages-functions.php

    r4623 r4628  
    6767
    6868            } else {
    69                 if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
     69                if ( bp_is_username_compatibility_mode() )
    7070                    $recipient_id = bp_core_get_userid( $recipient );
    7171                else
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r4611 r4628  
    658658                continue;
    659659
    660             if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
     660            if ( bp_is_username_compatibility_mode() )
    661661                $username = $ud->user_login;
    662662            else
Note: See TracChangeset for help on using the changeset viewer.