Skip to:
Content

BuddyPress.org

Changeset 1025 for trunk/bp-groups.php


Ignore:
Timestamp:
02/06/2009 10:44:01 PM (16 years ago)
Author:
apeatling
Message:

Syntax cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups.php

    r1021 r1025  
    3131   
    3232    $sql[] = "CREATE TABLE {$bp->groups->table_name} (
    33             id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    34             creator_id int(11) NOT NULL,
     33            id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
     34            creator_id bigint(20) NOT NULL,
    3535            name varchar(100) NOT NULL,
    3636            slug varchar(100) NOT NULL,
     
    5252   
    5353    $sql[] = "CREATE TABLE {$bp->groups->table_name_members} (
    54             id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    55             group_id int(11) NOT NULL,
    56             user_id int(11) NOT NULL,
    57             inviter_id int(11) NOT NULL,
     54            id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
     55            group_id bigint(20) NOT NULL,
     56            user_id bigint(20) NOT NULL,
     57            inviter_id bigint(20) NOT NULL,
    5858            is_admin tinyint(1) NOT NULL DEFAULT '0',
    5959            is_mod tinyint(1) NOT NULL DEFAULT '0',
     
    7373
    7474    $sql[] = "CREATE TABLE {$bp->groups->table_name_groupmeta} (
    75             id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    76             group_id int(11) NOT NULL,
     75            id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
     76            group_id bigint(20) NOT NULL,
    7777            meta_key varchar(255) DEFAULT NULL,
    7878            meta_value longtext DEFAULT NULL,
     
    9494   
    9595    $sql[] = "CREATE TABLE {$bp->groups->table_name_wire} (
    96             id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    97             item_id int(11) NOT NULL,
    98             user_id int(11) NOT NULL,
     96            id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
     97            item_id bigint(20) NOT NULL,
     98            user_id bigint(20) NOT NULL,
    9999            content longtext NOT NULL,
    100100            date_posted datetime NOT NULL,
     
    150150    if ( is_site_admin() ) {
    151151        /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    152         if ( ( $wpdb->get_var("SHOW TABLES LIKE '%" . $bp->groups->table_name . "%'") == false ) || ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION )  )
     152        if ( false == ( $wpdb->get_var("SHOW TABLES LIKE '%" . $bp->groups->table_name . "%'") ) || ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION )  )
    153153            groups_install();
    154154           
    155         if ( ( function_exists('bp_wire_install') && $wpdb->get_var("SHOW TABLES LIKE '%" . $bp->groups->table_name_wire . "%'") == false ) || ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION ) )
     155        if ( ( function_exists('bp_wire_install') && false == $wpdb->get_var("SHOW TABLES LIKE '%" . $bp->groups->table_name_wire . "%'") ) || ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION ) )
    156156            groups_wire_install();
    157157    }
     
    199199   
    200200        /* Should this group be visible to the logged in user? */
    201         $is_visible = ( $group_obj->status == 'public' || $is_member ) ? true : false;
     201        $is_visible = ( 'public' == $group_obj->status || $is_member ) ? true : false;
    202202    }
    203203
     
    242242           
    243243            // If this is a private or hidden group, does the user have access?
    244             if ( $group_obj->status == 'private' || $group_obj->status == 'hidden' ) {
     244            if ( 'private' == $group_obj->status || 'hidden' == $group_obj->status ) {
    245245                if ( groups_is_user_member( $bp->loggedin_user->id, $group_obj->id ) && is_user_logged_in() )
    246246                    $has_access = true;
     
    366366
    367367        // If the user skipped the avatar step, move onto the next step and don't save anything.
    368         if ( isset( $_POST['skip'] ) && $create_group_step == "3" ) {
     368        if ( isset( $_POST['skip'] ) && 3 == (int)$create_group_step ) {
    369369            $create_group_step++;
    370370            $completed_to_step++;
     
    373373           
    374374            // We're done.
    375             if ( $create_group_step == 4 )
     375            if ( 4 == (int)$create_group_step )
    376376                bp_core_redirect( bp_group_permalink( $group_obj, false ) );
    377377           
     
    455455       
    456456    if ( $is_single_group ) {
    457         if ( $wire_action == 'post' && BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group_obj->id ) ) {
     457        if ( 'post' == $wire_action && BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group_obj->id ) ) {
    458458
    459459            if ( !groups_new_wire_post( $group_obj->id, $_POST['wire-post-textarea'] ) ) {
     
    469469            }
    470470   
    471         } else if ( $wire_action == 'delete' && BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group_obj->id ) ) {
     471        } else if ( 'delete' == $wire_action && BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group_obj->id ) ) {
    472472            $wire_message_id = $bp->action_variables[1];
    473473
     
    484484            }
    485485       
    486         } else if ( ( !$wire_action || $bp->action_variables[1] == 'latest' ) ) {
     486        } else if ( ( !$wire_action || 'latest' == $bp->action_variables[1] ) ) {
    487487            bp_core_load_template( 'groups/wire' );
    488488        } else {
     
    518518   
    519519    if ( $is_single_group ) {
    520         if ( isset($bp->action_variables) && $bp->action_variables[0] == 'send' ) {
     520        if ( isset($bp->action_variables) && 'send' == $bp->action_variables[0] ) {
    521521            // Send the invites.
    522522            groups_send_invites($group_obj);
     
    538538   
    539539    if ( $is_single_group ) {
    540         if ( isset($bp->action_variables) && $bp->action_variables[0] == 'yes' ) {
     540        if ( isset($bp->action_variables) && 'yes' == $bp->action_variables[0] ) {
    541541           
    542542            // Check if the user is the group admin first.
     
    555555            }
    556556           
    557         } else if ( isset($bp->action_variables) && $bp->action_variables[0] == 'no' ) {
     557        } else if ( isset($bp->action_variables) && 'no' == $bp->action_variables[0] ) {
    558558           
    559559            bp_core_redirect( bp_group_permalink( $group_obj, false) );
     
    576576        return false;
    577577   
    578     if ( $group_obj->status == 'private' ) {
     578    if ( 'private' == $group_obj->status ) {
    579579        // If the user has submitted a request, send it.
    580580        if ( isset( $_POST['group-request-send']) ) {
     
    608608    global $bp, $group_obj;
    609609   
    610     if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'edit-details' ) {
     610    if ( $bp->current_component == $bp->groups->slug && 'edit-details' == $bp->action_variables[0] ) {
    611611   
    612612        if ( $bp->is_item_admin || $bp->is_item_mod  ) {
     
    638638    global $bp, $group_obj;
    639639   
    640     if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'group-settings' ) {
     640    if ( $bp->current_component == $bp->groups->slug && 'group-settings' == $bp->action_variables[0] ) {
    641641       
    642642        if ( !$bp->is_item_admin )
     
    672672    global $bp, $group_obj;
    673673   
    674     if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'group-avatar' ) {
     674    if ( $bp->current_component == $bp->groups->slug && 'group-avatar' == $bp->action_variables[0] ) {
    675675       
    676676        if ( !$bp->is_item_admin )
     
    717717    global $bp, $group_obj;
    718718
    719     if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'manage-members' ) {
     719    if ( $bp->current_component == $bp->groups->slug && 'manage-members' == $bp->action_variables[0] ) {
    720720       
    721721        if ( !$bp->is_item_admin )
    722722            return false;
    723723       
    724         if ( $bp->action_variables[1] == 'promote' && is_numeric( $bp->action_variables[2] ) ) {
     724        if ( 'promote' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
    725725            $user_id = $bp->action_variables[2];
    726726           
     
    737737        }
    738738       
    739         if ( $bp->action_variables[1] == 'demote' && is_numeric( $bp->action_variables[2] ) ) {
     739        if ( 'demote' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
    740740            $user_id = $bp->action_variables[2];
    741741           
     
    752752        }
    753753       
    754         if ( $bp->action_variables[1] == 'ban' && is_numeric( $bp->action_variables[2] ) ) {
     754        if ( 'ban' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
    755755            $user_id = $bp->action_variables[2];
    756756           
     
    767767        }
    768768       
    769         if ( $bp->action_variables[1] == 'unban' && is_numeric( $bp->action_variables[2] ) ) {
     769        if ( 'unban' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
    770770            $user_id = $bp->action_variables[2];
    771771           
     
    793793    global $bp, $group_obj;
    794794   
    795     if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'membership-requests' ) {
    796        
    797         if ( !$bp->is_item_admin || $group_obj->status == 'public' )
     795    if ( $bp->current_component == $bp->groups->slug && 'membership-requests' == $bp->action_variables[0] ) {
     796       
     797        if ( !$bp->is_item_admin || 'public' == $group_obj->status )
    798798            return false;
    799799       
     
    805805
    806806        if ( isset($request_action) && isset($membership_id) ) {
    807             if ( $request_action == 'accept' && is_numeric($membership_id) ) {
     807            if ( 'accept' == $request_action && is_numeric($membership_id) ) {
    808808
    809809                // Accept the membership request
     
    814814                }
    815815
    816             } else if ( $request_action == 'reject' && is_numeric($membership_id) ) {
     816            } else if ( 'reject' == $request_action && is_numeric($membership_id) ) {
    817817
    818818                // Reject the membership request
     
    840840    global $bp, $group_obj;
    841841   
    842     if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'delete-group' ) {
     842    if ( $bp->current_component == $bp->groups->slug && 'delete-group' == $bp->action_variables[0] ) {
    843843       
    844844        if ( !$bp->is_item_admin )
     
    878878            <td></td>
    879879            <td><?php _e( 'A member invites you to join a group', 'buddypress' ) ?></td>
    880             <td class="yes"><input type="radio" name="notifications[notification_groups_invite]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_invite') || get_usermeta( $current_user->id, 'notification_groups_invite') == 'yes' ) { ?>checked="checked" <?php } ?>/></td>
    881             <td class="no"><input type="radio" name="notifications[notification_groups_invite]" value="no" <?php if ( get_usermeta( $current_user->id, 'notification_groups_invite') == 'no' ) { ?>checked="checked" <?php } ?>/></td>
     880            <td class="yes"><input type="radio" name="notifications[notification_groups_invite]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_invite') || 'yes' == get_usermeta( $current_user->id, 'notification_groups_invite') ) { ?>checked="checked" <?php } ?>/></td>
     881            <td class="no"><input type="radio" name="notifications[notification_groups_invite]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_groups_invite') ) { ?>checked="checked" <?php } ?>/></td>
    882882        </tr>
    883883        <tr>
    884884            <td></td>
    885885            <td><?php _e( 'Group information is updated', 'buddypress' ) ?></td>
    886             <td class="yes"><input type="radio" name="notifications[notification_groups_group_updated]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_group_updated') || get_usermeta( $current_user->id, 'notification_groups_group_updated') == 'yes' ) { ?>checked="checked" <?php } ?>/></td>
    887             <td class="no"><input type="radio" name="notifications[notification_groups_group_updated]" value="no" <?php if ( get_usermeta( $current_user->id, 'notification_groups_group_updated') == 'no' ) { ?>checked="checked" <?php } ?>/></td>
     886            <td class="yes"><input type="radio" name="notifications[notification_groups_group_updated]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_group_updated') || 'yes' == get_usermeta( $current_user->id, 'notification_groups_group_updated') ) { ?>checked="checked" <?php } ?>/></td>
     887            <td class="no"><input type="radio" name="notifications[notification_groups_group_updated]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_groups_group_updated') ) { ?>checked="checked" <?php } ?>/></td>
    888888        </tr>
    889889        <?php if ( function_exists('bp_wire_install') ) { ?>
     
    891891            <td></td>
    892892            <td><?php _e( 'A member posts on the wire of a group you belong to', 'buddypress' ) ?></td>
    893             <td class="yes"><input type="radio" name="notifications[notification_groups_wire_post]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_wire_post') || get_usermeta( $current_user->id, 'notification_groups_wire_post') == 'yes' ) { ?>checked="checked" <?php } ?>/></td>
    894             <td class="no"><input type="radio" name="notifications[notification_groups_wire_post]" value="no" <?php if ( get_usermeta( $current_user->id, 'notification_groups_wire_post') == 'no' ) { ?>checked="checked" <?php } ?>/></td>
     893            <td class="yes"><input type="radio" name="notifications[notification_groups_wire_post]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_wire_post') || 'yes' == get_usermeta( $current_user->id, 'notification_groups_wire_post') ) { ?>checked="checked" <?php } ?>/></td>
     894            <td class="no"><input type="radio" name="notifications[notification_groups_wire_post]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_groups_wire_post') ) { ?>checked="checked" <?php } ?>/></td>
    895895        </tr>
    896896        <?php } ?>
     
    898898            <td></td>
    899899            <td><?php _e( 'You are promoted to a group administrator or moderator', 'buddypress' ) ?></td>
    900             <td class="yes"><input type="radio" name="notifications[notification_groups_admin_promotion]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_admin_promotion') || get_usermeta( $current_user->id, 'notification_groups_admin_promotion') == 'yes' ) { ?>checked="checked" <?php } ?>/></td>
    901             <td class="no"><input type="radio" name="notifications[notification_groups_admin_promotion]" value="no" <?php if ( get_usermeta( $current_user->id, 'notification_groups_admin_promotion') == 'no' ) { ?>checked="checked" <?php } ?>/></td>
     900            <td class="yes"><input type="radio" name="notifications[notification_groups_admin_promotion]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_admin_promotion') || 'yes' == get_usermeta( $current_user->id, 'notification_groups_admin_promotion') ) { ?>checked="checked" <?php } ?>/></td>
     901            <td class="no"><input type="radio" name="notifications[notification_groups_admin_promotion]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_groups_admin_promotion') ) { ?>checked="checked" <?php } ?>/></td>
    902902        </tr>
    903903        <tr>
    904904            <td></td>
    905905            <td><?php _e( 'A member requests to join a private group for which you are an admin', 'buddypress' ) ?></td>
    906             <td class="yes"><input type="radio" name="notifications[notification_groups_membership_request]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_membership_request') || get_usermeta( $current_user->id, 'notification_groups_membership_request') == 'yes' ) { ?>checked="checked" <?php } ?>/></td>
    907             <td class="no"><input type="radio" name="notifications[notification_groups_membership_request]" value="no" <?php if ( get_usermeta( $current_user->id, 'notification_groups_membership_request') == 'no' ) { ?>checked="checked" <?php } ?>/></td>
     906            <td class="yes"><input type="radio" name="notifications[notification_groups_membership_request]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_membership_request') || 'yes' == get_usermeta( $current_user->id, 'notification_groups_membership_request') ) { ?>checked="checked" <?php } ?>/></td>
     907            <td class="no"><input type="radio" name="notifications[notification_groups_membership_request]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_groups_membership_request') ) { ?>checked="checked" <?php } ?>/></td>
    908908        </tr>
    909909       
     
    952952        extract($args);
    953953
    954         if ( $group_obj->status == 'public' )
     954        if ( 'public' == $group_obj->status )
    955955            bp_activity_record( $item_id, $component_name, $component_action, $is_private, $secondary_item_id, $user_id, $secondary_user_id );
    956956    }
     
    13381338    global $bp, $create_group_step, $group_obj, $bbpress_live;
    13391339
    1340     if ( is_numeric( $step ) && ( $step == '1' || $step == '2' || $step == '3' || $step == '4' ) ) {
     1340    if ( is_numeric( $step ) && ( 1 == (int)$step || 2 == (int)$step || 3 == (int)$step || 4 == (int)$step ) ) {
    13411341       
    13421342        if ( !$group_obj )
     
    14191419                    $group_obj->photos_admin_only = 1;
    14201420               
    1421                 if ( $_POST['group-status'] == 'private' ) {
     1421                if ( 'private' == $_POST['group-status'] ) {
    14221422                    $group_obj->status = 'private';
    1423                 } else if ( $_POST['group-status'] == 'hidden' ) {
     1423                } else if ( 'hidden' == $_POST['group-status'] ) {
    14241424                    $group_obj->status = 'hidden';
    14251425                }
     
    14801480    }
    14811481   
    1482     if ( substr( $slug, 0, 2 ) == 'wp' )
     1482    if ( 'wp' == substr( $slug, 0, 2 ) )
    14831483        $slug = substr( $slug, 2, strlen( $slug ) - 2 );
    14841484   
     
    20402040    $metas = array_map('maybe_unserialize', $metas);
    20412041
    2042     if ( count($metas) == 1 )
     2042    if ( 1 == count($metas) )
    20432043        return $metas[0];
    20442044    else
Note: See TracChangeset for help on using the changeset viewer.