Skip to:
Content

bbPress.org


Ignore:
Timestamp:
07/09/2014 10:59:31 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Bracketize users component.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/users/template.php

    r5369 r5436  
    216216
    217217                $user = bbp_get_current_user_id();
    218                 if ( empty( $user ) )
     218                if ( empty( $user ) ) {
    219219                        $user = bbp_get_current_anonymous_user_data( 'email' );
     220                }
    220221
    221222                $avatar = get_avatar( $user, $size );
     
    252253                // Validate user id
    253254                $user_id = bbp_get_user_id( $user_id );
    254                 if ( empty( $user_id ) )
     255                if ( empty( $user_id ) ) {
    255256                        return false;
     257                }
    256258
    257259                $user      = get_userdata( $user_id );
     
    285287                // Bail if no user ID passed
    286288                $user_id = bbp_get_user_id( $user_id );
    287                 if ( empty( $user_id ) )
     289                if ( empty( $user_id ) ) {
    288290                        return false;
     291                }
    289292
    290293                // Parse default arguments
     
    346349                // Use displayed user ID if there is one, and one isn't requested
    347350                $user_id = bbp_get_user_id( $user_id );
    348                 if ( empty( $user_id ) )
     351                if ( empty( $user_id ) ) {
    349352                        return false;
     353                }
    350354
    351355                // Allow early overriding of the profile URL to cut down on processing
    352356                $early_profile_url = apply_filters( 'bbp_pre_get_user_profile_url', (int) $user_id );
    353                 if ( is_string( $early_profile_url ) )
     357                if ( is_string( $early_profile_url ) ) {
    354358                        return $early_profile_url;
     359                }
    355360
    356361                // Pretty permalinks
     
    402407                // Validate user id
    403408                $user_id = bbp_get_user_id( $user_id );
    404                 if ( empty( $user_id ) )
     409                if ( empty( $user_id ) ) {
    405410                        return false;
     411                }
    406412
    407413                $user      = get_userdata( $user_id );
     
    443449                $bbp     = bbpress();
    444450                $user_id = bbp_get_user_id( $user_id );
    445                 if ( empty( $user_id ) )
     451                if ( empty( $user_id ) ) {
    446452                        return false;
     453                }
    447454
    448455                // Pretty permalinks
     
    547554         */
    548555        function bbp_get_admin_link( $args = '' ) {
    549                 if ( !current_user_can( 'moderate' ) )
     556                if ( !current_user_can( 'moderate' ) ) {
    550557                        return;
    551 
    552                 if ( !empty( $args ) && is_string( $args ) && ( false === strpos( $args, '=' ) ) )
     558                }
     559
     560                if ( !empty( $args ) && is_string( $args ) && ( false === strpos( $args, '=' ) ) ) {
    553561                        $args = array( 'text' => $args );
     562                }
    554563
    555564                // Parse arguments against default values
     
    811820                // Use displayed user ID if there is one, and one isn't requested
    812821                $user_id = bbp_get_user_id( $user_id );
    813                 if ( empty( $user_id ) )
     822                if ( empty( $user_id ) ) {
    814823                        return false;
     824                }
    815825
    816826                // Allow early overriding of the profile URL to cut down on processing
    817827                $early_profile_url = apply_filters( 'bbp_pre_get_favorites_permalink', (int) $user_id );
    818                 if ( is_string( $early_profile_url ) )
     828                if ( is_string( $early_profile_url ) ) {
    819829                        return $early_profile_url;
     830                }
    820831
    821832                // Pretty permalinks
     
    974985                // Use displayed user ID if there is one, and one isn't requested
    975986                $user_id = bbp_get_user_id( $user_id );
    976                 if ( empty( $user_id ) )
     987                if ( empty( $user_id ) ) {
    977988                        return false;
     989                }
    978990
    979991                // Allow early overriding of the profile URL to cut down on processing
    980992                $early_profile_url = apply_filters( 'bbp_pre_get_subscriptions_permalink', (int) $user_id );
    981                 if ( is_string( $early_profile_url ) )
     993                if ( is_string( $early_profile_url ) ) {
    982994                        return $early_profile_url;
     995                }
    983996
    984997                // Pretty permalinks
     
    12021215        $public_display['display_username'] = $bbp->displayed_user->user_login;
    12031216
    1204         if ( !empty( $bbp->displayed_user->nickname ) )
     1217        if ( !empty( $bbp->displayed_user->nickname ) ) {
    12051218                $public_display['display_nickname']  = $bbp->displayed_user->nickname;
    1206 
    1207         if ( !empty( $bbp->displayed_user->first_name ) )
     1219        }
     1220
     1221        if ( !empty( $bbp->displayed_user->first_name ) ) {
    12081222                $public_display['display_firstname'] = $bbp->displayed_user->first_name;
    1209 
    1210         if ( !empty( $bbp->displayed_user->last_name ) )
     1223        }
     1224
     1225        if ( !empty( $bbp->displayed_user->last_name ) ) {
    12111226                $public_display['display_lastname']  = $bbp->displayed_user->last_name;
     1227        }
    12121228
    12131229        if ( !empty( $bbp->displayed_user->first_name ) && !empty( $bbp->displayed_user->last_name ) ) {
     
    12161232        }
    12171233
    1218         if ( !in_array( $bbp->displayed_user->display_name, $public_display ) ) // Only add this if it isn't duplicated elsewhere
     1234        // Only add this if it isn't duplicated elsewhere
     1235        if ( !in_array( $bbp->displayed_user->display_name, $public_display ) ) {
    12191236                $public_display = array( 'display_displayname' => $bbp->displayed_user->display_name ) + $public_display;
     1237        }
    12201238
    12211239        $public_display = array_map( 'trim', $public_display );
     
    12431261
    12441262        // Return if no user is being edited
    1245         if ( ! bbp_is_single_user_edit() )
     1263        if ( ! bbp_is_single_user_edit() ) {
    12461264                return;
     1265        }
    12471266
    12481267        // Get users current blog role
     
    12741293
    12751294        // Return if no user is being edited
    1276         if ( ! bbp_is_single_user_edit() )
     1295        if ( ! bbp_is_single_user_edit() ) {
    12771296                return;
     1297        }
    12781298
    12791299        // Get the user's current forum role
     
    12841304
    12851305        // Only keymasters can set other keymasters
    1286         if ( ! bbp_is_user_keymaster() )
    1287                 unset( $dynamic_roles[ bbp_get_keymaster_role() ] ); ?>
     1306        if ( ! bbp_is_user_keymaster() ) {
     1307                unset( $dynamic_roles[ bbp_get_keymaster_role() ] );
     1308        } ?>
    12881309
    12891310        <select name="bbp-forums-role" id="bbp-forums-role">
     
    13471368                // Use displayed user ID if there is one, and one isn't requested
    13481369                $user_id = bbp_get_user_id( $user_id );
    1349                 if ( empty( $user_id ) )
     1370                if ( empty( $user_id ) ) {
    13501371                        return false;
     1372                }
    13511373
    13521374                // Allow early overriding of the profile URL to cut down on processing
    13531375                $early_url = apply_filters( 'bbp_pre_get_user_topics_created_url', (int) $user_id );
    1354                 if ( is_string( $early_url ) )
     1376                if ( is_string( $early_url ) ) {
    13551377                        return $early_url;
     1378                }
    13561379
    13571380                // Pretty permalinks
     
    14071430                // Use displayed user ID if there is one, and one isn't requested
    14081431                $user_id = bbp_get_user_id( $user_id );
    1409                 if ( empty( $user_id ) )
     1432                if ( empty( $user_id ) ) {
    14101433                        return false;
     1434                }
    14111435
    14121436                // Allow early overriding of the profile URL to cut down on processing
    14131437                $early_url = apply_filters( 'bbp_pre_get_user_replies_created_url', (int) $user_id );
    1414                 if ( is_string( $early_url ) )
     1438                if ( is_string( $early_url ) ) {
    14151439                        return $early_url;
     1440                }
    14161441
    14171442                // Pretty permalinks
     
    14971522
    14981523        // Bail if user is not logged in
    1499         if ( !is_user_logged_in() )
     1524        if ( !is_user_logged_in() ) {
    15001525                return;
     1526        }
    15011527
    15021528        // Setup the profile page to redirect to
     
    15201546?>
    15211547
    1522                 <input type="hidden" name="user-cookie" value="1" />
    1523 
    1524                 <?php
    1525 
    1526                 // Allow custom login redirection
    1527                 $redirect_to = apply_filters( 'bbp_user_login_redirect_to', '' );
    1528                 bbp_redirect_to_field( $redirect_to );
    1529 
    1530                 // Prevent intention hi-jacking of log-in form
    1531                 wp_nonce_field( 'bbp-user-login' );
     1548        <input type="hidden" name="user-cookie" value="1" />
     1549
     1550        <?php
     1551
     1552        // Allow custom login redirection
     1553        $redirect_to = apply_filters( 'bbp_user_login_redirect_to', '' );
     1554        bbp_redirect_to_field( $redirect_to );
     1555
     1556        // Prevent intention hi-jacking of log-in form
     1557        wp_nonce_field( 'bbp-user-login' );
    15321558}
    15331559
     
    15481574?>
    15491575
    1550                 <input type="hidden" name="action"      value="register" />
    1551                 <input type="hidden" name="user-cookie" value="1" />
    1552 
    1553                 <?php
    1554 
    1555                 // Allow custom registration redirection
    1556                 $redirect_to = apply_filters( 'bbp_user_register_redirect_to', '' );
    1557                 bbp_redirect_to_field( add_query_arg( array( 'checkemail' => 'registered' ), $redirect_to ) );
    1558 
    1559                 // Prevent intention hi-jacking of sign-up form
    1560                 wp_nonce_field( 'bbp-user-register' );
     1576        <input type="hidden" name="action"      value="register" />
     1577        <input type="hidden" name="user-cookie" value="1" />
     1578
     1579        <?php
     1580
     1581        // Allow custom registration redirection
     1582        $redirect_to = apply_filters( 'bbp_user_register_redirect_to', '' );
     1583        bbp_redirect_to_field( add_query_arg( array( 'checkemail' => 'registered' ), $redirect_to ) );
     1584
     1585        // Prevent intention hi-jacking of sign-up form
     1586        wp_nonce_field( 'bbp-user-register' );
    15611587}
    15621588
     
    15751601?>
    15761602
    1577                 <input type="hidden" name="user-cookie" value="1" />
    1578 
    1579                 <?php
    1580 
    1581                 // Allow custom lost pass redirection
    1582                 $redirect_to = apply_filters( 'bbp_user_lost_pass_redirect_to', get_permalink() );
    1583                 bbp_redirect_to_field( add_query_arg( array( 'checkemail' => 'confirm' ), $redirect_to ) );
    1584 
    1585                 // Prevent intention hi-jacking of lost pass form
    1586                 wp_nonce_field( 'bbp-user-lost-pass' );
     1603        <input type="hidden" name="user-cookie" value="1" />
     1604
     1605        <?php
     1606
     1607        // Allow custom lost pass redirection
     1608        $redirect_to = apply_filters( 'bbp_user_lost_pass_redirect_to', get_permalink() );
     1609        bbp_redirect_to_field( add_query_arg( array( 'checkemail' => 'confirm' ), $redirect_to ) );
     1610
     1611        // Prevent intention hi-jacking of lost pass form
     1612        wp_nonce_field( 'bbp-user-lost-pass' );
    15871613}
    15881614
     
    18701896
    18711897        // Private forums
    1872         if ( !current_user_can( 'read_private_forums' ) )
     1898        if ( !current_user_can( 'read_private_forums' ) ) {
    18731899                $private = bbp_get_private_forum_ids();
     1900        }
    18741901
    18751902        // Hidden forums
    1876         if ( !current_user_can( 'read_hidden_forums' ) )
     1903        if ( !current_user_can( 'read_hidden_forums' ) ) {
    18771904                $hidden  = bbp_get_hidden_forum_ids();
     1905        }
    18781906
    18791907        // Merge private and hidden forums together and remove any empties
     
    18811909
    18821910        // There are forums that need to be ex
    1883         if ( !empty( $forum_ids ) )
     1911        if ( !empty( $forum_ids ) ) {
    18841912                $post__not_in = implode( ',', $forum_ids );
     1913        }
    18851914
    18861915        // Parse arguments against default values
     
    18961925
    18971926        // No availabe forums
    1898         if ( empty( $forums ) )
     1927        if ( empty( $forums ) ) {
    18991928                $forums = false;
     1929        }
    19001930
    19011931        return apply_filters( 'bbp_get_forums_for_current_user', $forums );
Note: See TracChangeset for help on using the changeset viewer.