Changeset 502
- Timestamp:
- 11/06/2008 05:16:28 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
-
bp-blogs.php (modified) (1 diff)
-
bp-core.php (modified) (4 diffs)
-
bp-core/bp-core-classes.php (modified) (4 diffs)
-
bp-core/bp-core-cssjs.php (modified) (1 diff)
-
bp-core/bp-core-notifications.php (modified) (4 diffs)
-
bp-core/bp-core-settings.php (modified) (1 diff)
-
bp-core/css/admin-bar.css (modified) (8 diffs)
-
bp-friends.php (modified) (1 diff)
-
bp-groups.php (modified) (21 diffs)
-
bp-groups/bp-groups-ajax.php (modified) (1 diff)
-
bp-groups/bp-groups-classes.php (modified) (18 diffs)
-
bp-groups/bp-groups-notifications.php (modified) (1 diff)
-
bp-groups/bp-groups-templatetags.php (modified) (11 diffs)
-
bp-groups/js/general.js (modified) (7 diffs)
-
bp-xprofile.php (modified) (1 diff)
-
bp-xprofile/bp-xprofile-cssjs.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-blogs.php
r489 r502 200 200 if ( !$blog ) 201 201 return false; 202 203 if ( !$user_id ) 204 return false; 202 205 203 206 return sprintf( __( '%s created a new blog: %s', 'buddypress' ), bp_core_get_userlink($user_id), '<a href="' . get_blog_option( $blog->blog_id, 'siteurl' ) . '">' . get_blog_option( $blog->blog_id, 'blogname' ) . '</a>' ) . ' <span class="time-since">%s</span>'; -
trunk/bp-core.php
r469 r502 2 2 3 3 /* Define the current version number for checking if DB tables are up to date. */ 4 define( 'BP_CORE_VERSION', '0.2. 7' );4 define( 'BP_CORE_VERSION', '0.2.8' ); 5 5 6 6 /* Define the slug for member pages and the members directory (e.g. domain.com/[members] ) */ … … 74 74 global $current_userid; 75 75 global $action_variables; 76 76 77 77 /* The domain for the root of the site where the main blog resides */ 78 78 $bp['root_domain'] = bp_core_get_root_domain(); … … 155 155 user_id int(11) NOT NULL, 156 156 item_id int(11) NOT NULL, 157 secondary_item_id int(11), 157 158 component_name varchar(75) NOT NULL, 158 159 component_action varchar(75) NOT NULL, … … 161 162 PRIMARY KEY id (id), 162 163 KEY item_id (item_id), 164 KEY secondary_item_id (secondary_item_id), 163 165 KEY user_id (user_id), 164 166 KEY is_new (is_new), -
trunk/bp-core/bp-core-classes.php
r469 r502 190 190 class BP_Core_Notification { 191 191 var $id; 192 var $item_id; 193 var $secondary_item_id = null; 192 194 var $user_id; 193 195 var $component_name; … … 207 209 208 210 if ( $notification = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp['core']['table_name_notifications'] . " WHERE id = %d", $this->id ) ) ) { 211 $this->item_id = $notification->item_id; 212 $this->secondary_item_id = $notification->secondary_item_id; 209 213 $this->user_id = $notification->user_id; 210 214 $this->component_name = $notification->component_name; … … 220 224 if ( $this->id ) { 221 225 // Update 222 $sql = $wpdb->prepare( "UPDATE " . $bp['core']['table_name_notifications'] . " SET item_id = %d, user_id = %d, component_name = %s, component_action = %d, date_notified = FROM_UNIXTIME(%d), is_new = %d ) WHERE id = %d", $this->item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new, $this->id );226 $sql = $wpdb->prepare( "UPDATE " . $bp['core']['table_name_notifications'] . " SET item_id = %d, secondary_item_id = %d, user_id = %d, component_name = %s, component_action = %d, date_notified = FROM_UNIXTIME(%d), is_new = %d ) WHERE id = %d", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new, $this->id ); 223 227 } else { 224 228 // Save 225 $sql = $wpdb->prepare( "INSERT INTO " . $bp['core']['table_name_notifications'] . " ( item_id, user_id, component_name, component_action, date_notified, is_new ) VALUES ( %d, %d, %s, %s, FROM_UNIXTIME(%d), %d )", $this->item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new ); 226 } 227 228 return $wpdb->query( $sql ); 229 $sql = $wpdb->prepare( "INSERT INTO " . $bp['core']['table_name_notifications'] . " ( item_id, secondary_item_id, user_id, component_name, component_action, date_notified, is_new ) VALUES ( %d, %d, %d, %s, %s, FROM_UNIXTIME(%d), %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new ); 230 } 231 232 if ( !$result = $wpdb->query( $sql ) ) 233 return false; 234 235 $this->id = $wpdb->insert_id; 236 return true; 229 237 } 230 238 … … 259 267 } 260 268 261 function delete_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action ) { 262 global $wpdb, $bp; 263 264 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['core']['table_name_notifications'] . " WHERE user_id = %d AND item_id = %d AND component_name = %s AND component_action = %s", $user_id, $item_id, $component_name, $component_action ) ); 269 function delete_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id ) { 270 global $wpdb, $bp; 271 272 if ( $secondary_item_id ) 273 $secondary_item_sql = $wpdb->prepare( " AND secondary_item_id = %d", $secondary_item_id ); 274 275 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['core']['table_name_notifications'] . " WHERE user_id = %d AND item_id = %d AND component_name = %s AND component_action = %s{$secondary_item_sql}", $user_id, $item_id, $component_name, $component_action ) ); 265 276 } 266 277 -
trunk/bp-core/bp-core-cssjs.php
r436 r502 14 14 wp_enqueue_script( 'bp-general-js', site_url() . '/wp-content/mu-plugins/bp-core/js/general.js' ); 15 15 } 16 add_action( ' template_redirect', 'bp_core_add_js' );16 add_action( 'wp', 'bp_core_add_js' ); 17 17 18 18 /** -
trunk/bp-core/bp-core-notifications.php
r469 r502 1 1 <?php 2 2 3 function bp_core_add_notification( $item_id, $user_id, $component_name, $component_action, $ date_notified = false ) {3 function bp_core_add_notification( $item_id, $user_id, $component_name, $component_action, $secondary_item_id = false, $date_notified = false ) { 4 4 global $bp; 5 5 … … 14 14 $notification->date_notified = $date_notified; 15 15 $notification->is_new = 1; 16 16 17 if ( $secondary_item_id ) 18 $notification->secondary_item_id = $secondary_item_id; 19 17 20 if ( !$notification->save() ) 18 21 return false; … … 61 64 62 65 $item_id = ( $action_item_count == 1 ) ? $component_action_items[0]->item_id : false; 66 $secondary_item_id = ( $action_item_count == 1 ) ? $component_action_items[0]->secondary_item_id : false; 63 67 64 68 if ( function_exists( $component_name . '_format_notifications' ) ) { 65 $renderable[] = call_user_func( $component_name . '_format_notifications', $component_action_name, $item_id, $ action_item_count );69 $renderable[] = call_user_func( $component_name . '_format_notifications', $component_action_name, $item_id, $secondary_item_id, $action_item_count ); 66 70 } 67 71 } … … 71 75 } 72 76 73 function bp_core_delete_notifications_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action ) {74 return BP_Core_Notification::delete_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action );77 function bp_core_delete_notifications_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false ) { 78 return BP_Core_Notification::delete_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id ); 75 79 } 76 80 -
trunk/bp-core/bp-core-settings.php
r455 r502 124 124 <?php do_action( 'bp_notification_settings' ) ?> 125 125 126 <p ><input type="submit" name="submit" value="Save Changes" id="submit" class="auto" /></p>126 <p class="submit"><input type="submit" name="submit" value="Save Changes" id="submit" class="auto" /></p> 127 127 128 128 <?php wp_nonce_field('bp_settings_notifications') ?> -
trunk/bp-core/css/admin-bar.css
r497 r502 2 2 3 3 #wp-admin-bar { 4 position: absolute ;5 top: 0 ;6 left: 0 ;7 width: 100% ;8 z-index: 1001 ;9 height: 28px ;10 color: #fff ;11 text-align: left ;12 background:url(../images/admin_bar_back.gif) #818181 repeat-x ;4 position: absolute !important; 5 top: 0 !important; 6 left: 0 !important; 7 width: 100% !important; 8 z-index: 1001 !important; 9 height: 28px !important; 10 color: #fff !important; 11 text-align: left !important; 12 background:url(../images/admin_bar_back.gif) #818181 repeat-x !important; 13 13 } 14 #wp-admin-bar * { z-index: 999 ; }14 #wp-admin-bar * { z-index: 999 !important; } 15 15 16 16 #wp-admin-bar img#admin-bar-logo { 17 position: absolute ;17 position: absolute !important; 18 18 top: 8px; 19 19 left: 10px; … … 37 37 38 38 #wp-admin-bar ul { /* all lists */ 39 margin: 0 ;40 list-style: none ;41 line-height: 1 ;42 cursor: pointer ;43 height: 30px ;44 padding: 0 ;39 margin: 0 !important; 40 list-style: none !important; 41 line-height: 1 !important; 42 cursor: pointer !important; 43 height: 30px !important; 44 padding: 0 !important; 45 45 } 46 46 #wp-admin-bar ul { 47 margin-left: 80px ;47 margin-left: 80px !important; 48 48 } 49 49 #wp-admin-bar ul li { /* all list items */ 50 padding: 0 ;50 padding: 0 !important; 51 51 /*height: 30px;*/ 52 float: left ;52 float: left !important; 53 53 } 54 54 #wp-admin-bar ul li a { 55 display: block; 56 font-size: 1.1em; 55 display: block !important; 56 font-size: 1em !important; 57 font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Tahoma, Verdana, Arial, sans-serif !important; 57 58 text-decoration: none !important; 58 59 color: #fff !important; … … 60 61 61 62 #wp-admin-bar ul.main-nav li a:hover, #wp-admin-bar ul.main-nav li:hover { 62 background: #777 ;63 background: #777 !important; 63 64 color: #fff !important; 64 65 } … … 67 68 68 69 #wp-admin-bar ul li ul { 69 position: absolute ;70 width: 185px ;71 left: -999em ; /* using left instead of display to hide menus because display: none isn't read by screen readers */72 height: auto ;73 margin-left: 0 ;70 position: absolute !important; 71 width: 185px !important; 72 left: -999em !important; /* using left instead of display to hide menus because display: none isn't read by screen readers */ 73 height: auto !important; 74 margin-left: 0 !important; 74 75 } 75 76 #wp-admin-bar ul li ul li { 76 float: none ;77 margin: 0 ;78 border: none ;79 border-bottom: 1px solid #f4f4f4 ;77 float: none !important; 78 margin: 0 !important; 79 border: none !important; 80 border-bottom: 1px solid #f4f4f4 !important; 80 81 background: #f4f4f4 !important; 81 border-left: 1px solid #ccc; 82 border-right: 1px solid #ccc; 82 border-left: 1px solid #ccc !important; 83 border-right: 1px solid #ccc !important; 84 margin-bottom: -1px !important; 83 85 } 84 86 #wp-admin-bar ul li ul li.alt { 85 87 background: #fafafa !important; 86 border-bottom: 1px solid #fafafa ;88 border-bottom: 1px solid #fafafa !important; 87 89 } 88 90 89 91 #wp-admin-bar ul li ul li:last-child { 90 border-bottom: 1px solid #ccc ;91 -moz-border-radius-bottomleft: 4px ;92 -khtml-border-bottom-left-radius: 4px ;93 -webkit-border-bottom-left-radius: 4px ;94 border-bottom-left-radius: 4px ;95 -moz-border-radius-bottomright: 4px ;96 -khtml-border-bottom-right-radius: 4px ;97 -webkit-border-bottom-right-radius: 4px ;98 border-bottom-right-radius: 4px ;92 border-bottom: 1px solid #ccc !important; 93 -moz-border-radius-bottomleft: 4px !important; 94 -khtml-border-bottom-left-radius: 4px !important; 95 -webkit-border-bottom-left-radius: 4px !important; 96 border-bottom-left-radius: 4px !important; 97 -moz-border-radius-bottomright: 4px !important; 98 -khtml-border-bottom-right-radius: 4px !important; 99 -webkit-border-bottom-right-radius: 4px !important; 100 border-bottom-right-radius: 4px !important; 99 101 } 100 102 … … 104 106 105 107 #wp-admin-bar ul.main-nav li ul li a:hover { 106 background: #888 ;108 background: #888 !important; 107 109 } 108 110 109 111 #wp-admin-bar ul li div.admin-bar-clear { 110 clear: both ;112 clear: both !important; 111 113 background: #eee !important; 112 border-bottom: 3px solid #eee ;114 border-bottom: 3px solid #eee !important; 113 115 } 114 116 … … 116 118 117 119 #wp-admin-bar ul li ul ul { 118 margin: -28px 0 0 183px ;120 margin: -28px 0 0 183px !important; 119 121 } 120 122 121 123 #wp-admin-bar ul li:hover ul, #wp-admin-bar ul li li:hover ul, #wp-admin-bar ul li.sfhover ul, #wp-admin-bar ul li ul li.sfhover ul { /* lists nested under hovered list items */ 122 left: auto ;124 left: auto !important; 123 125 } 124 126 125 127 #wp-admin-bar ul li:hover ul ul, #wp-admin-bar li.sfhover ul li ul { 126 left: -999em ;128 left: -999em !important; 127 129 } 128 130 129 131 #wp-admin-bar ul.main-nav li ul li:hover { 130 background: #555 ;132 background: #555 !important; 131 133 } 132 134 133 135 #wp-admin-bar ul li ul li ul li:first-child { 134 border-top: 1px solid #ccc ;135 -moz-border-radius-topright: 4px ;136 -khtml-border-top-right-radius: 4px ;137 -webkit-border-top-right-radius: 4px ;138 border-top-right-radius: 4px ;136 border-top: 1px solid #ccc !important; 137 -moz-border-radius-topright: 4px !important; 138 -khtml-border-top-right-radius: 4px !important; 139 -webkit-border-top-right-radius: 4px !important; 140 border-top-right-radius: 4px !important; 139 141 } 140 142 … … 142 144 143 145 #wp-admin-bar img.avatar { 144 float: left ;145 border: 2px solid #fff !important ;146 margin-right: 8px ;146 float: left !important; 147 border: 2px solid #fff !important !important; 148 margin-right: 8px !important; 147 149 } 148 150 149 151 #wp-admin-bar span.activity { 150 display: block ;151 color: #888 ;152 margin-left: 34px ;152 display: block !important; 153 color: #888 !important; 154 margin-left: 34px !important; 153 155 font-size: 10px !important; 154 156 background: none !important; … … 158 160 159 161 #wp-admin-bar li a:hover span.activity { 160 color: #ccc ;162 color: #ccc !important; 161 163 } 162 164 163 165 #wp-admin-bar ul.author-list li { 164 height: 55px ;166 height: 55px !important; 165 167 } 166 168 167 169 #wp-admin-bar ul li#notifications_menu a span { 168 background: #fff ;169 padding: 0 6px ;170 color: #555 ;170 background: #fff !important; 171 padding: 0 6px !important; 172 color: #555 !important; 171 173 font-weight: bold !important; 172 174 font-size: 0.8em !important; 173 -moz-border-radius: 2px ;174 -khtml-border-radius: 2px ;175 -webkit-border-radius: 2px ;176 margin-left: 2px ;175 -moz-border-radius: 2px !important; 176 -khtml-border-radius: 2px !important; 177 -webkit-border-radius: 2px !important; 178 margin-left: 2px !important; 177 179 } -
trunk/bp-friends.php
r489 r502 230 230 } 231 231 232 function friends_format_notifications( $action, $item_id, $ total_items ) {232 function friends_format_notifications( $action, $item_id, $secondary_item_id, $total_items ) { 233 233 global $bp; 234 234 -
trunk/bp-groups.php
r489 r502 3 3 4 4 define ( 'BP_GROUPS_IS_INSTALLED', 1 ); 5 define ( 'BP_GROUPS_VERSION', '0. 1.4' );5 define ( 'BP_GROUPS_VERSION', '0.2.1' ); 6 6 7 7 include_once( 'bp-groups/bp-groups-classes.php' ); … … 52 52 user_title varchar(100) NOT NULL, 53 53 date_modified datetime NOT NULL, 54 comments longtext NOT NULL, 54 55 is_confirmed tinyint(1) NOT NULL DEFAULT '0', 55 56 PRIMARY KEY (id), … … 115 116 $bp['groups']['table_name_wire'] = $wpdb->base_prefix . 'bp_groups_wire'; 116 117 117 $bp['groups']['forbidden_names'] = array( 'my-groups', 'group-finder', 'create', 'invites', 'delete', 'add' );118 $bp['groups']['forbidden_names'] = array( 'my-groups', 'group-finder', 'create', 'invites', 'delete', 'add', 'admin', 'request-membership' ); 118 119 119 120 return $bp; … … 153 154 154 155 /* Is the logged in user a member of the group? */ 155 $is_member = ( BP_Groups_Member::check_is_member( $bp['loggedin_userid'], $group_obj->id ) ) ? true : false;156 $is_member = ( groups_is_user_member( $bp['loggedin_userid'], $group_obj->id ) ) ? true : false; 156 157 157 158 /* Should this group be visible to the logged in user? */ … … 201 202 202 203 bp_core_add_nav_default( $bp['groups']['slug'], 'groups_screen_group_home', 'home' ); 203 bp_core_add_subnav_item( $bp['groups']['slug'], 'home', __('Home', 'buddypress'), $group_link, 'groups_screen_group_home', 'group-home' , $is_visible);204 bp_core_add_subnav_item( $bp['groups']['slug'], 'home', __('Home', 'buddypress'), $group_link, 'groups_screen_group_home', 'group-home' ); 204 205 205 206 // If the user is a group administrator, then show the group admin nav item */ … … 207 208 bp_core_add_subnav_item( $bp['groups']['slug'], 'admin', __('Admin', 'buddypress'), $group_link , 'groups_screen_group_admin', 'group-admin', $bp['is_item_admin'] ); 208 209 210 // If this is a closed group, and the user is not a member, show a "Request Membership" nav item. 211 if ( $group_obj->status == 'private' && ( !groups_is_user_member( $bp['loggedin_userid'], $group_obj->id ) && !groups_check_for_membership_request( $bp['loggedin_userid'], $group_obj->id ) ) ) 212 bp_core_add_subnav_item( $bp['groups']['slug'], 'request-membership', __('Request Membership', 'buddypress'), $group_link , 'groups_screen_group_request_membership', 'request-membership' ); 213 209 214 bp_core_add_subnav_item( $bp['groups']['slug'], 'forum', __('Forum', 'buddypress'), $group_link , 'groups_screen_group_forum', 'group-forum', $is_visible); 210 215 … … 220 225 221 226 if ( is_user_logged_in() && groups_is_user_member( $bp['loggedin_userid'], $group_obj->id ) ) { 222 bp_core_add_subnav_item( $bp['groups']['slug'], 'send-invites', __('Send Invites', 'buddypress'), $group_link, 'groups_screen_group_invite', 'group-invite', $is_member ); 227 if ( function_exists('friends_install') ) 228 bp_core_add_subnav_item( $bp['groups']['slug'], 'send-invites', __('Send Invites', 'buddypress'), $group_link, 'groups_screen_group_invite', 'group-invite', $is_member ); 229 223 230 bp_core_add_subnav_item( $bp['groups']['slug'], 'leave-group', __('Leave Group', 'buddypress'), $group_link, 'groups_screen_group_leave', 'group-leave', $is_member ); 224 231 } … … 426 433 427 434 if ( $is_single_group ) { 428 if ( isset($bp['action_variables']) && $bp['action_variables'][ 1] == 'yes' ) {435 if ( isset($bp['action_variables']) && $bp['action_variables'][0] == 'yes' ) { 429 436 // remove the user from the group. 430 437 if ( !groups_leave_group( $group_obj->id ) ) { … … 440 447 bp_catch_uri( 'groups/group-home' ); 441 448 442 } else if ( isset($bp['action_variables']) && $bp['action_variables'][ 1] == 'no' ) {449 } else if ( isset($bp['action_variables']) && $bp['action_variables'][0] == 'no' ) { 443 450 bp_catch_uri( 'groups/group-home' ); 444 451 } else { … … 446 453 bp_catch_uri( 'groups/leave-group-confirm' ); 447 454 } 455 } 456 } 457 458 function groups_screen_group_request_membership() { 459 global $bp, $group_obj; 460 461 if ( $group_obj->status == 'private' ) { 462 463 // If the user has submitted a request, send it. 464 if ( isset( $_POST['group-request-send']) ) { 465 if ( !groups_send_membership_request( $bp['loggedin_userid'], $group_obj->id ) ) { 466 $bp['message'] = __( 'There was an error sending your group membership request, please try again.', 'buddypress' ); 467 $bp['message_type'] = 'error'; 468 } else { 469 $bp['message'] = __( 'Your membership request was sent to the group administrator successfully. You will be notified when the group administrator responds to your request.', 'buddypress' ); 470 $bp['message_type'] = 'success'; 471 } 472 add_action( 'template_notices', 'bp_core_render_notice' ); 473 474 } 475 bp_catch_uri( 'groups/request-membership' ); 448 476 } 449 477 } … … 512 540 } 513 541 add_action( 'wp', 'groups_screen_group_admin_settings', 3 ); 542 543 544 function groups_screen_group_admin_requests() { 545 global $bp; 546 547 if ( $bp['current_component'] == $bp['groups']['slug'] && $bp['action_variables'][0] == 'membership-requests' ) { 548 549 if ( !$bp['is_item_admin'] ) 550 return false; 551 552 // Remove any screen notifications 553 bp_core_delete_notifications_for_user_by_type( $bp['loggedin_userid'], 'groups', 'new_membership_request' ); 554 555 $request_action = $bp['action_variables'][1]; 556 $membership_id = $bp['action_variables'][2]; 557 558 if ( isset($request_action) && isset($membership_id) ) { 559 if ( $request_action == 'accept' && is_numeric($membership_id) ) { 560 // Accept the membership request 561 if ( !groups_accept_membership_request( $membership_id ) ) { 562 $bp['message'] = __( 'There was an error accepting the membership request, please try again.', 'buddypress' ); 563 $bp['message_type'] = 'error'; 564 } else { 565 $bp['message'] = __( 'Group membership request accepted', 'buddypress' ); 566 $bp['message_type'] = 'success'; 567 } 568 } else if ( $request_action == 'reject' && is_numeric($membership_id) ) { 569 // Reject the membership request 570 if ( !groups_reject_membership_request( $membership_id ) ) { 571 $bp['message'] = __( 'There was an error rejecting the membership request, please try again.', 'buddypress' ); 572 $bp['message_type'] = 'error'; 573 } else { 574 $bp['message'] = __( 'Group membership request rejected', 'buddypress' ); 575 $bp['message_type'] = 'success'; 576 } 577 } 578 add_action( 'template_notices', 'bp_core_render_notice' ); 579 } 580 581 bp_catch_uri( 'groups/admin/membership-requests' ); 582 } 583 } 584 add_action( 'wp', 'groups_screen_group_admin_requests', 3 ); 514 585 515 586 … … 571 642 572 643 // user wants to join a group 573 if ( ! BP_Groups_Member::check_is_member( $bp['loggedin_userid'], $group_obj->id ) ) {644 if ( !groups_is_user_member( $bp['loggedin_userid'], $group_obj->id ) ) { 574 645 if ( !groups_join_group($group_obj->id) ) { 575 646 $bp['message'] = __('There was an error joining the group. Please try again.', 'buddypress'); … … 598 669 if ( function_exists('bp_activity_record') ) { 599 670 extract($args); 600 bp_activity_record( $item_id, $component_name, $component_action, $is_private ); 671 672 if ( !isset($group_id) ) 673 $group_id = $item_id; 674 675 $group = new BP_Groups_Group( $group_id, false, false ); 676 677 if ( $group->status == 'public' ) 678 bp_activity_record( $item_id, $component_name, $component_action, $is_private ); 601 679 } 602 680 } … … 649 727 } 650 728 729 function groups_format_notifications( $action, $item_id, $secondary_item_id, $total_items ) { 730 global $bp; 731 732 switch ( $action ) { 733 case 'new_membership_request': 734 $group_id = $secondary_item_id; 735 $requesting_user_id = $item_id; 736 737 $group = new BP_Groups_Group( $group_id, false, false ); 738 739 if ( (int)$total_items > 1 ) { 740 return '<a href="' . bp_group_permalink( $group, false ) . '/admin/membership-requests/" title="' . __( 'Group Membership Requests', 'buddypress' ) . '">' . sprintf( __('%d new membership requests for the group "%s"'), (int)$total_items, $group->name ) . '</a>'; 741 } else { 742 $user_fullname = bp_core_global_user_fullname( $requesting_user_id ); 743 $user_url = bp_core_get_userurl( $requesting_user_id ); 744 return '<a href="' . bp_group_permalink( $group, false ) . '/admin/membership-requests/" title="' . $user_fullname .' requests group membership">' . sprintf( __('%s requests membership for the group "%s"'), $user_fullname, $group->name ) . '</a>'; 745 } 746 break; 747 } 748 749 return false; 750 } 751 651 752 /************************************************************************** 652 753 groups_update_last_activity() … … 672 773 **************************************************************************/ 673 774 674 function groups_get_user_groups( $pag_ page, $pag_num) {775 function groups_get_user_groups( $pag_num, $pag_page ) { 675 776 global $bp; 676 777 … … 760 861 } 761 862 863 864 function groups_search_groups( $search_terms, $pag_num_per_page = 5, $pag_page = 1 ) { 865 return BP_Groups_Group::search_groups( $search_terms, $pag_num_per_page, $pag_page ); 866 } 867 868 function groups_filter_user_groups( $filter, $pag_num_per_page = 5, $pag_page = 1 ) { 869 return BP_Groups_Group::filter_user_groups( $filter, $pag_num_per_page, $pag_page ); 870 } 762 871 763 872 /************************************************************************** … … 986 1095 } 987 1096 988 function groups_leave_group( $group_id ) { 989 global $bp; 990 1097 function groups_check_group_exists( $group_id ) { 1098 return BP_Groups_Group::group_exists( $group_id ); 1099 } 1100 1101 function groups_leave_group( $group_id, $user_id = false ) { 1102 global $bp; 1103 1104 if ( !$user_id ) 1105 $user_id = $bp['loggedin_userid']; 1106 991 1107 // This is exactly the same as deleting and invite, just is_confirmed = 1 NOT 0. 992 if ( !groups_uninvite_user( $ bp['loggedin_userid'], $group_id ) )1108 if ( !groups_uninvite_user( $user_id, $group_id ) ) 993 1109 return false; 994 1110 … … 1001 1117 } 1002 1118 1003 function groups_join_group( $group_id ) { 1004 global $bp; 1119 function groups_join_group( $group_id, $user_id = false ) { 1120 global $bp; 1121 1122 if ( !$user_id ) 1123 $user_id = $bp['loggedin_userid']; 1005 1124 1006 1125 $new_member = new BP_Groups_Member; 1007 1126 $new_member->group_id = $group_id; 1008 $new_member->user_id = $ bp['loggedin_userid'];1127 $new_member->user_id = $user_id; 1009 1128 $new_member->inviter_id = 0; 1010 1129 $new_member->is_admin = 0; … … 1028 1147 } 1029 1148 1149 function groups_get_group_admin( $group_id ) { 1150 return BP_Groups_Member::get_group_administrator_id( $group_id ); 1151 } 1152 1030 1153 function groups_new_wire_post( $group_id, $content ) { 1031 1154 if ( $wire_post_id = bp_wire_new_post( $group_id, $content ) ) { 1032 1155 1033 1156 /* activity stream recording action */ 1034 do_action( 'activity_groups_new_wire_post', array( 'item_id' => $wire_post_id, ' component_name' => 'groups', 'component_action' => 'new_wire_post', 'is_private' => 0 ) );1157 do_action( 'activity_groups_new_wire_post', array( 'item_id' => $wire_post_id, 'group_id' => $group_id, 'component_name' => 'groups', 'component_action' => 'new_wire_post', 'is_private' => 0 ) ); 1035 1158 1036 1159 /* regular action */ … … 1068 1191 if ( $notify_members ) 1069 1192 groups_notification_group_updated( $group->id ); 1193 1194 do_action( 'bp_groups_details_updated', $group->id ); 1070 1195 1071 1196 return true; … … 1085 1210 return false; 1086 1211 1212 do_action( 'bp_groups_settings_updated', $group->id ); 1213 1087 1214 return true; 1215 } 1216 1217 function groups_send_membership_request( $requesting_user_id, $group_id ) { 1218 global $bp; 1219 1220 $requesting_user = new BP_Groups_Member; 1221 $requesting_user->group_id = $group_id; 1222 $requesting_user->user_id = $requesting_user_id; 1223 $requesting_user->inviter_id = 0; 1224 $requesting_user->is_admin = 0; 1225 $requesting_user->user_title = ''; 1226 $requesting_user->date_modified = time(); 1227 $requesting_user->is_confirmed = 0; 1228 $requesting_user->comments = $_POST['group-request-membership-comments']; 1229 1230 if ( $requesting_user->save() ) { 1231 $admin = groups_get_group_admin( $group_id ); 1232 1233 // Saved okay, now send the email notification 1234 groups_notification_new_membership_request( $requesting_user_id, $admin->user_id, $group_id, $requesting_user->id ); 1235 1236 do_action( 'bp_groups_group_membership_requested', $requesting_user_id, $admin->user_id, $group_id, $requesting_user->id ); 1237 1238 return true; 1239 } 1240 1241 return false; 1242 } 1243 1244 function groups_accept_membership_request( $membership_id ) { 1245 $membership = new BP_Groups_Member( false, false, $membership_id ); 1246 $membership->accept_request(); 1247 1248 if ( !$membership->save() ) 1249 return false; 1250 1251 return true; 1252 } 1253 1254 function groups_reject_membership_request( $membership_id ) { 1255 $membership = new BP_Groups_Member( false, false, $membership_id ); 1256 1257 if ( !BP_Groups_Member::delete( $membership->user_id, $membership->group_id ) ) 1258 return false; 1259 1260 return true; 1261 } 1262 1263 function groups_check_for_membership_request( $user_id, $group_id ) { 1264 return BP_Groups_Member::check_for_membership_request( $user_id, $group_id ); 1088 1265 } 1089 1266 -
trunk/bp-groups/bp-groups-ajax.php
r463 r502 40 40 add_action( 'wp_ajax_groups_invite_user', 'groups_ajax_invite_user' ); 41 41 42 function groups_ajax_group_ search() {42 function groups_ajax_group_filter() { 43 43 global $bp; 44 44 45 check_ajax_referer('group_search'); 46 47 $pag_page = isset( $_POST['fpage'] ) ? intval( $_POST['fpage'] ) : 1; 48 $pag_num = isset( $_POST['num'] ) ? intval( $_POST['num'] ) : 5; 49 $total_group_count = 0; 50 51 if ( $_POST['group-search-box'] == "" ) { 52 $groups = groups_get_user_groups( $pag_page, $pag_num ); 53 } else { 54 $groups = BP_Groups_Group::search_user_groups( $_POST['group-search-box'], $pag_num, $pag_page ); 55 } 45 check_ajax_referer('group-filter-box'); 56 46 57 $total_group_count = (int)$groups['count']; 58 59 if ( $total_group_count ) { 60 $pag_links = paginate_links( array( 61 'base' => $bp['current_domain'] . $bp['groups']['slug'] . add_query_arg( 'mpage', '%#%' ), 62 'format' => '', 63 'total' => ceil($total_group_count / $pag_num), 64 'current' => $pag_page, 65 'prev_text' => '«', 66 'next_text' => '»', 67 'mid_size' => 1 68 )); 69 } 70 71 if ( $groups['groups'] ) { 72 echo '0[[SPLIT]]'; // return valid result. 73 74 for ( $i = 0; $i < count($groups['groups']); $i++ ) { 75 $group = $groups['groups'][$i]; 76 ?> 77 <li> 78 <img class="avatar" alt="Group Avatar" src="<?php echo $group->avatar_thumb ?>"/> 79 <h4> 80 <a href="<?php bp_group_permalink( $group ) ?>"><?php echo $group->name ?></a> 81 <span class="small"> - <?php echo $group->total_member_count . ' ' . __('members', 'buddypress') ?></span> 82 </h4> 83 <p class="desc"><?php echo bp_create_excerpt( $group->description, 20 ) ?></p> 84 </li> 85 <?php 86 } 87 echo '[[SPLIT]]' . $pag_links; 88 } else { 89 $result['message'] = '<img src="' . $bp['groups']['image_base'] . '/warning.gif" alt="Warning" /> ' . $result['message']; 90 echo "-1[[SPLIT]]" . __("No groups matched your search.", 'buddypress'); 91 } 47 load_template( get_template_directory() . '/groups/group-loop.php' ); 92 48 } 93 add_action( 'wp_ajax_group_ search', 'groups_ajax_group_search' );49 add_action( 'wp_ajax_group_filter', 'groups_ajax_group_filter' ); 94 50 95 51 function groups_ajax_group_finder_search() { 96 52 global $bp; 97 53 98 check_ajax_referer('groupfinder _search');54 check_ajax_referer('groupfinder-search-box'); 99 55 100 $pag_page = isset( $_POST['fpage'] ) ? intval( $_POST['fpage'] ) : 1; 101 $pag_num = isset( $_POST['num'] ) ? intval( $_POST['num'] ) : 5; 102 $total_group_count = 0; 103 104 if ( $_POST['groupfinder-search-box'] != "" ) { 105 $groups = BP_Groups_Group::search_groups( $_POST['groupfinder-search-box'], $pag_num, $pag_page ); 106 } 107 108 $total_group_count = (int)$groups['count']; 109 110 if ( $total_group_count ) { 111 $pag_links = paginate_links( array( 112 'base' => $bp['current_domain'] . $bp['groups']['slug'] . add_query_arg( 'mpage', '%#%' ), 113 'format' => '', 114 'total' => ceil($total_group_count / $pag_num), 115 'current' => $pag_page, 116 'prev_text' => '«', 117 'next_text' => '»', 118 'mid_size' => 1 119 )); 120 } 121 122 if ( $groups['groups'] ) { 123 echo '0[[SPLIT]]'; // return valid result. 124 125 for ( $i = 0; $i < count($groups['groups']); $i++ ) { 126 $group = $groups['groups'][$i]; 127 ?> 128 <li> 129 <img class="avatar" alt="Group Avatar" src="<?php echo $group->avatar_thumb ?>"/> 130 <h4> 131 <a href="<?php bp_group_permalink( $group ) ?>"><?php echo $group->name ?></a> 132 <span class="small"> - <?php echo $group->total_member_count . ' ' . __('members', 'buddypress') ?></span> 133 </h4> 134 <p class="desc"><?php echo bp_create_excerpt( $group->description, 20 ) ?></p> 135 </li> 136 <?php 137 } 138 echo '[[SPLIT]]' . $pag_links; 139 } else { 140 $result['message'] = '<img src="' . $bp['groups']['image_base'] . '/warning.gif" alt="Warning" /> ' . $result['message']; 141 echo "-1[[SPLIT]]" . __("No groups matched your search.", 'buddypress'); 142 } 56 load_template( get_template_directory() . '/groups/group-loop.php' ); 143 57 } 144 58 add_action( 'wp_ajax_group_finder_search', 'groups_ajax_group_finder_search' ); -
trunk/bp-groups/bp-groups-classes.php
r482 r502 46 46 if ( $group ) { 47 47 $this->creator_id = $group->creator_id; 48 $this->name = $group->name;48 $this->name = stripslashes($group->name); 49 49 $this->slug = $group->slug; 50 $this->description = $group->description;51 $this->news = $group->news;50 $this->description = stripslashes($group->description); 51 $this->news = stripslashes($group->news); 52 52 $this->status = $group->status; 53 53 $this->is_invitation_only = $group->is_invitation_only; … … 165 165 } 166 166 167 $result = $wpdb->query($sql); 168 169 if ( $wpdb->insert_id ) 170 $this->id = $wpdb->insert_id; 171 172 return $result; 167 if ( !$result = $wpdb->query($sql) ) 168 return false; 169 170 $this->id = $wpdb->insert_id; 171 return true; 173 172 } 174 173 … … 217 216 218 217 } 218 219 function is_member() { 220 global $bp; 221 222 for ( $i = 0; $i < count($this->user_dataset); $i++ ) { 223 if ( $this->user_dataset[$i]->user_id == $bp['loggedin_userid'] ) { 224 return true; 225 } 226 } 227 228 return false; 229 } 219 230 220 231 /* Static Functions */ … … 253 264 } 254 265 255 function search_user_groups( $filter, $limit = null, $page = null ) {266 function filter_user_groups( $filter, $limit = null, $page = null ) { 256 267 global $wpdb, $bp; 257 268 … … 262 273 263 274 // Get all the group ids for the current user's groups. 264 $gids = BP_Groups_Member::get_group_ids( $ user_id);275 $gids = BP_Groups_Member::get_group_ids( $bp['current_userid'], false, false, false ); 265 276 $gids = implode( ',', $gids['ids'] ); 266 277 … … 286 297 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 287 298 288 $sql = $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name'] . " WHERE name LIKE '$filter%%' OR description LIKE '$filter%%'$pag_sql" );289 $count_sql = $wpdb->prepare( "SELECT count(id) FROM " . $bp['groups']['table_name'] . " WHERE name LIKE '$filter%%' OR description LIKE '$filter%%'" );299 $sql = $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name'] . " WHERE status != 'hidden' AND name LIKE '$filter%%' OR description LIKE '$filter%%'$pag_sql" ); 300 $count_sql = $wpdb->prepare( "SELECT count(id) FROM " . $bp['groups']['table_name'] . " WHERE status != 'hidden' AND name LIKE '$filter%%' OR description LIKE '$filter%%'" ); 290 301 291 302 $group_ids = $wpdb->get_col($sql); 292 303 $total_groups = $wpdb->get_var($count_sql); 293 304 294 305 for ( $i = 0; $i < count($group_ids); $i++ ) { 295 306 $groups[] = new BP_Groups_Group( (int)$group_ids[$i] ); … … 315 326 316 327 $members = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['groups']['table_name_members'] . " WHERE group_id = %d", $group_id ) ); 317 318 if ( $members < 1)328 329 if ( !$members ) 319 330 return false; 320 331 321 332 return true; 333 } 334 335 function has_membership_requests( $group_id ) { 336 global $wpdb, $bp; 337 338 return $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['groups']['table_name_members'] . " WHERE group_id = %d AND is_confirmed = 0", $group_id ) ); 339 } 340 341 function get_membership_requests( $group_id, $limit = null, $page = null ) { 342 global $wpdb, $bp; 343 344 if ( $limit && $page ) 345 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 346 347 return $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp['groups']['table_name_members'] . " WHERE group_id = %d AND is_confirmed = 0{$pag_sql}", $group_id ) ); 322 348 } 323 349 … … 328 354 $limit = 5; 329 355 330 return $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM " . $bp['groups']['table_name'] . " ORDER BY date_created DESC LIMIT %d", $limit ) );356 return $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM " . $bp['groups']['table_name'] . " WHERE status != 'hidden' ORDER BY date_created DESC LIMIT %d", $limit ) ); 331 357 } 332 358 … … 337 363 $limit = 5; 338 364 339 return $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM " . $bp['groups']['table_name_groupmeta'] . " WHEREmeta_key = 'last_activity' ORDER BY CONVERT(meta_value, SIGNED) DESC LIMIT %d", $limit ) );365 return $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM " . $bp['groups']['table_name_groupmeta'] . " gm, " . $bp['groups']['table_name'] . " g WHERE g.id = gm.group_id AND g.status != 'hidden' AND meta_key = 'last_activity' ORDER BY CONVERT(meta_value, SIGNED) DESC LIMIT %d", $limit ) ); 340 366 } 341 367 … … 346 372 $limit = 5; 347 373 348 return $wpdb->get_results( $wpdb->prepare( "SELECT g roup_id FROM " . $bp['groups']['table_name_groupmeta'] . " WHEREmeta_key = 'total_member_count' ORDER BY CONVERT(meta_value, SIGNED) DESC LIMIT %d", $limit ) );374 return $wpdb->get_results( $wpdb->prepare( "SELECT gm.group_id FROM " . $bp['groups']['table_name_groupmeta'] . " gm, " . $bp['groups']['table_name'] . " g WHERE g.id = gm.group_id AND g.status != 'hidden' AND meta_key = 'total_member_count' ORDER BY CONVERT(meta_value, SIGNED) DESC LIMIT %d", $limit ) ); 349 375 } 350 376 } … … 359 385 var $date_modified; 360 386 var $is_confirmed; 387 var $comments; 361 388 362 389 var $user; 363 390 364 function bp_groups_member( $user_id = null, $group_id = null, $populate = true ) {365 if ( $user_id && $group_id ) {391 function bp_groups_member( $user_id = false, $group_id = false, $id = false, $populate = true ) { 392 if ( $user_id && $group_id && !$id ) { 366 393 $this->user_id = $user_id; 367 394 $this->group_id = $group_id; … … 370 397 $this->populate(); 371 398 } 399 400 if ( $id ) { 401 $this->id = $id; 402 403 if ( $populate ) 404 $this->populate(); 405 } 372 406 } 373 407 374 408 function populate() { 375 409 global $wpdb, $bp; 376 377 $sql = $wpdb->prepare( "SELECT * FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND group_id = %d", $this->user_id, $this->group_id ); 410 411 if ( $this->user_id && $this->group_id && !$this->id ) 412 $sql = $wpdb->prepare( "SELECT * FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND group_id = %d", $this->user_id, $this->group_id ); 413 414 if ( $this->id ) 415 $sql = $wpdb->prepare( "SELECT * FROM " . $bp['groups']['table_name_members'] . " WHERE id = %d", $this->id ); 416 378 417 $member = $wpdb->get_row($sql); 379 418 380 419 if ( $member ) { 381 420 $this->id = $member->id; 421 $this->group_id = $member->group_id; 422 $this->user_id = $member->user_id; 382 423 $this->inviter_id = $member->inviter_id; 383 424 $this->is_admin = $member->is_admin; … … 385 426 $this->date_modified = $member->date_modified; 386 427 $this->is_confirmed = $member->is_confirmed; 428 $this->comments = $member->comments; 387 429 388 430 $this->user = new BP_Core_User( $this->user_id ); … … 394 436 395 437 if ( $this->id ) { 396 $sql = $wpdb->prepare( "UPDATE " . $bp['groups']['table_name_members'] . " SET inviter_id = %d, is_admin = %d, user_title = %s, date_modified = FROM_UNIXTIME(%d), is_confirmed = %d WHERE id = %d", $this->inviter_id, $this->is_admin, $this->user_title, $this->date_modified, $this->is_confirmed, $this->id );438 $sql = $wpdb->prepare( "UPDATE " . $bp['groups']['table_name_members'] . " SET inviter_id = %d, is_admin = %d, user_title = %s, date_modified = FROM_UNIXTIME(%d), is_confirmed = %d, comments = %s WHERE id = %d", $this->inviter_id, $this->is_admin, $this->user_title, $this->date_modified, $this->is_confirmed, $this->comments, $this->id ); 397 439 398 440 } else { 399 $sql = $wpdb->prepare( "INSERT INTO " . $bp['groups']['table_name_members'] . " ( user_id, group_id, inviter_id, is_admin, user_title, date_modified, is_confirmed ) VALUES ( %d, %d, %d, %d, %s, FROM_UNIXTIME(%d), %d )", $this->user_id, $this->group_id, $this->inviter_id, $this->is_admin, $this->user_title, $this->date_modified, $this->is_confirmed);400 } 401 402 if ( !$ result = $wpdb->query($sql) )441 $sql = $wpdb->prepare( "INSERT INTO " . $bp['groups']['table_name_members'] . " ( user_id, group_id, inviter_id, is_admin, user_title, date_modified, is_confirmed, comments ) VALUES ( %d, %d, %d, %d, %s, FROM_UNIXTIME(%d), %d, %s )", $this->user_id, $this->group_id, $this->inviter_id, $this->is_admin, $this->user_title, $this->date_modified, $this->is_confirmed, $this->comments ); 442 } 443 444 if ( !$wpdb->query($sql) ) 403 445 return false; 404 446 447 $this->id = $wpdb->insert_id; 405 448 return true; 406 449 } … … 418 461 $this->date_modified = time(); 419 462 } 463 464 function accept_request() { 465 $this->is_confirmed = 1; 466 $this->date_modified = time(); 467 } 420 468 421 469 /* Static Functions */ … … 434 482 } 435 483 436 function get_group_ids( $user_id, $page = false, $limit = false ) {484 function get_group_ids( $user_id, $page = false, $limit = false, $get_total = true ) { 437 485 global $wpdb, $bp; 438 486 439 487 if ( $limit && $page ) 440 488 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 441 442 $group_ids = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT group_id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND is_confirmed = 1$pag_sql", $user_id ) ); 443 $group_count = BP_Groups_Member::total_group_count( $user_id ); 489 490 // If the user is logged in and viewing their own groups, we can show hidden and closed groups 491 if ( bp_is_home() ) { 492 $group_ids = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT group_id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d $pag_sql", $user_id ) ); 493 } else { 494 $group_ids = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . " g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d$pag_sql", $user_id ) ); 495 } 496 497 if ( $get_total ) 498 $group_count = BP_Groups_Member::total_group_count( $user_id ); 444 499 445 500 return array( 'ids' => $group_ids, 'count' => $group_count ); … … 452 507 $user_id = $bp['current_userid']; 453 508 454 return $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND is_confirmed = 1", $user_id ) ); 509 if ( bp_is_home() ) { 510 return $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND is_confirmed = 1", $user_id ) ); 511 } else { 512 return $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . " g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.is_confirmed = 1", $user_id ) ); 513 } 455 514 } 456 515 … … 479 538 } 480 539 540 function check_for_membership_request( $user_id, $group_id ) { 541 global $wpdb, $bp; 542 543 return $wpdb->query( $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND group_id = %d AND is_confirmed = 0", $user_id, $group_id ) ); 544 } 545 481 546 function get_random_groups( $user_id, $total_groups = 5 ) { 482 547 global $wpdb, $bp; 483 484 return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT group_id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND is_confirmed = 1 ORDER BY rand() LIMIT $total_groups", $user_id ) ); 548 549 // If the user is logged in and viewing their random groups, we can show hidden and closed groups 550 if ( bp_is_home() ) { 551 return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT group_id FROM " . $bp['groups']['table_name_members'] . " WHERE user_id = %d AND is_confirmed = 1 ORDER BY rand() LIMIT $total_groups", $user_id ) ); 552 } else { 553 return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . " g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.is_confirmed = 1 ORDER BY rand() LIMIT $total_groups", $user_id ) ); 554 } 555 } 556 557 function get_group_administrator_id( $group_id ) { 558 global $bp, $wpdb; 559 560 return $wpdb->get_row( $wpdb->prepare( "SELECT user_id FROM " . $bp['groups']['table_name_members'] . " WHERE group_id = %d AND is_admin = 1", $group_id ) ); 485 561 } 486 562 -
trunk/bp-groups/bp-groups-notifications.php
r494 r502 85 85 } 86 86 87 function groups_notification_new_membership_request( $requesting_user_id, $admin_id, $group_id, $membership_id ) { 88 global $bp, $current_user; 89 90 bp_core_add_notification( $requesting_user_id, $admin_id, 'groups', 'new_membership_request', $group_id ); 91 92 if ( get_usermeta( $admin_id, 'notification_new_membership_request' ) == 'no' ) 93 return false; 94 95 $requesting_user_name = bp_fetch_user_fullname( $requesting_user_id, false ); 96 $group = new BP_Groups_Group( $group_id, false, false ); 97 98 $ud = get_userdata($admin_id); 99 $requesting_ud = get_userdata($requesting_user_id); 100 101 $group_request_accept = bp_group_permalink( $group, false ) . '/admin/membership-requests/accept/' . $membership_id; 102 $group_request_reject = bp_group_permalink( $group, false ) . '/admin/membership-requests/reject/' . $membership_id; 103 $profile_link = site_url() . '/' . MEMBERS_SLUG . '/' . $requesting_ud->user_login . '/profile'; 104 $settings_link = site_url() . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/settings/notifications'; 105 106 // Set up and send the message 107 $to = $ud->user_email; 108 $subject = sprintf( __( 'Membership request for group: %s', 'buddypress' ), stripslashes($group->name) ); 109 110 $message = sprintf( __( 111 '%s wants to join the group "%s". 112 113 Because you are the administrator of this group, you must either accept or reject the membership request. 114 115 To accept the membership request: %s 116 To reject the membership request: %s 117 To view %s\'s profile: %s 118 119 --------------------- 120 ', 'buddypress' ), $requesting_user_name, stripslashes($group->name), $group_request_accept, $group_request_reject, $requesting_user_name, $profile_link ); 121 122 $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link ); 123 124 // Send it 125 wp_mail( $to, $subject, $message ); 126 } 127 87 128 ?> -
trunk/bp-groups/bp-groups-templatetags.php
r484 r502 16 16 function bp_groups_template( $user_id = null, $group_slug = null ) { 17 17 global $bp; 18 19 $this->pag_page = isset( $_ GET['fpage'] ) ? intval( $_GET['fpage'] ) : 1;20 $this->pag_num = isset( $_ GET['num'] ) ? intval( $_GET['num'] ) : 5;21 22 if ( $bp['current_action'] == 'my-groups'|| !$bp['current_action'] ) {23 24 $this->groups = groups_get_user_groups( $this->pag_ page, $this->pag_num);18 19 $this->pag_page = isset( $_REQUEST['fpage'] ) ? intval( $_REQUEST['fpage'] ) : 1; 20 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : 5; 21 22 if ( ( $bp['current_action'] == 'my-groups' && $_REQUEST['group-filter-box'] == '' ) || !$bp['current_action'] ) { 23 24 $this->groups = groups_get_user_groups( $this->pag_num, $this->pag_page ); 25 25 $this->total_group_count = (int)$this->groups['count']; 26 26 $this->groups = $this->groups['groups']; 27 27 $this->group_count = count($this->groups); 28 28 29 } else if ( $bp['current_action'] == 'my-groups' && $_REQUEST['group-filter-box'] != '' ) { 30 31 $this->groups = groups_filter_user_groups( $_REQUEST['group-filter-box'], $this->pag_num, $this->pag_page ); 32 $this->total_group_count = (int)$this->groups['count']; 33 $this->groups = $this->groups['groups']; 34 $this->group_count = count($this->groups); 35 36 } else if ( $bp['current_action'] == 'group-finder' && $_REQUEST['groupfinder-search-box'] != '' ) { 37 38 $this->groups = groups_search_groups( $_REQUEST['groupfinder-search-box'], $this->pag_num, $this->pag_page ); 39 $this->total_group_count = (int)$this->groups['count']; 40 $this->groups = $this->groups['groups']; 41 $this->group_count = count($this->groups); 42 29 43 } else if ( $bp['current_action'] == 'invites' ) { 30 44 … … 121 135 } 122 136 137 function bp_group_is_visible() { 138 global $bp, $groups_template; 139 140 if ( $groups_template->group->status == 'public' ) { 141 return true; 142 } else { 143 if ( groups_is_user_member( $bp['loggedin_userid'], $groups_template->group->id ) ) { 144 return true; 145 } 146 } 147 148 return false; 149 } 150 123 151 function bp_group_id( $echo = true ) { 124 152 global $groups_template; … … 235 263 } 236 264 237 function bp_group_invitation_status() {238 global $groups_template;239 240 if ( $groups_template->group->is_invitation_only ) {241 _e('Invitation Only', 'buddypress');242 } else {243 _e('Open', 'buddypress');244 }245 }246 function bp_group_is_invitation_only() {247 global $groups_template;248 return $groups_template->group->is_invitation_only;249 }250 265 251 266 function bp_group_date_created() { … … 301 316 $action = $bp['loggedin_domain'] . $bp['groups']['slug'] . '/my-groups/search/'; 302 317 $label = __('Filter Groups', 'buddypress'); 303 $ type = 'group';318 $name = 'group-filter-box'; 304 319 } else { 305 320 $action = $bp['loggedin_domain'] . $bp['groups']['slug'] . '/group-finder/search/'; 306 321 $label = __('Find a Group', 'buddypress'); 307 $type = 'groupfinder'; 308 $value = $bp['action_variables'][1]; 309 } 310 311 if ( !$groups_template->group_count && $bp['current_action'] != 'group-finder' ) { 312 $disabled = ' disabled="disabled"'; 322 $name = 'groupfinder-search-box'; 323 $value = $bp['action_variables'][0]; 313 324 } 314 325 ?> 315 326 <form action="<?php echo $action ?>" id="group-search-form" method="post"> 316 <label for="<?php echo $ type ?>-search-box" id="<?php echo $type ?>-search-label"><?php echo $label ?> <img id="ajax-loader" src="<?php echo $bp['groups']['image_base'] ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></label>317 <input type="search" name="<?php echo $ type ?>-search-box" id="<?php echo $type ?>-search-box" value="<?php echo $value ?>"<?php echo $disabled ?> />327 <label for="<?php echo $name ?>" id="<?php echo $name ?>-label"><?php echo $label ?> <img id="ajax-loader" src="<?php echo $bp['groups']['image_base'] ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></label> 328 <input type="search" name="<?php echo $name ?>" id="<?php echo $name ?>" value="<?php echo $value ?>"<?php echo $disabled ?> /> 318 329 <?php if ( function_exists('wp_nonce_field') ) 319 wp_nonce_field( $ type . '_search');330 wp_nonce_field( $name ); 320 331 ?> 321 332 </form> 322 333 <?php 334 } 335 336 function bp_group_show_no_groups_message() { 337 global $bp; 338 339 if ( $bp['current_action'] == 'group-finder' ) 340 return false; 341 342 return true; 323 343 } 324 344 … … 396 416 <!--<li<?php if ( $current_tab == 'manage-members' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['root_domain'] . '/' . $bp['groups']['slug'] ?>/<?php echo $groups_template->group->slug ?>/admin/manage-members"><?php _e('Manage Members', 'buddypress') ?></a></li>--> 397 417 <!--<li<?php if ( $current_tab == 'delete-group' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['root_domain'] . '/' . $bp['groups']['slug'] ?>/<?php echo $groups_template->group->slug ?>/admin/delete-group"><?php _e('Delete Group', 'buddypress') ?></a></li>--> 418 <?php if ( $groups_template->group->status == 'private' ) : ?> 419 <li<?php if ( $current_tab == 'membership-requests' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['root_domain'] . '/' . $bp['groups']['slug'] ?>/<?php echo $groups_template->group->slug ?>/admin/membership-requests"><?php _e('Membership Requests', 'buddypress') ?></a></li> 420 <?php endif; ?> 398 421 <?php 399 422 do_action( 'bp_groups_admin_tabs' ); 400 423 } 401 424 425 function bp_group_form_action( $page ) { 426 global $bp, $groups_template; 427 428 echo bp_group_permalink( $group, false ) . '/' . $page; 429 } 430 402 431 function bp_group_admin_form_action( $page ) { 403 432 global $bp, $groups_template; 404 433 405 434 echo bp_group_permalink( $group, false ) . '/admin/' . $page; 435 } 436 437 function bp_group_has_requested_membership() { 438 global $bp, $groups_template; 439 440 if ( groups_check_for_membership_request( $bp['loggedin_userid'], $groups_template->group->id ) ) 441 return true; 442 443 return false; 406 444 } 407 445 … … 461 499 <?php case '2': ?> 462 500 <?php if ( $completed_to_step > 0 ) { ?> 501 <?php if ( function_exists('bp_wire_install') ) : ?> 463 502 <div class="checkbox"> 464 503 <label><input type="checkbox" name="group-show-wire" id="group-show-wire" value="1"<?php if ( $group_obj->enable_wire ) { ?> checked="checked"<?php } ?> /> <?php _e('Enable comment wire', 'buddypress') ?></label> 465 504 </div> 505 <?php endif; ?> 506 507 <?php if ( function_exists('bp_forum_install') ) : ?> 466 508 <div class="checkbox"> 467 509 <label><input type="checkbox" name="group-show-forum" id="group-show-forum" value="1"<?php if ( $group_obj->enable_forum ) { ?> checked="checked"<?php } ?> /> <?php _e('Enable discussion forum', 'buddypress') ?></label> 468 510 </div> 511 <?php endif; ?> 512 513 <?php if ( function_exists('bp_albums_install') ) : ?> 469 514 <div class="checkbox with-suboptions"> 470 515 <label><input type="checkbox" name="group-show-photos" id="group-show-photos" value="1"<?php if ( $group_obj->enable_photos ) { ?> checked="checked"<?php } ?> /> <?php _e('Enable photo gallery', 'buddypress') ?></label> … … 474 519 </div> 475 520 </div> 521 <?php endif; ?> 476 522 477 523 <h3><?php _e('Privacy Options', 'buddypress'); ?></h3> … … 590 636 <?php echo $member->user->avatar_thumb ?> 591 637 <p><?php echo $member->user->user_link ?> <?php if ( $member->user_title ) { ?><?php echo '<span class="small">- ' . $member->user_title . '</span>' ?><?php } ?></p> 592 <span class="activity"> joined <?php echo bp_core_time_since( strtotime($member->date_modified) ) ?> ago</span>638 <span class="activity"><?php echo sprintf( __( 'joined %s ago', 'buddypress' ), bp_core_time_since( strtotime( $member->date_modified ) ) ); ?></span> 593 639 <?php if ( bp_exists('friends') && function_exists('bp_add_friend_button') ) { ?> 594 640 <div class="action"> … … 653 699 <?php echo $user->avatar_thumb ?> 654 700 <h4><?php echo $user->user_link ?></h4> 655 <span class="activity"> active <?php echo $user->last_active ?> ago</span>701 <span class="activity"><?php echo $user->last_active ?></span> 656 702 <div class="action"> 657 703 <a class="remove" href="<?php echo site_url() . $bp['groups']['slug'] . '/' . $group_obj->id . '/invites/remove/' . $user->id ?>" id="uid-<?php echo $user->id ?>">Remove Invite</a> … … 676 722 global $bp, $groups_template; 677 723 678 if ( is_user_logged_in() && !BP_Groups_Member::check_is_member( $bp['loggedin_userid'], $groups_template->group->id ) ) { 679 echo '<a class="join-group" href="' . bp_group_permalink( false, false ) . '/join">' . __('Join Group', 'buddypress') . '</a>'; 724 if ( !is_user_logged_in() || BP_Groups_Member::check_is_member( $bp['loggedin_userid'], $groups_template->group->id ) ) 725 return false; 726 727 switch ( $groups_template->group->status ) { 728 case 'public': 729 echo '<a class="join-group" href="' . bp_group_permalink( false, false ) . '/join">' . __('Join Group', 'buddypress') . '</a>'; 730 break; 731 732 case 'private': 733 if ( !bp_group_has_requested_membership() ) 734 echo '<a class="request-membership" href="' . bp_group_permalink( false, false ) . '/request-membership">' . __('Request Membership', 'buddypress') . '</a>'; 735 else 736 echo 'Membership Requested'; 737 break; 738 } 739 } 740 741 function bp_group_status_message() { 742 global $groups_template; 743 744 if ( $groups_template->group->status == 'private' ) { 745 if ( !bp_group_has_requested_membership() ) 746 _e( 'This is a private group and you must request group membership in order to join.', 'buddypress' ); 747 else 748 _e( 'This is a private group. Your membership request is awaiting approval from the group administrator.', 'buddypress' ); 749 } else { 750 _e( 'This is a hidden group and only invited members can join.', 'buddypress' ); 680 751 } 681 752 } … … 708 779 } 709 780 781 /**** 782 * Membership Requests Template Tags 783 **/ 784 785 class BP_Groups_Membership_Requests_Template { 786 var $current_request = -1; 787 var $request_count; 788 var $requests; 789 var $request; 790 791 var $in_the_loop; 792 793 var $pag_page; 794 var $pag_num; 795 var $pag_links; 796 var $total_request_count; 797 798 function bp_groups_membership_requests_template( $group_id = null ) { 799 global $bp; 800 801 $this->pag_page = isset( $_REQUEST['mrpage'] ) ? intval( $_REQUEST['mrpage'] ) : 1; 802 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : 5; 803 804 $this->requests = BP_Groups_Group::get_membership_requests( $group_id, $this->pag_num, $this->pag_page ); 805 $this->request_count = count($this->requests); 806 807 $this->total_request_count = (int) BP_Groups_Group::has_membership_requests( $group_id ); 808 809 $this->pag_links = paginate_links( array( 810 'base' => add_query_arg( 'mrpage', '%#%' ), 811 'format' => '', 812 'total' => ceil( $this->total_request_count / $this->pag_num ), 813 'current' => $this->pag_page, 814 'prev_text' => '«', 815 'next_text' => '»', 816 'mid_size' => 1 817 )); 818 819 } 820 821 function has_requests() { 822 if ( $this->request_count ) 823 return true; 824 825 return false; 826 } 827 828 function next_request() { 829 $this->current_request++; 830 $this->request = $this->requests[$this->current_request]; 831 832 return $this->request; 833 } 834 835 function rewind_requests() { 836 $this->current_request = -1; 837 if ( $this->request_count > 0 ) { 838 $this->request = $this->requests[0]; 839 } 840 } 841 842 function requests() { 843 if ( $this->current_request + 1 < $this->request_count ) { 844 return true; 845 } elseif ( $this->current_request + 1 == $this->request_count ) { 846 do_action('loop_end'); 847 // Do some cleaning up after the loop 848 $this->rewind_requests(); 849 } 850 851 $this->in_the_loop = false; 852 return false; 853 } 854 855 function the_request() { 856 global $request; 857 858 $this->in_the_loop = true; 859 $this->request = $this->next_request(); 860 861 if ( $this->current_request == 0 ) // loop has just started 862 do_action('loop_start'); 863 } 864 } 865 866 function bp_group_has_membership_requests() { 867 global $requests_template, $groups_template; 868 869 $requests_template = new BP_Groups_Membership_Requests_Template( $groups_template->group->id ); 870 871 return $requests_template->has_requests(); 872 } 873 874 function bp_group_membership_requests() { 875 global $requests_template; 876 877 return $requests_template->requests(); 878 } 879 880 function bp_group_the_membership_request() { 881 global $requests_template; 882 883 return $requests_template->the_request(); 884 } 885 886 function bp_group_request_user_avatar_thumb() { 887 global $requests_template; 888 889 echo bp_core_get_avatar( $requests_template->request->user_id, 1 ); 890 } 891 892 function bp_group_request_reject_link() { 893 global $requests_template, $groups_template; 894 895 echo bp_group_permalink( $groups_template->group, false ) . '/admin/membership-requests/reject/' . $requests_template->request->id; 896 } 897 898 function bp_group_request_accept_link() { 899 global $requests_template, $groups_template; 900 901 echo bp_group_permalink( $groups_template->group, false ) . '/admin/membership-requests/accept/' . $requests_template->request->id; 902 } 903 904 function bp_group_request_time_since_requested() { 905 global $requests_template; 906 907 echo sprintf( __( 'requested %s ago', 'buddypress' ), bp_core_time_since( strtotime( $requests_template->request->date_modified ) ) ); 908 } 909 910 function bp_group_request_comment() { 911 global $requests_template; 912 913 echo strip_tags( stripslashes( $requests_template->request->comments ) ); 914 } 915 916 function bp_group_request_user_link() { 917 global $requests_template; 918 919 echo bp_core_get_userlink( $requests_template->request->user_id ); 920 } 921 710 922 ?> -
trunk/bp-groups/js/general.js
r263 r502 78 78 79 79 jQuery.post( ajaxurl, { 80 action: 'group_ search',80 action: 'group_filter', 81 81 'cookie': encodeURIComponent(document.cookie), 82 82 '_wpnonce': jQuery("input#_wpnonce").val(), … … 84 84 'num': 5, 85 85 86 'group-search-box': jQuery("#group-search-box").val() 87 }, 88 function(response) 89 { 90 render_group_search_response(response); 86 'group-filter-box': jQuery("#group-filter-box").val() 87 }, 88 function(response) 89 { 90 response = response.substr( 0, response.length - 1 ); 91 92 jQuery("div#group-loop").fadeOut(200, 93 function() { 94 jQuery('#ajax-loader').toggle(); 95 jQuery("div#group-loop").html(response); 96 jQuery("div#group-loop").fadeIn(200); 97 } 98 ); 91 99 }); 92 100 … … 113 121 function(response) 114 122 { 115 render_group_finder_search_response(response); 116 }); 117 118 return false; 119 } 120 ); 121 122 jQuery("input#group-search-box").keyup( 123 response = response.substr( 0, response.length - 1 ); 124 125 jQuery("div#group-loop").fadeOut(200, 126 function() { 127 jQuery('#ajax-loader').toggle(); 128 jQuery("div#group-loop").html(response); 129 jQuery("div#group-loop").fadeIn(200); 130 } 131 ); 132 }); 133 134 return false; 135 } 136 ); 137 138 jQuery("input#group-filter-box").keyup( 123 139 function(e) { 124 140 if ( e.which == 13 ) { … … 126 142 127 143 jQuery.post( ajaxurl, { 128 action: 'group_ search',144 action: 'group_filter', 129 145 'cookie': encodeURIComponent(document.cookie), 130 146 '_wpnonce': jQuery("input#_wpnonce").val(), 131 147 132 'group- search-box': jQuery("#group-search-box").val()148 'group-filter-box': jQuery("#group-filter-box").val() 133 149 }, 134 150 function(response) 135 151 { 136 render_group_search_response(response); 152 response = response.substr( 0, response.length - 1 ); 153 154 jQuery("div#group-loop").fadeOut(200, 155 function() { 156 jQuery('#ajax-loader').toggle(); 157 jQuery("div#group-loop").html(response); 158 jQuery("div#group-loop").fadeIn(200); 159 } 160 ); 137 161 }); 138 162 … … 145 169 function(e) { 146 170 if ( e.which == 13 ) { 147 jQuery('#ajax-loader').toggle(); 148 171 if ( jQuery("#groupfinder-search-box").val() == '' ) 172 return false; 173 174 jQuery('#ajax-loader').toggle(); 175 149 176 jQuery.post( ajaxurl, { 150 177 action: 'group_finder_search', … … 156 183 function(response) 157 184 { 158 render_group_finder_search_response(response); 185 response = response.substr( 0, response.length - 1 ); 186 187 jQuery("div#finder-message").fadeOut(200); 188 jQuery("div#group-loop").fadeOut(200, 189 function() { 190 jQuery('#ajax-loader').toggle(); 191 jQuery("div#group-loop").html(response); 192 jQuery("div#group-loop").fadeIn(200); 193 } 194 ); 159 195 }); 160 196 … … 164 200 ); 165 201 }); 166 167 function render_group_search_response(response) {168 response = response.substr(0, response.length-1);169 response = response.split('[[SPLIT]]');170 171 if ( response[0] != "-1" ) {172 jQuery("ul#group-list").fadeOut(200,173 function() {174 jQuery('#ajax-loader').toggle();175 jQuery("ul#group-list").html(response[1]);176 jQuery("ul#group-list").fadeIn(200);177 }178 );179 180 jQuery("div#pag").fadeOut(200,181 function() {182 jQuery("div#pag").html(response[2]);183 jQuery("div#pag").fadeIn(200);184 }185 );186 187 } else {188 jQuery("ul#group-list").fadeOut(200,189 function() {190 jQuery('#ajax-loader').toggle();191 jQuery("div#pag").fadeOut(200);192 var message = '<p><div id="message" class="error"><p>' + response[1] + '</p></div></p>';193 jQuery("ul#group-list").html(message);194 jQuery("ul#group-list").fadeIn(200);195 }196 );197 }198 199 return false;200 }201 202 function render_group_finder_search_response(response) {203 response = response.substr(0, response.length-1);204 response = response.split('[[SPLIT]]');205 206 console.log(response);207 208 jQuery('#finder-message').before('<ul id="friend-list"></ul>');209 210 if ( jQuery('#finder-message') ) {211 jQuery('#finder-message').fadeOut(200);212 }213 214 if ( response[0] != "-1" ) {215 jQuery("ul#friend-list").fadeOut(200,216 function() {217 jQuery('#ajax-loader').toggle();218 jQuery("ul#friend-list").html(response[1]);219 jQuery("ul#friend-list").fadeIn(200);220 }221 );222 223 jQuery("div#groupfinder-pag").fadeOut(200,224 function() {225 jQuery("div#groupfinder-pag").html(response[2]);226 jQuery("div#groupfinder-pag").fadeIn(200);227 }228 );229 230 } else {231 jQuery("ul#friend-list").fadeOut(200,232 function() {233 jQuery('#ajax-loader').toggle();234 jQuery("div#groupfinder-pag").fadeOut(200);235 var message = '<p><div id="message" class="error"><p>' + response[1] + '</p></div></p>';236 jQuery("ul#friend-list").html(message);237 jQuery("ul#friend-list").fadeIn(200);238 }239 );240 }241 242 return false;243 } -
trunk/bp-xprofile.php
r489 r502 425 425 * @return The readable notification item 426 426 */ 427 function xprofile_format_notifications( $action, $item_id, $ total_items ) {427 function xprofile_format_notifications( $action, $item_id, $secondary_item_id, $total_items ) { 428 428 global $bp; 429 429 -
trunk/bp-xprofile/bp-xprofile-cssjs.php
r373 r502 7 7 add_action( 'wp_head', 'xprofile_add_signup_css' ); 8 8 9 function xprofile_add_signup_js() { 10 if ( $_SERVER['SCRIPT_NAME'] == '/wp-signup.php' ) 11 wp_enqueue_script( 'jquery' ); 12 } 13 add_action( 'wp', 'xprofile_add_signup_js' ); 9 14 10 15 function xprofile_add_admin_css() { … … 15 20 add_action( 'admin_head', 'xprofile_add_admin_css' ); 16 21 17 18 function xprofile_add_admin_js() {19 if ( strpos( $_GET['page'], 'xprofile' ) !== false ) {20 wp_enqueue_script( 'bp-xprofile-admin-js', site_url() . "/wp-content/mu-plugins/bp-xprofile/js/admin.js" );21 add_action( 'admin_head', 'bp_core_add_cropper_js' );22 }23 }24 add_action( 'admin_menu', 'xprofile_add_admin_js' );25 26 22 function xprofile_add_cropper_js() { 27 23 global $bp; 28 24 29 if ( $_SERVER['SCRIPT_NAME'] == '/wp-activate.php' || $bp['current_action'] == 'change-avatar' || ( isset($_GET['page']) && $_GET['page'] == 'bp-xprofile.php' )) {25 if ( $_SERVER['SCRIPT_NAME'] == '/wp-activate.php' || $bp['current_action'] == 'change-avatar' ) { 30 26 wp_enqueue_script('jquery'); 31 27 wp_enqueue_script('prototype');
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)