Changeset 1025 for trunk/bp-groups.php
- Timestamp:
- 02/06/2009 10:44:01 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups.php
r1021 r1025 31 31 32 32 $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, 35 35 name varchar(100) NOT NULL, 36 36 slug varchar(100) NOT NULL, … … 52 52 53 53 $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, 58 58 is_admin tinyint(1) NOT NULL DEFAULT '0', 59 59 is_mod tinyint(1) NOT NULL DEFAULT '0', … … 73 73 74 74 $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, 77 77 meta_key varchar(255) DEFAULT NULL, 78 78 meta_value longtext DEFAULT NULL, … … 94 94 95 95 $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, 99 99 content longtext NOT NULL, 100 100 date_posted datetime NOT NULL, … … 150 150 if ( is_site_admin() ) { 151 151 /* 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 ) ) 153 153 groups_install(); 154 154 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 ) ) 156 156 groups_wire_install(); 157 157 } … … 199 199 200 200 /* 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; 202 202 } 203 203 … … 242 242 243 243 // 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 ) { 245 245 if ( groups_is_user_member( $bp->loggedin_user->id, $group_obj->id ) && is_user_logged_in() ) 246 246 $has_access = true; … … 366 366 367 367 // 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 ) { 369 369 $create_group_step++; 370 370 $completed_to_step++; … … 373 373 374 374 // We're done. 375 if ( $create_group_step == 4)375 if ( 4 == (int)$create_group_step ) 376 376 bp_core_redirect( bp_group_permalink( $group_obj, false ) ); 377 377 … … 455 455 456 456 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 ) ) { 458 458 459 459 if ( !groups_new_wire_post( $group_obj->id, $_POST['wire-post-textarea'] ) ) { … … 469 469 } 470 470 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 ) ) { 472 472 $wire_message_id = $bp->action_variables[1]; 473 473 … … 484 484 } 485 485 486 } else if ( ( !$wire_action || $bp->action_variables[1] == 'latest') ) {486 } else if ( ( !$wire_action || 'latest' == $bp->action_variables[1] ) ) { 487 487 bp_core_load_template( 'groups/wire' ); 488 488 } else { … … 518 518 519 519 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] ) { 521 521 // Send the invites. 522 522 groups_send_invites($group_obj); … … 538 538 539 539 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] ) { 541 541 542 542 // Check if the user is the group admin first. … … 555 555 } 556 556 557 } else if ( isset($bp->action_variables) && $bp->action_variables[0] == 'no') {557 } else if ( isset($bp->action_variables) && 'no' == $bp->action_variables[0] ) { 558 558 559 559 bp_core_redirect( bp_group_permalink( $group_obj, false) ); … … 576 576 return false; 577 577 578 if ( $group_obj->status == 'private') {578 if ( 'private' == $group_obj->status ) { 579 579 // If the user has submitted a request, send it. 580 580 if ( isset( $_POST['group-request-send']) ) { … … 608 608 global $bp, $group_obj; 609 609 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] ) { 611 611 612 612 if ( $bp->is_item_admin || $bp->is_item_mod ) { … … 638 638 global $bp, $group_obj; 639 639 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] ) { 641 641 642 642 if ( !$bp->is_item_admin ) … … 672 672 global $bp, $group_obj; 673 673 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] ) { 675 675 676 676 if ( !$bp->is_item_admin ) … … 717 717 global $bp, $group_obj; 718 718 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] ) { 720 720 721 721 if ( !$bp->is_item_admin ) 722 722 return false; 723 723 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] ) ) { 725 725 $user_id = $bp->action_variables[2]; 726 726 … … 737 737 } 738 738 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] ) ) { 740 740 $user_id = $bp->action_variables[2]; 741 741 … … 752 752 } 753 753 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] ) ) { 755 755 $user_id = $bp->action_variables[2]; 756 756 … … 767 767 } 768 768 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] ) ) { 770 770 $user_id = $bp->action_variables[2]; 771 771 … … 793 793 global $bp, $group_obj; 794 794 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 ) 798 798 return false; 799 799 … … 805 805 806 806 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) ) { 808 808 809 809 // Accept the membership request … … 814 814 } 815 815 816 } else if ( $request_action == 'reject'&& is_numeric($membership_id) ) {816 } else if ( 'reject' == $request_action && is_numeric($membership_id) ) { 817 817 818 818 // Reject the membership request … … 840 840 global $bp, $group_obj; 841 841 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] ) { 843 843 844 844 if ( !$bp->is_item_admin ) … … 878 878 <td></td> 879 879 <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> 882 882 </tr> 883 883 <tr> 884 884 <td></td> 885 885 <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> 888 888 </tr> 889 889 <?php if ( function_exists('bp_wire_install') ) { ?> … … 891 891 <td></td> 892 892 <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> 895 895 </tr> 896 896 <?php } ?> … … 898 898 <td></td> 899 899 <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> 902 902 </tr> 903 903 <tr> 904 904 <td></td> 905 905 <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> 908 908 </tr> 909 909 … … 952 952 extract($args); 953 953 954 if ( $group_obj->status == 'public')954 if ( 'public' == $group_obj->status ) 955 955 bp_activity_record( $item_id, $component_name, $component_action, $is_private, $secondary_item_id, $user_id, $secondary_user_id ); 956 956 } … … 1338 1338 global $bp, $create_group_step, $group_obj, $bbpress_live; 1339 1339 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 ) ) { 1341 1341 1342 1342 if ( !$group_obj ) … … 1419 1419 $group_obj->photos_admin_only = 1; 1420 1420 1421 if ( $_POST['group-status'] == 'private') {1421 if ( 'private' == $_POST['group-status'] ) { 1422 1422 $group_obj->status = 'private'; 1423 } else if ( $_POST['group-status'] == 'hidden') {1423 } else if ( 'hidden' == $_POST['group-status'] ) { 1424 1424 $group_obj->status = 'hidden'; 1425 1425 } … … 1480 1480 } 1481 1481 1482 if ( substr( $slug, 0, 2 ) == 'wp')1482 if ( 'wp' == substr( $slug, 0, 2 ) ) 1483 1483 $slug = substr( $slug, 2, strlen( $slug ) - 2 ); 1484 1484 … … 2040 2040 $metas = array_map('maybe_unserialize', $metas); 2041 2041 2042 if ( count($metas) == 1)2042 if ( 1 == count($metas) ) 2043 2043 return $metas[0]; 2044 2044 else
Note: See TracChangeset
for help on using the changeset viewer.