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/capabilities.php

    r5167 r5436  
    190190
    191191    // Bail if no user ID was passed
    192     if ( empty( $user_id ) )
    193         return;
     192    if ( empty( $user_id ) ) {
     193        return;
     194    }
    194195
    195196    // Bail if no role
    196     if ( ! isset( $_POST['bbp-forums-role'] ) )
    197         return;
     197    if ( ! isset( $_POST['bbp-forums-role'] ) ) {
     198        return;
     199    }
    198200
    199201    // Fromus role we want the user to have
     
    202204
    203205    // Bail if no role change
    204     if ( $new_role === $forums_role )
    205         return;
     206    if ( $new_role === $forums_role ) {
     207        return;
     208    }
    206209
    207210    // Bail if trying to set their own role
    208     if ( bbp_is_user_home_edit() )
    209         return;
     211    if ( bbp_is_user_home_edit() ) {
     212        return;
     213    }
    210214   
    211215    // Bail if current user cannot promote the passing user
    212     if ( ! current_user_can( 'promote_user', $user_id ) )
    213         return;
     216    if ( ! current_user_can( 'promote_user', $user_id ) ) {
     217        return;
     218    }
    214219
    215220    // Set the new forums role
     
    240245
    241246    // Bail if deactivating bbPress
    242     if ( bbp_is_deactivation() )
    243         return;
     247    if ( bbp_is_deactivation() ) {
     248        return;
     249    }
    244250
    245251    // Catch all, to prevent premature user initialization
    246     if ( ! did_action( 'set_current_user' ) )
    247         return;
     252    if ( ! did_action( 'set_current_user' ) ) {
     253        return;
     254    }
    248255
    249256    // Bail if not logged in or already a member of this site
    250     if ( ! is_user_logged_in() )
    251         return;
     257    if ( ! is_user_logged_in() ) {
     258        return;
     259    }
    252260
    253261    // Get the current user ID
     
    255263
    256264    // Bail if user already has a forums role
    257     if ( bbp_get_user_role( $user_id ) )
    258         return;
     265    if ( bbp_get_user_role( $user_id ) ) {
     266        return;
     267    }
    259268
    260269    // Bail if user is marked as spam or is deleted
    261     if ( bbp_is_user_inactive( $user_id ) )
    262         return;
     270    if ( bbp_is_user_inactive( $user_id ) ) {
     271        return;
     272    }
    263273
    264274    /** Ready *****************************************************************/
     
    341351
    342352    // Default to current user
    343     if ( empty( $user_id ) && is_user_logged_in() )
     353    if ( empty( $user_id ) && is_user_logged_in() ) {
    344354        $user_id = bbp_get_current_user_id();
     355    }
    345356
    346357    // No user to check
    347     if ( empty( $user_id ) )
    348         return false;
     358    if ( empty( $user_id ) ) {
     359        return false;
     360    }
    349361
    350362    // Assume user is not spam
     
    393405
    394406    // Use displayed user if it's not yourself
    395     if ( empty( $user_id ) && bbp_is_single_user() && !bbp_is_user_home() )
     407    if ( empty( $user_id ) && bbp_is_single_user() && !bbp_is_user_home() ) {
    396408        $user_id = bbp_get_displayed_user_id();
     409    }
    397410
    398411    // Bail if no user ID
    399     if ( empty( $user_id ) )
    400         return false;
     412    if ( empty( $user_id ) ) {
     413        return false;
     414    }
    401415
    402416    // Bail if user ID is keymaster
    403     if ( bbp_is_user_keymaster( $user_id ) )
    404         return false;
     417    if ( bbp_is_user_keymaster( $user_id ) ) {
     418        return false;
     419    }
    405420
    406421    // Arm the torpedos
     
    411426
    412427    // If user has no blogs, they are a guest on this site
    413     if ( empty( $blogs ) )
    414         $blogs[$wpdb->blogid] = array();
     428    if ( empty( $blogs ) ) {
     429        $blogs[ $wpdb->blogid ] = array();
     430    }
    415431
    416432    // Make array of post types to mark as spam
     
    480496
    481497    // Use displayed user if it's not yourself
    482     if ( empty( $user_id ) && bbp_is_single_user() && !bbp_is_user_home() )
     498    if ( empty( $user_id ) && bbp_is_single_user() && !bbp_is_user_home() ) {
    483499        $user_id = bbp_get_displayed_user_id();
     500    }
    484501
    485502    // Bail if no user ID
    486     if ( empty( $user_id ) )
    487         return false;
     503    if ( empty( $user_id ) ) {
     504        return false;
     505    }
    488506
    489507    // Bail if user ID is keymaster
    490     if ( bbp_is_user_keymaster( $user_id ) )
    491         return false;
     508    if ( bbp_is_user_keymaster( $user_id ) ) {
     509        return false;
     510    }
    492511
    493512    // Arm the torpedos
     
    498517
    499518    // If user has no blogs, they are a guest on this site
    500     if ( empty( $blogs ) )
    501         $blogs[$wpdb->blogid] = array();
     519    if ( empty( $blogs ) ) {
     520        $blogs[ $wpdb->blogid ] = array();
     521    }
    502522
    503523    // Make array of post types to mark as spam
     
    552572
    553573    // Default to current user
    554     if ( empty( $user_id ) && is_user_logged_in() )
     574    if ( empty( $user_id ) && is_user_logged_in() ) {
    555575        $user_id = bbp_get_current_user_id();
     576    }
    556577
    557578    // No user to check
    558     if ( empty( $user_id ) )
    559         return false;
     579    if ( empty( $user_id ) ) {
     580        return false;
     581    }
    560582
    561583    // Assume user is not deleted
     
    593615
    594616    // Default to current user
    595     if ( empty( $user_id ) && is_user_logged_in() )
     617    if ( empty( $user_id ) && is_user_logged_in() ) {
    596618        $user_id = bbp_get_current_user_id();
     619    }
    597620
    598621    // No user to check
    599     if ( empty( $user_id ) )
    600         return false;
     622    if ( empty( $user_id ) ) {
     623        return false;
     624    }
    601625
    602626    // Check spam
    603     if ( bbp_is_user_spammer( $user_id ) )
    604         return false;
     627    if ( bbp_is_user_spammer( $user_id ) ) {
     628        return false;
     629    }
    605630
    606631    // Check deleted
    607     if ( bbp_is_user_deleted( $user_id ) )
    608         return false;
     632    if ( bbp_is_user_deleted( $user_id ) ) {
     633        return false;
     634    }
    609635
    610636    // Assume true if not spam or deleted
     
    627653
    628654    // Default to current user
    629     if ( empty( $user_id ) && is_user_logged_in() )
     655    if ( empty( $user_id ) && is_user_logged_in() ) {
    630656        $user_id = bbp_get_current_user_id();
     657    }
    631658
    632659    // No user to check
    633     if ( empty( $user_id ) )
    634         return false;
     660    if ( empty( $user_id ) ) {
     661        return false;
     662    }
    635663
    636664    // Return the inverse of active
Note: See TracChangeset for help on using the changeset viewer.