Ticket #733: bp-core.patch
File bp-core.patch, 6.2 KB (added by , 16 years ago) |
---|
-
bp-core.php
23 23 if ( !defined( 'CUSTOM_USER_META_TABLE' ) ) 24 24 define( 'CUSTOM_USER_META_TABLE', $wpdb->base_prefix . 'usermeta' ); 25 25 26 /* Load the language file */27 if ( file_exists( BP_PLUGIN_DIR . '/bp-languages/buddypress-' . get_locale() . '.mo' ) )28 load_textdomain( 'buddypress', BP_PLUGIN_DIR . '/bp-languages/buddypress-' . get_locale() . '.mo' );29 30 26 /* Load the files containing functions that we globally will need. */ 31 27 require ( BP_PLUGIN_DIR . '/bp-core/bp-core-catchuri.php' ); 32 28 require ( BP_PLUGIN_DIR . '/bp-core/bp-core-classes.php' ); … … 158 154 $bp->current_component = $bp->default_component; 159 155 } 160 156 add_action( 'plugins_loaded', 'bp_core_setup_globals', 3 ); 161 add_action( '_admin_menu', 'bp_core_setup_globals', 1); // must be _admin_menu hook.157 add_action( '_admin_menu', 'bp_core_setup_globals', 3 ); // must be _admin_menu hook. 162 158 163 159 function bp_core_setup_root_components() { 164 160 /* Add core root components */ … … 168 164 bp_core_add_root_component( BP_SEARCH_SLUG ); 169 165 bp_core_add_root_component( BP_HOME_BLOG_SLUG ); 170 166 } 171 add_action( 'plugins_loaded', 'bp_core_setup_root_components', 1);167 add_action( 'plugins_loaded', 'bp_core_setup_root_components', 2 ); 172 168 173 169 function bp_core_setup_session() { 174 170 // Start a session for error/success feedback on redirect and for signup functions. … … 330 326 $bp->current_component = false; 331 327 332 328 wp_enqueue_script( 'bp-core-directory-members', BP_PLUGIN_URL . '/bp-core/js/directory-members.js', array( 'jquery', 'jquery-livequery-pack' ) ); 333 bp_core_load_template( apply_filters( 'bp_core_ template_directory_members', 'directories/members/index' ) );329 bp_core_load_template( apply_filters( 'bp_core_directory_members', 'directories/members/index' ) ); 334 330 } 335 331 } 336 332 add_action( 'wp', 'bp_core_directory_members', 5 ); … … 353 349 354 350 $ud = get_userdata($user_id); 355 351 356 return $bp->root_domain . '/'. BP_MEMBERS_SLUG . '/' . $ud->user_login . '/';352 return apply_filters('bp_core_get_user_domain', $bp->root_domain . '/') . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/'; 357 353 } 358 354 359 355 /** … … 367 363 * @return $domain The domain URL for the blog. 368 364 */ 369 365 function bp_core_get_root_domain() { 370 return get_blog_option( BP_ROOT_BLOG, 'siteurl');366 return apply_filters('bp_core_get_root_domain', get_blog_option( BP_ROOT_BLOG, 'siteurl' )); 371 367 } 372 368 373 369 /** … … 610 606 $user = BP_Core_User::get_random_users(1); 611 607 612 608 $ud = get_userdata( $user['users'][0]->user_id ); 613 bp_core_redirect( $bp->root_domain . '/'. BP_MEMBERS_SLUG . '/' . $ud->user_login );609 bp_core_redirect( apply_filters('bp_core_get_random_member', $bp->root_domain . '/') . BP_MEMBERS_SLUG . '/' . $ud->user_login ); 614 610 } 615 611 } 616 612 add_action( 'wp', 'bp_core_get_random_member', 6 ); … … 693 689 return false; 694 690 695 691 $ud = get_userdata($uid); 696 697 return $bp->root_domain . '/'. BP_MEMBERS_SLUG . '/' . $ud->user_login . '/';692 693 return apply_filters('bp_core_get_userurl', $bp->root_domain . '/') . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/'; 698 694 } 699 695 700 696 /** … … 737 733 */ 738 734 function bp_core_get_userlink( $user_id, $no_anchor = false, $just_link = false, $deprecated = false, $with_s = false ) { 739 735 global $userdata; 740 736 741 737 $ud = get_userdata($user_id); 742 738 743 739 if ( !$ud ) 744 740 return false; 745 741 … … 761 757 762 758 if ( !$url = bp_core_get_userurl($user_id) ) 763 759 return false; 764 760 761 $url = apply_filters('bp_core_get_userlink', $url); 762 765 763 if ( $just_link ) 766 764 return $url; 767 765 … … 1045 1043 // as this conflicts with wp_redirect() 1046 1044 $bp_no_status_set = true; 1047 1045 1048 wp_redirect( $location, $status );1046 wp_redirect( apply_filters('bp_core_redirect', $location), $status ); 1049 1047 die; 1050 1048 } 1051 1049 … … 1154 1152 return apply_filters( 'bp_core_set_member_theme_root_uri', WP_CONTENT_URL . '/bp-themes' ); 1155 1153 } 1156 1154 1155 /** 1156 * bp_get_member_theme_url() 1157 * 1158 * Get the url of the selected member theme. 1159 * 1160 * @package BuddyPress Core 1161 * @uses get_site_option() 1162 * @return The member theme URL 1163 */ 1164 function bp_get_member_theme_url() { 1165 return WP_CONTENT_URL . '/bp-themes/' . get_site_option( 'active-member-theme' ); 1166 } 1167 1168 /** 1169 * bp_get_member_theme_path() 1170 * 1171 * Get the path of the selected member theme. 1172 * 1173 * @package BuddyPress Core 1174 * @uses get_site_option() 1175 * @return The member theme path 1176 */ 1177 function bp_get_member_theme_path() { 1178 return WP_CONTENT_DIR . '/bp-themes/' . get_site_option( 'active-member-theme' ); 1179 } 1180 1157 1181 function bp_core_add_illegal_names() { 1158 1182 global $bp; 1159 1183 … … 1216 1240 return wpmu_delete_user( $bp->loggedin_user->id ); 1217 1241 } 1218 1242 1219 function bp_core_search_site( ) {1243 function bp_core_search_site( $search_which = '', $search_slug = '' ) { 1220 1244 global $bp; 1221 1245 1222 1246 if ( $bp->current_component == BP_SEARCH_SLUG ) { 1247 1248 // terms from text-box 1223 1249 $search_terms = $_POST['search-terms']; 1224 $search_which = $_POST['search-which']; 1225 1250 1251 // type from drop-down 1252 if (!$search_which) { 1253 $search_which = $_POST['search-which']; 1254 } 1255 1256 // core + other possibilities 1226 1257 switch ( $search_which ) { 1227 case 'members': default:1258 case 'members': 1228 1259 $search = BP_MEMBERS_SLUG; 1229 1260 break; 1230 1261 case 'groups': … … 1233 1264 case 'blogs': 1234 1265 $search = BP_BLOGS_SLUG; 1235 1266 break; 1267 default: 1268 if ( $search_which != '') { 1269 $search = $search_slug; 1270 } else { 1271 $search = BP_MEMBERS_SLUG; 1272 } 1273 break; 1236 1274 } 1237 1275 1238 1276 $search_url = apply_filters( 'bp_core_search_site', site_url( $search . '/?s=' . urlencode($search_terms) ), $search_terms ); 1239 1277 1240 1278 bp_core_redirect( $search_url ); 1241 1279 } 1242 1280 } … … 1333 1371 wp_cache_delete( 'newest_users' ); 1334 1372 } 1335 1373 1374 // Load the buddypress translation file for current language 1375 function bp_load_buddypress_textdomain() { 1376 $locale = get_locale(); 1377 $locale = apply_filters('buddypress_locale', $locale); 1378 $mofile = BP_PLUGIN_DIR . "/bp-languages/buddypress-$locale.mo"; 1379 load_textdomain( 'buddypress', $mofile ); 1380 } 1381 add_action ( 'plugins_loaded', 'bp_load_buddypress_textdomain', 9); 1382 1336 1383 // List actions to clear object caches on 1337 1384 add_action( 'bp_core_delete_avatar', 'bp_core_clear_user_object_cache' ); 1338 1385 add_action( 'bp_core_avatar_save', 'bp_core_clear_user_object_cache' );