Changeset 623
- Timestamp:
- 12/06/2008 01:31:08 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-classes.php
r617 r623 42 42 global $wpdb, $bp, $current_user; 43 43 44 if ( !$this->item_id || !$this->user_id )44 if ( !$this->item_id || !$this->user_id || $this->is_private ) 45 45 return false; 46 46 … … 110 110 111 111 for ( $i = 0; $i < count( $activities ); $i++ ) { 112 $activities_formatted[$i]['content'] = $activities[$i]->content; 113 $activities_formatted[$i]['primary_link'] = $activities[$i]->primary_link; 114 $activities_formatted[$i]['date_recorded'] = $activities[$i]->date_recorded; 115 $activities_formatted[$i]['component_name'] = $activities[$i]->component_name; 116 $activities_formatted[$i]['is_private'] = $activities[$i]->is_private; 112 if ( !$activities[$i]->is_private ) { 113 $activities_formatted[$i]['content'] = $activities[$i]->content; 114 $activities_formatted[$i]['primary_link'] = $activities[$i]->primary_link; 115 $activities_formatted[$i]['date_recorded'] = $activities[$i]->date_recorded; 116 $activities_formatted[$i]['component_name'] = $activities[$i]->component_name; 117 $activities_formatted[$i]['is_private'] = $activities[$i]->is_private; 118 } 117 119 } 118 120 … … 128 130 if ( !$content = call_user_func($bp[$activities[$i]->component_name]['format_activity_function'], $activities[$i]->item_id, $activities[$i]->user_id, $activities[$i]->component_action ) ) 129 131 continue; 130 131 $activities_formatted[$i]['content'] = $content['content']; 132 $activities_formatted[$i]['primary_link'] = $content['primary_link']; 133 $activities_formatted[$i]['date_recorded'] = $activities[$i]->date_recorded; 134 $activities_formatted[$i]['component_name'] = $activities[$i]->component_name; 135 $activities_formatted[$i]['is_private'] = $activities[$i]->is_private; 132 133 if ( !$activities[$i]->is_private ) { 134 $activities_formatted[$i]['content'] = $content['content']; 135 $activities_formatted[$i]['primary_link'] = $content['primary_link']; 136 $activities_formatted[$i]['date_recorded'] = $activities[$i]->date_recorded; 137 $activities_formatted[$i]['component_name'] = $activities[$i]->component_name; 138 $activities_formatted[$i]['is_private'] = $activities[$i]->is_private; 139 } 136 140 } 137 141 … … 170 174 171 175 for ( $i = 0; $i < count( $activities ); $i++ ) { 172 $activities_formatted[$i]['content'] = $activities[$i]->content; 173 $activities_formatted[$i]['primary_link'] = $activities[$i]->primary_link; 174 $activities_formatted[$i]['date_recorded'] = $activities[$i]->date_recorded; 175 $activities_formatted[$i]['component_name'] = $activities[$i]->component_name; 176 $activities_formatted[$i]['is_private'] = $activities[$i]->is_private; 176 if ( !$activities[$i]->is_private ) { 177 $activities_formatted[$i]['content'] = $activities[$i]->content; 178 $activities_formatted[$i]['primary_link'] = $activities[$i]->primary_link; 179 $activities_formatted[$i]['date_recorded'] = $activities[$i]->date_recorded; 180 $activities_formatted[$i]['component_name'] = $activities[$i]->component_name; 181 $activities_formatted[$i]['is_private'] = $activities[$i]->is_private; 182 } 177 183 } 178 184 … … 216 222 217 223 /* Remove entries that are older than 6 months */ 218 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['activity']['table_name_sitewide'] . " WHERE DATE_ADD(date_recorded, INTERVAL 6 MONTH ) <= NOW()" ) );224 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['activity']['table_name_sitewide'] . " WHERE DATE_ADD(date_recorded, INTERVAL 6 MONTHS) <= NOW()" ) ); 219 225 220 226 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp['activity']['table_name_sitewide'] . " ORDER BY date_recorded DESC $limit_sql" ) ); -
trunk/bp-blogs.php
r606 r623 345 345 bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'last_activity', time() ); 346 346 347 do_action( 'bp_blogs_new_blog', array( 'item_id' => $recorded_blog_id, 'component_name' => 'blogs', 'component_action' => 'new_blog', 'is_private' => 0 ) ); 347 $is_private = bp_blogs_is_blog_hidden( $recorded_blog_id ); 348 349 do_action( 'bp_blogs_new_blog', array( 'item_id' => $recorded_blog_id, 'component_name' => 'blogs', 'component_action' => 'new_blog', 'is_private' => $is_private ) ); 348 350 } 349 351 add_action( 'wpmu_new_blog', 'bp_blogs_record_blog', 10, 2 ); … … 391 393 bp_blogs_update_blogmeta( $recorded_post->blog_id, 'last_activity', time() ); 392 394 393 do_action( 'bp_blogs_new_blog_post', array( 'item_id' => $recorded_post_id, 'component_name' => 'blogs', 'component_action' => 'new_blog_post', 'is_private' => 0, 'user_id' => $recorded_post->user_id ) ); 395 $is_private = bp_blogs_is_blog_hidden( $recorded_post->blog_id ); 396 397 do_action( 'bp_blogs_new_blog_post', array( 'item_id' => $recorded_post_id, 'component_name' => 'blogs', 'component_action' => 'new_blog_post', 'is_private' => $is_private, 'user_id' => $recorded_post->user_id ) ); 394 398 } 395 399 } else { … … 445 449 bp_blogs_update_blogmeta( $recorded_comment->blog_id, 'last_activity', time() ); 446 450 447 do_action( 'bp_blogs_new_blog_comment', array( 'item_id' => $recorded_commment_id, 'component_name' => 'blogs', 'component_action' => 'new_blog_comment', 'is_private' => 0, 'user_id' => $user_id ) ); 451 $is_private = bp_blogs_is_blog_hidden( $recorded_comment->blog_id ); 452 453 do_action( 'bp_blogs_new_blog_comment', array( 'item_id' => $recorded_commment_id, 'component_name' => 'blogs', 'component_action' => 'new_blog_comment', 'is_private' => $is_private, 'user_id' => $user_id ) ); 448 454 } 449 455 } else { … … 562 568 add_action( 'bp_homebase_signup_completed', 'bp_blogs_register_existing_content', 10 ); 563 569 570 function bp_blogs_get_blogs_for_user( $user_id ) { 571 return BP_Blogs_Blog::get_blogs_for_user( $user_id ); 572 } 573 574 function bp_blogs_get_posts_for_user( $user_id ) { 575 return BP_Blogs_Post::get_posts_for_user( $user_id ); 576 } 577 578 function bp_blogs_get_comments_for_user( $user_id ) { 579 return BP_Blogs_Comment::get_comments_for_user( $user_id ); 580 } 581 564 582 function bp_blogs_get_latest_posts( $blog_id = null, $limit = 5 ) { 565 583 global $bp; … … 591 609 } 592 610 611 function bp_blogs_is_blog_hidden( $blog_id ) { 612 return BP_Blogs_Blog::is_hidden( $blog_id ); 613 } 593 614 594 615 function bp_blogs_redirect_to_random_blog() { … … 602 623 } 603 624 add_action( 'wp', 'bp_blogs_redirect_to_random_blog', 6 ); 625 626 604 627 605 628 -
trunk/bp-blogs/bp-blogs-classes.php
r599 r623 94 94 if ( !$user_id ) 95 95 $user_id = $bp['current_userid']; 96 97 $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM " . $bp['blogs']['table_name'] . " WHERE user_id = %d", $user_id) ); 96 97 // Show logged in users their hidden blogs. 98 if ( !bp_is_home() ) 99 $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT b.blog_id FROM " . $bp['blogs']['table_name'] . " b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.public = 1 AND wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND b.user_id = %d ", $user_id) ); 100 else 101 $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT b.blog_id FROM " . $bp['blogs']['table_name'] . " b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND b.user_id = %d ", $user_id) ); 102 98 103 $total_blog_count = BP_Blogs_Blog::total_blog_count( $user_id ); 99 104 … … 115 120 if ( !$user_id ) 116 121 $user_id = $bp['current_userid']; 117 118 return $wpdb->get_var( $wpdb->prepare( "SELECT count(blog_id) FROM " . $bp['blogs']['table_name'] . " WHERE user_id = %d", $user_id) ); 122 123 // If the user is logged in return the blog count including their hidden blogs. 124 if ( !bp_is_home() ) 125 return $wpdb->get_var( $wpdb->prepare( "SELECT count(b.blog_id) FROM " . $bp['blogs']['table_name'] . " b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.public = 1 AND wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND user_id = %d", $user_id) ); 126 else 127 return $wpdb->get_var( $wpdb->prepare( "SELECT count(b.blog_id) FROM " . $bp['blogs']['table_name'] . " b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND user_id = %d", $user_id) ); 119 128 } 120 129 … … 124 133 if ( $limit && $page ) { 125 134 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 126 $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT count(b.blog_id) FROM " . $bp['blogs']['table_name'] . " b , " . $bp['blogs']['table_name_blogmeta'] . " bm WHERE b.blog_id = bm.blog_idAND bm.meta_key = 'last_activity' ORDER BY CONVERT(bm.meta_value, SIGNED) DESC" ) );127 } 128 129 $paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT b.blog_id FROM " . $bp['blogs']['table_name'] . " b, " . $bp['blogs']['table_name_blogmeta'] . " bm WHERE b.blog_id = bm.blog_idAND bm.meta_key = 'last_activity' ORDER BY CONVERT(bm.meta_value, SIGNED) DESC {$pag_sql}" ) );135 $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT count(b.blog_id) FROM " . $bp['blogs']['table_name'] . " b LEFT JOIN " . $bp['blogs']['table_name_blogmeta'] . " bm ON b.blog_id = bm.blog_id LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.public = 1 AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 AND bm.meta_key = 'last_activity' ORDER BY CONVERT(bm.meta_value, SIGNED) DESC" ) ); 136 } 137 138 $paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT b.blog_id FROM " . $bp['blogs']['table_name'] . " b LEFT JOIN " . $bp['blogs']['table_name_blogmeta'] . " bm ON b.blog_id = bm.blog_id LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.public = 1 AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 AND bm.meta_key = 'last_activity' ORDER BY CONVERT(bm.meta_value, SIGNED) DESC {$pag_sql}" ) ); 130 139 131 140 return array( 'blogs' => $paged_blogs, 'total' => $total_blogs ); … … 167 176 if ( $limit && $page ) { 168 177 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 169 $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT count(b log_id) FROM " . $bp['blogs']['table_name'] . "ORDER BY rand()" ) );170 } 171 172 $paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT b log_id FROM " . $bp['blogs']['table_name'] . " ORDER BY rand(){$pag_sql}" ) );178 $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT count(b.blog_id) FROM " . $bp['blogs']['table_name'] . " b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.public = 1 AND wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 ORDER BY rand()" ) ); 179 } 180 181 $paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT b.blog_id FROM " . $bp['blogs']['table_name'] . " b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.public = 1 AND wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 {$pag_sql}" ) ); 173 182 174 183 return array( 'blogs' => $paged_blogs, 'total' => $total_blogs ); 184 } 185 186 function is_hidden( $blog_id ) { 187 global $wpdb; 188 189 if ( $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE blog_id = %d AND public = 1 AND archived = '0' AND spam = 0 AND mature = 0 AND deleted = 0", $blog_id ) ) ) 190 return false; 191 192 return true; 175 193 } 176 194 … … 266 284 267 285 if ( $blog_id ) 268 $blog_sql = $wpdb->prepare( " WHEREblog_id = %d", $blog_id );269 270 $post_ids = $wpdb->get_results( $wpdb->prepare( "SELECT p ost_id, blog_id FROM " . $bp['blogs']['table_name_blog_posts'] . "$blog_sql ORDER BYdate_created DESC LIMIT $limit" ) );286 $blog_sql = $wpdb->prepare( " AND p.blog_id = %d", $blog_id ); 287 288 $post_ids = $wpdb->get_results( $wpdb->prepare( "SELECT p.post_id, p.blog_id FROM " . $bp['blogs']['table_name_blog_posts'] . " p LEFT JOIN {$wpdb->base_prefix}blogs b ON p.blog_id = b.blog_id WHERE b.public = 1 AND b.deleted = 0 AND b.archived = '0' AND b.spam = 0 AND b.mature = 0 $blog_sql ORDER BY p.date_created DESC LIMIT $limit" ) ); 271 289 272 290 for ( $i = 0; $i < count($post_ids); $i++ ) { … … 282 300 if ( !$user_id ) 283 301 $user_id = $bp['current_userid']; 284 285 $post_ids = $wpdb->get_results( $wpdb->prepare( "SELECT post_id, blog_id FROM " . $bp['blogs']['table_name_blog_posts'] . " WHERE user_id = %d ORDER BY date_created DESC", $user_id) ); 286 $total_post_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(post_id) FROM " . $bp['blogs']['table_name_blog_posts'] . " WHERE user_id = %d", $user_id) ); 287 302 303 // Show a logged in user their posts on private blogs, but not anyone else. 304 if ( !bp_is_home() ) { 305 $post_ids = $wpdb->get_results( $wpdb->prepare( "SELECT p.post_id, p.blog_id FROM " . $bp['blogs']['table_name_blog_posts'] . " p LEFT JOIN {$wpdb->base_prefix}blogs b ON p.blog_id = b.blog_id WHERE b.public = 1 AND b.deleted = 0 AND b.archived = '0' AND b.spam = 0 AND b.mature = 0 AND p.user_id = %d ORDER BY p.date_created DESC", $user_id) ); 306 $total_post_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(p.post_id) FROM " . $bp['blogs']['table_name_blog_posts'] . " p LEFT JOIN {$wpdb->base_prefix}blogs b ON p.blog_id = b.blog_id WHERE b.public = 1 AND b.deleted = 0 AND b.archived = '0' AND b.spam = 0 AND b.mature = 0 p.user_id = %d", $user_id) ); 307 } else { 308 $post_ids = $wpdb->get_results( $wpdb->prepare( "SELECT p.post_id, p.blog_id FROM " . $bp['blogs']['table_name_blog_posts'] . " p LEFT JOIN {$wpdb->base_prefix}blogs b ON p.blog_id = b.blog_id WHERE b.deleted = 0 AND b.archived = '0' AND b.spam = 0 AND b.mature = 0 AND p.user_id = %d ORDER BY p.date_created DESC", $user_id) ); 309 $total_post_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(p.post_id) FROM " . $bp['blogs']['table_name_blog_posts'] . " p LEFT JOIN {$wpdb->base_prefix}blogs b ON p.blog_id = b.blog_id WHERE b.deleted = 0 AND b.archived = '0' AND b.spam = 0 AND b.mature = 0 p.user_id = %d", $user_id) ); 310 } 311 312 288 313 for ( $i = 0; $i < count($post_ids); $i++ ) { 289 314 $posts[$i] = BP_Blogs_Post::fetch_post_content($post_ids[$i]); … … 433 458 $user_id = $bp['current_userid']; 434 459 435 $comment_ids = $wpdb->get_results( $wpdb->prepare( "SELECT comment_id, blog_id FROM " . $bp['blogs']['table_name_blog_comments'] . " WHERE user_id = %d ORDER BY date_created ASC", $user_id) ); 436 $total_comment_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(comment_id) FROM " . $bp['blogs']['table_name_blog_comments'] . " WHERE user_id = %d", $user_id) ); 460 // Show the logged in user their comments on hidden blogs, but not to anyone else. 461 if ( !bp_is_home() ) { 462 $comment_ids = $wpdb->get_results( $wpdb->prepare( "SELECT c.comment_id, c.blog_id FROM " . $bp['blogs']['table_name_blog_comments'] . " c LEFT JOIN {$wpdb->base_prefix}blogs b ON c.blog_id = b.blog_id WHERE b.public = 1 AND b.deleted = 0 AND b.archived = '0' AND b.spam = 0 AND b.mature = 0 AND c.user_id = %d ORDER BY c.date_created ASC", $user_id) ); 463 $total_comment_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(c.comment_id) FROM " . $bp['blogs']['table_name_blog_comments'] . " c LEFT JOIN {$wpdb->base_prefix}blogs b ON c.blog_id = b.blog_id WHERE b.public = 1 AND b.deleted = 0 AND b.archived = '0' AND b.spam = 0 AND b.mature = 0 AND c.user_id = %d", $user_id) ); 464 } else { 465 $comment_ids = $wpdb->get_results( $wpdb->prepare( "SELECT c.comment_id, c.blog_id FROM " . $bp['blogs']['table_name_blog_comments'] . " c LEFT JOIN {$wpdb->base_prefix}blogs b ON c.blog_id = b.blog_id WHERE b.deleted = 0 AND b.archived = '0' AND b.spam = 0 AND b.mature = 0 AND c.user_id = %d ORDER BY c.date_created ASC", $user_id) ); 466 $total_comment_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(c.comment_id) FROM " . $bp['blogs']['table_name_blog_comments'] . " c LEFT JOIN {$wpdb->base_prefix}blogs b ON c.blog_id = b.blog_id WHERE b.deleted = 0 AND b.archived = '0' AND b.spam = 0 AND b.mature = 0 AND c.user_id = %d", $user_id) ); 467 } 437 468 438 469 for ( $i = 0; $i < count($comment_ids); $i++ ) { -
trunk/bp-blogs/bp-blogs-templatetags.php
r554 r623 24 24 $this->pag_num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 5; 25 25 26 $this->blogs = BP_Blogs_Blog::get_blogs_for_user( $user_id );26 $this->blogs = bp_blogs_get_blogs_for_user( $user_id ); 27 27 $this->total_blog_count = (int)$this->blogs['count']; 28 28 $this->blogs = $this->blogs['blogs']; … … 142 142 $this->pag_num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 5; 143 143 144 $this->posts = BP_Blogs_Post::get_posts_for_user( $user_id );144 $this->posts = bp_blogs_get_posts_for_user( $user_id ); 145 145 $this->total_post_count = (int)$this->posts['count']; 146 146 $this->posts = $this->posts['posts']; … … 486 486 $this->pag_num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 5; 487 487 488 $this->comments = BP_Blogs_Comment::get_comments_for_user( $user_id );488 $this->comments = bp_blogs_get_comments_for_user( $user_id ); 489 489 $this->total_comment_count = (int)$this->comments['count']; 490 490 $this->comments = $this->comments['comments']; -
trunk/bp-core.php
r616 r623 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.9.8' );4 define( 'BP_CORE_VERSION', '0.3' ); 5 5 6 6 /* Define the slug for member pages and the members directory (e.g. domain.com/[members] ) */ … … 186 186 dbDelta($sql); 187 187 188 /* Add names of root components to the banned blog list to avoid conflicts */ 189 bp_core_add_illegal_names(); 190 188 191 // dbDelta won't change character sets, so we need to do this seperately. 189 192 // This will only be in here pre v1.0 … … 398 401 * @param $function The function to run when this sub nav item is selected. 399 402 * @param $css_id The id to give the nav item in the HTML (for css highlighting) 400 * @param $ loggedin_user_only Should onlythe logged in user be able to access this page?403 * @param $user_has_access Should the logged in user be able to access this page? 401 404 * @param $admin_only Should this sub nav item only be visible/accessible to the site admin? 402 405 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() … … 404 407 function bp_core_add_subnav_item( $parent_id, $slug, $name, $link, $function, $css_id = false, $user_has_access = true, $admin_only = false ) { 405 408 global $bp; 406 407 if ( !$user_has_access && !bp_is_home() ) 408 return false; 409 409 410 410 if ( $admin_only && !is_site_admin() ) 411 411 return false; … … 420 420 ); 421 421 422 if ( function_exists($function) && $ bp['current_action'] == $slug && $bp['current_component'] == $parent_id )422 if ( function_exists($function) && $user_has_access && $bp['current_action'] == $slug && $bp['current_component'] == $parent_id ) 423 423 add_action( 'wp', $function, 3 ); 424 424 } … … 998 998 * 999 999 * Reorder the core component navigation array items into the desired order. 1000 * This is done this way because we cannot assume that any one component is present. 1000 1001 * 1001 1002 * @package BuddyPress Core … … 1018 1019 unset($nav_array[$key]); 1019 1020 break; 1020 case 'profile': 1021 case 'profile': // For profiles without bp-xprofile installed 1021 1022 $new_nav[1] = $nav_array[$key]; 1022 1023 unset($nav_array[$key]); … … 1042 1043 unset($nav_array[$key]); 1043 1044 break; 1044 case $bp[' gallery']['slug']:1045 case $bp['photos']['slug']: 1045 1046 $new_nav[7] = $nav_array[$key]; 1046 1047 unset($nav_array[$key]); … … 1100 1101 } 1101 1102 1103 function bp_core_add_illegal_names() { 1104 $current = maybe_unserialize( get_site_option( 'illegal_names' ) ); 1105 $bp_illegal_names = explode( ',', BP_CORE_ROOT_COMPONENTS ); 1106 1107 if ( is_array( $current ) ) { 1108 foreach( $bp_illegal_names as $bp_illegal_name ) { 1109 if ( !in_array( $bp_illegal_name, $current ) ) 1110 $current[] = $bp_illegal_name; 1111 } 1112 $new = $current; 1113 } else { 1114 $bp_illegal_names[] = $current; 1115 $new = $bp_illegal_names; 1116 } 1117 1118 update_site_option( 'illegal_names', $new ); 1119 } 1120 1102 1121 1103 1122 /** -
trunk/bp-core/bp-core-adminbar.php
r516 r623 2 2 3 3 function bp_core_admin_bar() { 4 global $bp, $wpdb, $current_blog; 4 global $bp, $wpdb, $current_blog, $doing_admin_bar; 5 6 $doing_admin_bar = true; 5 7 6 8 if ( !(int)get_site_option( 'show-loggedout-adminbar' ) && !is_user_logged_in() ) … … 169 171 echo '</ul>'; 170 172 echo '</div>'; 173 174 $doing_admin_bar = false; 171 175 } 172 176 -
trunk/bp-core/bp-core-templatetags.php
r621 r623 182 182 183 183 function bp_is_home() { 184 global $bp ;185 186 if ( !is_user_logged_in() || is_null($bp['loggedin_userid']) || is_null($bp['current_userid']))187 return false;184 global $bp, $current_blog, $doing_admin_bar; 185 186 if ( is_user_logged_in() && $bp['loggedin_userid'] == $bp['current_userid'] ) 187 return true; 188 188 189 if ( $bp['loggedin_userid'] == $bp['current_userid'] )190 return true;191 192 189 return false; 193 190 } -
trunk/bp-friends.php
r612 r623 509 509 $friendship = new BP_Friends_Friendship( $friendship_id, true, false ); 510 510 511 if ( BP_Friends_Friendship::accept( $friendship_id ) ) {511 if ( !$friendship->is_confirmed && BP_Friends_Friendship::accept( $friendship_id ) ) { 512 512 friends_update_friend_totals( $friendship->initiator_user_id, $friendship->friend_user_id ); 513 513 … … 531 531 function friends_reject_friendship( $friendship_id ) { 532 532 $friendship = new BP_Friends_Friendship( $friendship_id, true, false ); 533 534 if ( BP_Friends_Friendship::reject( $friendship_id ) ) {533 534 if ( !$friendship->is_confirmed && BP_Friends_Friendship::reject( $friendship_id ) ) { 535 535 // Remove the friend request notice 536 536 bp_core_delete_notifications_for_user_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, 'friends', 'friendship_request' ); … … 541 541 542 542 return false; 543 } 544 545 function friends_is_friendship_confirmed( $friendship_id ) { 546 $friendship = new BP_Friends_Friendship( $friendship_id ); 547 return $friendship->is_confirmed; 543 548 } 544 549 -
trunk/bp-messages.php
r580 r623 149 149 150 150 /* Add the subnav items to the profile */ 151 bp_core_add_subnav_item( $bp['messages']['slug'], 'inbox', __('Inbox', 'buddypress') . $count_indicator, $messages_link, 'messages_screen_inbox' );152 bp_core_add_subnav_item( $bp['messages']['slug'], 'sentbox', __('Sent Messages', 'buddypress'), $messages_link, 'messages_screen_sentbox' );153 bp_core_add_subnav_item( $bp['messages']['slug'], 'compose', __('Compose', 'buddypress'), $messages_link, 'messages_screen_compose' );151 bp_core_add_subnav_item( $bp['messages']['slug'], 'inbox', __('Inbox', 'buddypress') . $count_indicator, $messages_link, 'messages_screen_inbox', false, bp_is_home() ); 152 bp_core_add_subnav_item( $bp['messages']['slug'], 'sentbox', __('Sent Messages', 'buddypress'), $messages_link, 'messages_screen_sentbox', false, bp_is_home() ); 153 bp_core_add_subnav_item( $bp['messages']['slug'], 'compose', __('Compose', 'buddypress'), $messages_link, 'messages_screen_compose', false, bp_is_home() ); 154 154 bp_core_add_subnav_item( $bp['messages']['slug'], 'notices', __('Notices', 'buddypress'), $messages_link, 'messages_screen_notices', false, true, true ); 155 155
Note: See TracChangeset
for help on using the changeset viewer.