Changeset 2761
- Timestamp:
- 02/22/2010 01:25:56 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity.php
r2737 r2761 94 94 global $wpdb, $bp; 95 95 96 if ( $bp->site_options['bp-activity-db-version']< BP_ACTIVITY_DB_VERSION )96 if ( get_site_option( 'bp-activity-db-version' ) < BP_ACTIVITY_DB_VERSION ) 97 97 bp_activity_install(); 98 98 } … … 589 589 if ( !$activity = wp_cache_get( 'bp_activity_sitewide_front', 'bp' ) ) { 590 590 $activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden ); 591 wp_cache_set( 'bp_activity_sitewide_front', BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden ), 'bp' );591 wp_cache_set( 'bp_activity_sitewide_front', $activity, 'bp' ); 592 592 } 593 593 } else … … 1012 1012 bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count ); 1013 1013 1014 do_action( 'bp_activity_add_user_favorite', $activity_id, $user_id ); 1015 1014 1016 return true; 1015 1017 } … … 1036 1038 1037 1039 update_usermeta( $user_id, 'bp_favorite_activities', $my_favs ); 1040 1041 do_action( 'bp_activity_remove_user_favorite', $activity_id, $user_id ); 1038 1042 1039 1043 return true; … … 1110 1114 return false; 1111 1115 1112 $metas = array_map( 'maybe_unserialize', $metas );1116 $metas = array_map( 'maybe_unserialize', (array)$metas ); 1113 1117 1114 1118 if ( 1 == count($metas) ) -
trunk/bp-activity/bp-activity-templatetags.php
r2730 r2761 191 191 $display_comments = 'stream'; 192 192 193 $show_hidden = ( $user_id == $bp->loggedin_user->id ) ? 1 : 0;194 195 193 if ( $user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id ) { 194 $show_hidden = ( $user_id == $bp->loggedin_user->id ) ? 1 : 0; 195 196 196 switch ( $scope ) { 197 197 case 'friends': … … 225 225 $user_nicename = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_nicename : $bp->loggedin_user->userdata->user_nicename; 226 226 $user_login = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login; 227 $search_terms = '@' . bp_core_get_username( $user_id, $user_nicename, $user_login ) ;227 $search_terms = '@' . bp_core_get_username( $user_id, $user_nicename, $user_login ) . '<'; // Start search at @ symbol and stop search at closing tag delimiter. 228 228 $display_comments = 'stream'; 229 229 $user_id = false; … … 460 460 } 461 461 462 function bp_activity_has_content() { 463 global $activities_template; 464 465 if ( !empty( $activities_template->activity->content ) ) 466 return true; 467 468 return false; 469 } 470 462 471 function bp_activity_content() { 463 472 echo bp_get_activity_content(); … … 574 583 575 584 /* Delete link */ 576 if ( is_site_admin()|| $bp->loggedin_user->id == $comment->user_id )585 if ( $bp->loggedin_user->is_site_admin || $bp->loggedin_user->id == $comment->user_id ) 577 586 $content .= ' · <a href="' . wp_nonce_url( $bp->root_domain . '/' . $bp->activity->slug . '/delete/?cid=' . $comment->id, 'bp_activity_delete_link' ) . '" class="delete acomment-delete">' . __( 'Delete', 'buddypress' ) . '</a>'; 578 587 -
trunk/bp-blogs.php
r2737 r2761 1 1 <?php 2 2 3 define ( 'BP_BLOGS_DB_VERSION', '20 00' );3 define ( 'BP_BLOGS_DB_VERSION', '2015' ); 4 4 5 5 /* Define the slug for the component */ … … 53 53 54 54 $sql[] = "CREATE TABLE {$bp->blogs->table_name_blogmeta} ( 55 id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,56 blog_id bigint(20) NOT NULL,57 meta_key varchar(255) DEFAULT NULL,58 meta_value longtext DEFAULT NULL,59 KEY blog_id (blog_id),60 KEY meta_key (meta_key)61 ) {$charset_collate};";55 id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY, 56 blog_id bigint(20) NOT NULL, 57 meta_key varchar(255) DEFAULT NULL, 58 meta_value longtext DEFAULT NULL, 59 KEY blog_id (blog_id), 60 KEY meta_key (meta_key) 61 ) {$charset_collate};"; 62 62 63 63 … … 81 81 if ( is_site_admin() && bp_core_is_multisite() ) { 82 82 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 83 if ( $bp->site_options['bp-blogs-db-version']< BP_BLOGS_DB_VERSION )83 if ( get_site_option( 'bp-blogs-db-version' ) < BP_BLOGS_DB_VERSION ) 84 84 bp_blogs_install(); 85 85 } … … 333 333 334 334 function bp_blogs_record_existing_blogs() { 335 global $wpdb; 336 337 $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE public = 1 AND mature = 0 AND spam = 0 AND deleted = 0" ) ); 335 global $bp, $wpdb; 336 337 /* Truncate user blogs table and re-record. */ 338 $wpdb->query( "TRUNCATE TABLE {$bp->blogs->table_name}" ); 339 340 $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0" ) ); 338 341 339 342 if ( $blog_ids ) { … … 361 364 $name = get_blog_option( $blog_id, 'blogname' ); 362 365 $description = get_blog_option( $blog_id, 'blogdescription' ); 366 367 if ( empty( $name ) ) 368 return false; 363 369 364 370 $recorded_blog = new BP_Blogs_Blog; … … 545 551 add_action( 'wp_set_comment_status', 'bp_blogs_manage_comment', 10, 2 ); 546 552 547 function bp_blogs_add_user_to_blog( $user_id, $role, $blog_id ) { 548 if ( $role != 'subscriber' ) { 553 function bp_blogs_add_user_to_blog( $user_id, $role, $blog_id = false ) { 554 global $current_blog; 555 556 if ( empty( $blog_id ) ) 557 $blog_id = $current_blog->blog_id; 558 559 if ( $role != 'subscriber' ) 549 560 bp_blogs_record_blog( $blog_id, $user_id, true ); 550 }551 561 } 552 562 add_action( 'add_user_to_blog', 'bp_blogs_add_user_to_blog', 10, 3 ); 553 563 554 function bp_blogs_remove_user_from_blog( $user_id, $blog_id ) { 564 function bp_blogs_remove_user_from_blog( $user_id, $blog_id = false ) { 565 global $current_blog; 566 567 if ( empty( $blog_id ) ) 568 $blog_id = $current_blog->blog_id; 569 555 570 bp_blogs_remove_blog_for_user( $user_id, $blog_id ); 556 571 } … … 774 789 } 775 790 776 $metas = array_map('maybe_unserialize', $metas);791 $metas = array_map('maybe_unserialize', (array)$metas); 777 792 778 793 if ( 1 == count($metas) ) -
trunk/bp-blogs/bp-blogs-classes.php
r2579 r2761 210 210 211 211 // If the user is logged in return the blog count including their hidden blogs. 212 if ( !is_user_logged_in() || $user_id != $bp->loggedin_user->id ) 212 if ( ( is_user_logged_in() && $user_id == $bp->loggedin_user->id ) || is_site_admin() ) 213 return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT 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) ); 214 else 213 215 return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT 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) ); 214 else215 return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT 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) );216 216 } 217 217 -
trunk/bp-core.php
r2737 r2761 106 106 /* The core userdata of the user who is currently logged in. */ 107 107 $bp->loggedin_user->userdata = bp_core_get_core_userdata( $bp->loggedin_user->id ); 108 109 /* is_site_admin() hits the DB on single WP installs, so we need to get this separately so we can call it in a loop. */ 110 $bp->loggedin_user->is_site_admin = is_site_admin(); 108 111 109 112 /* The user id of the user currently being viewed, set in /bp-core/bp-core-catchuri.php */ … … 267 270 268 271 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 269 if ( $bp->site_options['bp-core-db-version']< BP_CORE_DB_VERSION )272 if ( get_site_option( 'bp-core-db-version' ) < BP_CORE_DB_VERSION ) 270 273 bp_core_install(); 271 274 } … … 1560 1563 1561 1564 $options = apply_filters( 'bp_core_site_options', array( 1562 'bp-core-db-version',1563 'bp-activity-db-version',1564 'bp-blogs-db-version',1565 'bp-friends-db-version',1566 'bp-groups-db-version',1567 'bp-messages-db-version',1568 'bp-xprofile-db-version',1569 1565 'bp-deactivated-components', 1570 1566 'bp-blogs-first-install', … … 2048 2044 $ct = current_theme_info(); 2049 2045 2050 if ( !in_array( 'buddypress', (array)$ct->tags ) ) { ?> 2046 /* The best way to remove this notice is to add a "buddypress" tag to your active theme's CSS header. */ 2047 if ( !defined( 'BP_SILENCE_THEME_NOTICE' ) && !in_array( 'buddypress', (array)$ct->tags ) ) { ?> 2051 2048 <div id="message" class="updated fade"> 2052 <p style="line-height: 150%"><?php printf( __( "<strong>BuddyPress is ready</strong>. You'll need to <a href='%s'>activate a BuddyPress compatible theme</a> to take advantage of all of the features. We've bundled a default theme, but you can always <a href='%s'>install some other compatible themes</a> .", 'buddypress' ), admin_url( 'themes.php' ), admin_url( 'theme-install.php?type=tag&s=buddypress&tab=search' ) ) ?></p>2049 <p style="line-height: 150%"><?php printf( __( "<strong>BuddyPress is ready</strong>. You'll need to <a href='%s'>activate a BuddyPress compatible theme</a> to take advantage of all of the features. We've bundled a default theme, but you can always <a href='%s'>install some other compatible themes</a> or <a href='%s'>upgrade your existing WordPress theme</a>.", 'buddypress' ), admin_url( 'themes.php' ), admin_url( 'theme-install.php?type=tag&s=buddypress&tab=search' ), admin_url( 'plugin-install.php?type=term&tab=search&s=bp-template-pack' ) ) ?></p> 2053 2050 </div><?php 2054 2051 } -
trunk/bp-core/bp-core-wpabstraction.php
r2349 r2761 97 97 $errors = new WP_Error(); 98 98 99 $user_name = preg_replace( "/\s+/", '', sanitize_user( $user_name, true ) );100 99 $user_email = sanitize_email( $user_email ); 101 100 … … 106 105 preg_match( "/[a-z0-9]+/", $user_name, $maybe ); 107 106 108 if( $user_name != $maybe[0] ) {109 $errors->add('user_name', __("Only lowercase letters and numbers allowed"));110 }111 112 107 $illegal_names = get_site_option( "illegal_names" ); 113 108 if( is_array( $illegal_names ) == false ) { … … 115 110 add_site_option( "illegal_names", $illegal_names ); 116 111 } 117 if( in_array( $user_name, $illegal_names ) == true ) { 118 $errors->add('user_name', __("That username is not allowed")); 112 113 if ( !validate_username( $user_name ) || in_array( $user_name, $illegal_names ) == true || $user_name != $maybe[0] ) { 114 $errors->add('user_name', __("Only lowercase letters and numbers allowed")); 119 115 } 120 116 -
trunk/bp-forums/bp-forums-templatetags.php
r2695 r2761 882 882 global $topic_template; 883 883 884 return apply_filters( 'bp_ get_the_topic_post_poster_name', bp_core_get_user_domain( $topic_template->post->poster_id, $topic_template->post->poster_nicename, $topic_template->post->poster_login ) );884 return apply_filters( 'bp_the_topic_post_poster_link', bp_core_get_user_domain( $topic_template->post->poster_id, $topic_template->post->poster_nicename, $topic_template->post->poster_login ) ); 885 885 } 886 886 -
trunk/bp-friends.php
r2737 r2761 57 57 58 58 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 59 if ( $bp->site_options['bp-friends-db-version']< BP_FRIENDS_DB_VERSION )59 if ( get_site_option( 'bp-friends-db-version' ) < BP_FRIENDS_DB_VERSION ) 60 60 friends_install(); 61 61 } -
trunk/bp-groups.php
r2737 r2761 109 109 function groups_check_installed() { 110 110 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 111 if ( $bp->site_options['bp-groups-db-version']< BP_GROUPS_DB_VERSION )111 if ( get_site_option( 'bp-groups-db-version' ) < BP_GROUPS_DB_VERSION ) 112 112 groups_install(); 113 113 } … … 1296 1296 1297 1297 $r = wp_parse_args( $args, $defaults ); 1298 extract( $r , EXTR_SKIP);1298 extract( $r ); 1299 1299 1300 1300 return bp_activity_add( array( 'id' => $id, 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) ); … … 2451 2451 } 2452 2452 2453 $metas = array_map('maybe_unserialize', $metas);2453 $metas = array_map('maybe_unserialize', (array)$metas); 2454 2454 2455 2455 if ( 1 == count($metas) ) -
trunk/bp-groups/bp-groups-classes.php
r2622 r2761 1165 1165 1166 1166 /* Register the group extension on the plugins_loaded action so we have access to all plugins */ 1167 add_action( ' plugins_loaded', create_function( '', '$extension = new ' . $group_extension_class . '; add_action( "wp", array( &$extension, "_register" ), 2 );' ));1167 add_action( 'bp_init', create_function( '', '$extension = new ' . $group_extension_class . '; add_action( "wp", array( &$extension, "_register" ), 2 );' ), 11 ); 1168 1168 } 1169 1169 -
trunk/bp-messages.php
r2737 r2761 92 92 93 93 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 94 if ( $bp->site_options['bp-messages-db-version']< BP_MESSAGES_DB_VERSION )94 if ( get_site_option( 'bp-messages-db-version' ) < BP_MESSAGES_DB_VERSION ) 95 95 messages_install(); 96 96 } -
trunk/bp-themes/bp-default/activity/entry.php
r2692 r2761 16 16 </div> 17 17 18 <?php if ( bp_ get_activity_content_body() ) : ?>18 <?php if ( bp_activity_has_content() ) : ?> 19 19 <div class="activity-inner"> 20 20 <?php bp_activity_content_body() ?> -
trunk/bp-themes/bp-default/functions.php
r2723 r2761 128 128 /**** 129 129 * Custom header image support. You can remove this entirely in a child theme by adding this line 130 * to your functions.php: remove_action( 'init', 'bp_dtheme_add_custom_header_support');130 * to your functions.php: define( 'BP_DTHEME_DISABLE_CUSTOM_HEADER', true ); 131 131 */ 132 132 function bp_dtheme_add_custom_header_support() { … … 200 200 add_custom_image_header( 'bp_dtheme_header_style', 'bp_dtheme_admin_header_style' ); 201 201 } 202 add_action( 'init', 'bp_dtheme_add_custom_header_support' ); 202 if ( !defined( 'BP_DTHEME_DISABLE_CUSTOM_HEADER' ) ) 203 add_action( 'init', 'bp_dtheme_add_custom_header_support' ); 203 204 204 205 /* Show a notice when the theme is activated - workaround by Ozh (http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html) */ … … 230 231 add_action( 'wp_footer', 'bp_dtheme_js_terms' ); 231 232 232 //Google Maps Shortcode233 function fn_googleMaps($atts, $content = null) {234 extract( shortcode_atts( array( "width" => '640', "height" => '480', "src" => '' ), $atts ) );235 return '<iframe width="'.$width.'" height="'.$height.'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'.$src.'"></iframe>';236 }237 add_shortcode( "googlemap", "fn_googleMaps" );238 239 233 ?> -
trunk/bp-xprofile.php
r2737 r2761 156 156 157 157 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 158 if ( $bp->site_options['bp-xprofile-db-version']< BP_XPROFILE_DB_VERSION )158 if ( get_site_option( 'bp-xprofile-db-version' ) < BP_XPROFILE_DB_VERSION ) 159 159 xprofile_install(); 160 160 }
Note: See TracChangeset
for help on using the changeset viewer.