Changeset 309
- Timestamp:
- 09/09/2008 06:52:13 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 106 added
- 4 deleted
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-blogs.php
r308 r309 3 3 4 4 define ( 'BP_BLOGS_IS_INSTALLED', 1 ); 5 define ( 'BP_BLOGS_VERSION', '0.1 ' );5 define ( 'BP_BLOGS_VERSION', '0.1.3' ); 6 6 7 7 /* These will be moved into admin configurable settings */ -
trunk/bp-core.php
r306 r309 5 5 6 6 /* Define the current version number for checking if DB tables are up to date. */ 7 define( 'BP_CORE_VERSION', '0.2. 3' );7 define( 'BP_CORE_VERSION', '0.2.4' ); 8 8 9 9 /* Require all needed files */ … … 11 11 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-classes.php' ); 12 12 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-cssjs.php' ); 13 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-thirdlevel.php' );14 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-settingstab.php' );15 13 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-avatars.php' ); 16 14 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-templatetags.php' ); 17 18 /* If disable blog tab option is set, don't combine blog tabs by skipping blogtab file */ 19 if ( !get_site_option('bp_disable_blog_tab') ) { 20 include_once(ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-blogtab.php'); 21 } 22 23 /* If admin settings have been posted, redirect to correct function to save settings */ 24 if ( isset($_POST['submit']) && $_POST['save_admin_settings'] && is_site_admin() ) { 25 bp_core_save_admin_settings(); 26 } 15 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-adminbar.php' ); 16 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/admin-mods/bp-core-remove-blogtabs.php' ); 17 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/admin-mods/bp-core-admin-styles.php' ); 18 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/homebase-creation/bp-core-homebase-functions.php' ); 27 19 28 20 /** … … 33 25 * 34 26 * @package BuddyPress Core Core 27 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() 35 28 * @global $current_user A WordPress global containing current user information 36 29 * @global $current_component Which is set up in /bp-core/bp-core-catch-uri.php … … 46 39 global $current_user, $current_component, $current_action; 47 40 global $action_variables; 48 41 49 42 $bp = array( 50 43 /* The user ID of the user who is currently logged in. */ … … 68 61 /* The action variables for the current action eg: http://andy.domain.com/profile/edit/ [group] / [6] */ 69 62 'action_variables' => $action_variables, // type: array 63 64 /* The default component to use if none are set and someone visits: http://andy.domain.com/ */ 65 'default_component' => 'profile', 70 66 71 67 /* Sets up the array container for the component navigation rendered by bp_get_nav() */ … … 90 86 'message_type' => '' // error/success 91 87 ); 88 89 if ( !$bp['current_component'] ) 90 $bp['current_component'] = $bp['default_component']; 92 91 } 93 92 add_action( 'wp', 'bp_core_setup_globals', 1 ); 94 add_action( 'admin_menu', 'bp_core_setup_globals' ); 95 96 /** 97 * bp_core_setup_nav() 98 * 99 * Adds "Blog" to the navigation arrays for the current and logged in user. 100 * $bp['bp_nav'] represents the main component navigation 101 * $bp['bp_users_nav'] represents the sub navigation when viewing a users 102 * profile other than that of the current logged in user. 93 add_action( '_admin_menu', 'bp_core_setup_globals', 1 ); // must be _admin_menu hook. 94 95 /** 96 * bp_core_component_exists() 97 * 98 * Check to see if a component with the given name actually exists. 99 * If not, redirect to the 404. 103 100 * 104 101 * @package BuddyPress Core 105 102 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() 106 * @uses bp_core_is_blog() Checks to see current page is a blog page eg: /blog/ or /archives/2008/09/01/ 107 * @uses bp_is_home() Checks to see if the current user being viewed is the logged in user 108 */ 109 function bp_core_setup_nav() { 110 global $bp; 111 112 /* Add "Blog" to the main component navigation */ 113 $bp['bp_nav'][1] = array( 114 'id' => 'blog', 115 'name' => 'Blog', 116 'link' => $bp['loggedin_domain'] . 'blog' 117 ); 118 119 /* Add "Blog" to the sub nav for a current user */ 120 $bp['bp_users_nav'][1] = array( 121 'id' => 'blog', 122 'name' => 'Blog', 123 'link' => $bp['current_domain'] . 'blog' 124 ); 125 126 /* This will be a check to see if profile or blog is set as the default component. */ 127 if ( $bp['current_component'] == '' ) { 128 if ( function_exists('xprofile_setup_nav') ) { 129 $bp['current_component'] = 'profile'; 130 } else { 131 $bp['current_component'] = 'blog'; 103 * @return false if no, or true if yes. 104 */ 105 function bp_core_component_exists() { 106 global $bp, $wpdb; 107 108 if ( $wpdb->blogid == get_usermeta( $bp['current_userid'], 'home_base' ) ) { 109 $component_check = $bp['current_component']; 110 111 if ( strpos( $component_check, 'activate.php' ) ) 112 return true; 113 114 if ( $component_check == 'profile' ) 115 $component_check = 'xprofile'; 116 117 if ( empty($bp[$component_check]) ) { 118 status_header('404'); 119 load_template( TEMPLATEPATH . '/header.php'); 120 load_template( TEMPLATEPATH . '/404.php'); 121 load_template( TEMPLATEPATH . '/footer.php'); 122 die; 132 123 } 133 /* If we are on a blog specific page, always set the current component to Blog */ 134 } else if ( bp_core_is_blog() ) { 135 $bp['current_component'] = 'blog'; 136 } 137 138 /* Set up the component options navigation for Blog */ 139 if ( $bp['current_component'] == 'blog' ) { 140 if ( bp_is_home() ) { 141 if ( function_exists('xprofile_setup_nav') ) { 142 $bp['bp_options_title'] = __('My Blog'); 143 $bp['bp_options_nav']['blog'] = array( 144 '' => array( 145 'name' => __('Public'), 146 'link' => $bp['loggedin_domain'] . 'blog/' ), 147 'admin' => array( 148 'name' => __('Blog Admin'), 149 'link' => $bp['loggedin_domain'] . 'wp-admin/' ) 150 ); 151 } 152 } else { 153 /* If we are not viewing the logged in user, set up the current users avatar and name */ 154 $bp['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 ); 155 $bp['bp_options_title'] = bp_user_fullname( $bp['current_userid'], false ); 156 } 157 } 158 } 159 add_action( 'wp', 'bp_core_setup_nav', 2 ); 124 } 125 } 126 add_action( 'wp', 'bp_core_component_exists', 10 ); 127 128 129 /** 130 * bp_core_add_settings_tab() 131 * 132 * Adds a custom settings tab to the home base for the user 133 * in the admin area. 134 * 135 * @package BuddyPress Core 136 * @global $menu The global WordPress admin navigation menu. 137 */ 138 function bp_core_add_settings_tab() { 139 global $menu; 140 141 $account_settings_tab = add_menu_page( __('Account'), __('Account'), 10, 'bp-core/admin-mods/bp-core-account-tab.php' ); 142 } 143 add_action( 'admin_menu', 'bp_core_add_settings_tab' ); 160 144 161 145 /** … … 167 151 * @package BuddyPress Core 168 152 * @global $current_user WordPress global variable containing current logged in user information 169 * @ uses bp_core_is_blog() Checks to see current page is a blog page eg: /blog/ or /archives/2008/09/01/170 * @uses bp_is_home() Checks to see if the current user being viewed is the logged in user171 */ 172 function bp_core_get_loggedin_domain( ) {153 * @param optional user_id 154 * @uses get_usermeta() WordPress function to get the usermeta for a current user. 155 */ 156 function bp_core_get_loggedin_domain( $user_id = null ) { 173 157 global $current_user; 174 158 175 if ( VHOST == 'yes' ) {176 $ loggedin_domain = PROTOCOL . get_usermeta( $current_user->ID, 'source_domain' ) . '/';177 } else {178 $loggedin_domain = PROTOCOL . get_usermeta( $current_user->ID, 'source_domain' ) . '/' . get_usermeta( $current_user->ID, 'user_login' ) . '/';179 }180 181 return $loggedin_domain;159 if ( !$user_id ) 160 $user_id = $current_user->ID; 161 162 /* Get the ID of the home base blog */ 163 $home_base_id = get_usermeta( $user_id, 'home_base' ); 164 165 return get_blog_option( $home_base_id, 'siteurl' ) . '/'; 182 166 } 183 167 … … 212 196 * 213 197 * @package BuddyPress Core 214 * @ uses bp_core_get_primary_username() Returns the username based on http:// [username] .site.com OR http://site.com/ [username]215 * @uses bp_core_get_user id() Returns the user id for the username given.216 * @return $current_userid The user id for the user that is currently being viewed .198 * @global $current_blog WordPress global containing information and settings for the current blog being viewed. 199 * @uses bp_core_get_user_home_userid() Checks to see if there is user_home usermeta set for the current_blog. 200 * @return $current_userid The user id for the user that is currently being viewed, return zero if this is not a user home and just a normal blog. 217 201 */ 218 202 function bp_core_get_current_userid() { 219 $siteuser = bp_core_get_primary_username(); 220 $current_userid = bp_core_get_userid($siteuser); 203 global $current_blog; 204 205 /* Get the ID of the current blog being viewed. */ 206 $blog_id = $current_blog->blog_id; 207 208 /* Check to see if this is a user home, and if it is, get the user id */ 209 if ( !$current_userid = bp_core_get_homebase_userid( $blog_id ) ) 210 return false; // return 0 if this is a normal blog, and not a user home. 221 211 222 212 return $current_userid; 213 } 214 215 /** 216 * bp_core_get_user_home_userid() 217 * 218 * Checks to see if there is user_home usermeta set for the current_blog. 219 * If it is set, return the user_id, if not, return false. 220 * 221 * @package BuddyPress Core 222 * @param $blog_id The ID of the blog to check user_home metadata for. 223 * @global $wpdb WordPress DB access object. 224 * @return $current_userid The user id for the home base. 225 */ 226 function bp_core_get_homebase_userid( $blog_id ) { 227 global $wpdb; 228 229 return $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM " . $wpdb->base_prefix . "usermeta WHERE meta_key = 'home_base' AND meta_value = %d", $blog_id ) ); 230 } 231 232 /** 233 * bp_core_is_home_base() 234 * 235 * Checks a blog id to see if it is a home base or not. 236 * 237 * @package BuddyPress Core 238 * @param $blog_id The ID of the blog to check user_home metadata for. 239 * @global $wpdb WordPress DB access object. 240 * @return $current_userid The user id for the home base. 241 */ 242 function bp_core_is_home_base( $blog_id ) { 243 global $wpdb; 244 245 if ( $wpdb->get_var( $wpdb->prepare( "SELECT umeta_id FROM " . $wpdb->base_prefix . "usermeta WHERE meta_key = 'home_base' AND meta_value = %d", $blog_id ) ) ) 246 return true; 247 248 return false; 249 } 250 251 /** 252 * bp_core_user_has_home() 253 * 254 * Checks to see if a user has assigned a blog as their user_home. 255 * 256 * @package BuddyPress Core 257 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() 258 * @uses get_usermeta() WordPress function to get the usermeta for a current user. 259 * @return false if no, or true if yes. 260 */ 261 function bp_core_user_has_home() { 262 global $bp; 263 264 if ( get_usermeta( $bp['loggedin_userid'], 'home_base' ) == '' ) 265 return false; 266 267 return true; 223 268 } 224 269 … … 297 342 $options = array(); 298 343 299 $ primary_blog = get_usermeta( $current_user->ID, 'primary_blog' );344 $home_base = get_usermeta( $current_user->ID, 'home_base' ); 300 345 301 346 foreach ( $blogs = get_blogs_of_user( $current_user->ID ) as $blog ) { … … 307 352 $domain = $parsed['host']; 308 353 309 if ( $blog->userblog_id == $ primary_blog) {354 if ( $blog->userblog_id == $home_base ) { 310 355 $current = ' id="primary_blog"'; 311 356 $image = ' style="background-image: url(' . get_option('home') . '/wp-content/mu-plugins/bp-core/images/member.png); … … 378 423 } 379 424 380 /** 381 * bp_core_add_settings_tab() 382 * 383 * Adds a new submenu page under the Admin Settings tab for BuddyPress specific settings. 384 * 385 * @package BuddyPress Core 386 * @param $add_submenu_pag str The contents of the buffer. 387 * @uses add_submenu_page() WordPress function for adding submenu pages to existing admin area menus. 388 */ 389 function bp_core_add_settings_tab() { 390 add_submenu_page( 'wpmu-admin.php', "BuddyPress", "BuddyPress", 1, basename(__FILE__), "bp_core_admin_settings" ); 391 } 392 add_action( 'admin_menu', 'bp_core_add_settings_tab' ); 393 394 /** 395 * bp_core_admin_settings() 396 * 397 * Renders the admin area settings for BuddyPress 398 * 399 * @package BuddyPress Core 400 * @uses get_site_option() Fetches sitemeta based on setting name passed 401 */ 402 function bp_core_admin_settings() { 403 if ( get_site_option('bp_disable_blog_tab') ) { 404 $blog_tab_checked = ' checked="checked"'; 405 } 406 407 if ( get_site_option('bp_disable_design_tab') ) { 408 $design_tab_checked = ' checked="checked"'; 409 } 410 411 ?> 412 <div class="wrap"> 413 414 <h2><?php _e("BuddyPress Settings") ?></h2> 415 416 <form action="" method="post"> 417 <table class="form-table"> 418 <tbody> 419 <tr valign="top"> 420 <th scope="row" valign="top">Tabs</th> 421 <td> 422 <input type="checkbox" value="1" name="disable_blog_tab"<?php echo $blog_tab_checked; ?> /> 423 <label for="disable_blog_tab"> Disable merging of 'Write', 'Manage' and 'Comments' into one 'Blog' tab.</label> 424 <br /> 425 <input type="checkbox" value="1" name="disable_design_tab"<?php echo $design_tab_checked; ?> /> 426 <label for="disable_design_tab"> Disable 'Design' tab for all members except site administrators.</label> 427 </td> 428 </tr> 429 </tbody> 430 </table> 431 432 <p class="submit"> 433 <input name="submit" value="Save Changes" type="submit" /> 434 </p> 435 436 <input type="hidden" name="save_admin_settings" value="1" /> 437 </form> 438 439 </div> 440 <?php 441 } 442 443 /** 444 * bp_core_save_admin_settings() 445 * 446 * Saves the administration settings once the admin settings form has been posted. 447 * Checks first to see if the current user is a site administrator. 448 * 449 * @package BuddyPress Core 450 * @param $contents str The contents of the buffer. 451 * @uses is_site_admin() WordPress function to check if current user has site admin privileges. 452 * @uses add_site_option() WordPress function to add or update sitemeta based on passed meta name. 453 */ 454 function bp_core_save_admin_settings() { 455 if ( !is_site_admin() ) 456 return false; 457 458 if ( !isset($_POST['disable_blog_tab']) ) { 459 $_POST['disable_blog_tab'] = 0; 460 } 461 else if ( !isset($_POST['disable_design_tab']) ) 462 { 463 $_POST['disable_design_tab'] = 0; 464 } 465 466 // temp code for now, until full settings page is added 467 add_site_option( 'bp_disable_blog_tab', $_POST['disable_blog_tab'] ); 468 add_site_option( 'bp_disable_design_tab', $_POST['disable_design_tab'] ); 469 } 470 471 // Commenting out dashboard replacement for now, until more is implemented. 472 473 // /* Are we viewing the dashboard? */ 474 // if ( strpos( $_SERVER['SCRIPT_NAME'],'/index.php') ) { 475 // add_action( 'admin_head', 'start_dash' ); 476 // } 477 478 // function start_dash($dash_contents) { 479 // ob_start(); 480 // add_action('admin_footer', 'end_dash'); 481 // } 482 // 483 // function replace_dash($dash_contents) { 484 // $filter = preg_split( '/\<div class=\"wrap\"\>[\S\s]*\<div id=\"footer\"\>/', $dash_contents ); 485 // $filter[0] .= '<div class="wrap">'; 486 // $filter[1] .= '</div>'; 487 // 488 // echo $filter[0]; 489 // echo render_dash(); 490 // echo '<div style="clear: both"> <br clear="all" /></div></div><div id="footer">'; 491 // echo $filter[1]; 492 // } 493 // 494 // function end_dash() { 495 // $dash_contents = ob_get_contents(); 496 // ob_end_clean(); 497 // replace_dash($dash_contents); 498 // } 499 // 500 // function render_dash() { 501 // $dash .= ' 502 // 503 // <h2>' . __("My Activity Feed") . '</h2> 504 // <p>' . __("This is where your personal activity feed will go.") . '</p> 505 // <p> </p><p> </p> 506 // '; 507 // 508 // if ( is_site_admin() ) { 509 // $dash .= ' 510 // 511 // <h4>Admin Options</h4> 512 // <ul> 513 // <li><a href="wpmu-blogs.php">' . __("Manage Site Members") . '</a></li> 514 // <li><a href="wpmu-options.php">' . __("Manage Site Options") . '</a></li> 515 // '; 516 // 517 // } 518 // return $dash; 519 // } 425 function bp_core_replace_home_base_dashboard() { 426 global $wpdb, $bp; 427 428 if ( strpos( $_SERVER['SCRIPT_NAME'], '/index.php' ) && $wpdb->blogid == get_usermeta( $bp['current_userid'], 'home_base' ) ) { 429 add_action( 'admin_head', 'bp_core_start_dash_replacement' ); 430 } 431 } 432 add_action( 'admin_menu', 'bp_core_replace_home_base_dashboard' ); 433 434 function bp_core_start_dash_replacement( $dash_contents ) { 435 ob_start(); 436 add_action('admin_footer', 'bp_core_end_dash_replacement'); 437 } 438 439 function bp_core_insert_new_dashboard( $dash_contents ) { 440 global $bp; 441 442 $filter = preg_split( '/\<div class=\"wrap\"\>[\S\s]*\<div id=\"footer\"\>/', $dash_contents ); 443 $filter[0] .= '<div class="wrap">'; 444 $filter[1] .= '</div>'; 445 446 echo $filter[0]; 447 448 require_once( ABSPATH . '/wp-content/mu-plugins/bp-core/admin-mods/bp-core-homebase-dashboard.php' ); 449 450 echo '<div style="clear: both"> <br clear="all" /></div></div><div id="footer">'; 451 echo $filter[1]; 452 } 453 454 function bp_core_end_dash_replacement() { 455 $dash_contents = ob_get_contents(); 456 ob_end_clean(); 457 bp_core_insert_new_dashboard($dash_contents); 458 } 520 459 521 460 /** … … 574 513 */ 575 514 function bp_core_get_userurl( $uid ) { 576 global $userdata; 577 578 $ud = get_userdata($uid); 579 580 if ( VHOST == 'no' ) 581 $ud->path = $ud->user_login; 582 else 583 $ud->path = null; 584 585 $url = PROTOCOL . $ud->source_domain . '/' . $ud->path; 586 587 if ( !$ud ) 588 return false; 589 590 return $url; 515 $home_base_id = get_usermeta( $uid, 'home_base' ); 516 $home_base_url = get_blog_option( $home_base_id, 'siteurl' ) . '/'; 517 518 return $home_base_url; 591 519 } 592 520 … … 637 565 638 566 if ( function_exists('bp_user_fullname') ) 639 $display_name = bp_user_fullname( $uid, false);567 $display_name = bp_user_fullname( $uid, false ); 640 568 else 641 569 $display_name = $ud->display_name; … … 646 574 if ( $no_anchor ) 647 575 return $display_name; 648 649 if ( VHOST == 'no' ) 650 $ud->path = $ud->user_login; 651 else 652 $ud->path = null; 576 577 $home_base_id = get_usermeta( $uid, 'home_base' ); 578 579 if ( !$home_base_id ) 580 return false; 581 582 $home_base_url = get_blog_option( $home_base_id, 'siteurl' ) . '/'; 653 583 654 584 if ( $just_link ) 655 return PROTOCOL . $ud->source_domain . '/' . $ud->path; 656 657 return '<a href="' . PROTOCOL . $ud->source_domain . '/' . $ud->path . '">' . $display_name . '</a>'; 585 return $home_base_url; 586 587 return '<a href="' . $home_base_url . '">' . $display_name . '</a>'; 588 } 589 590 /** 591 * bp_core_get_userlink_by_email() 592 * 593 * Returns the email address for the user based on user ID 594 * 595 * @package BuddyPress Core 596 * @param $email str The email address for the user. 597 * @uses bp_core_get_userlink() BuddyPress function to get a userlink by user ID. 598 * @uses get_user_by_email() WordPress function to get userdata via an email address 599 * @return str The link to the users home base. False on no match. 600 */ 601 function bp_core_get_userlink_by_email( $email ) { 602 $user = get_user_by_email( $email ); 603 return bp_core_get_userlink( $user->ID, false, false, true ); 658 604 } 659 605 … … 796 742 797 743 return $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type = 'page'", $page_title) ); 798 }799 800 /**801 * bp_core_is_blog()802 *803 * Checks to see if the current page is part of the blog.804 * Some example blog pages:805 * - Single post, Archives, Categories, Tags, Pages, Blog Home, Search Results ...806 *807 * @package BuddyPress Core808 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()809 * @global $cached_page_id The page id of the current page if cached810 * @uses is_tag() WordPress function to check if on tags page811 * @uses is_category() WordPress function to check if on category page812 * @uses is_day() WordPress function to check if on day page813 * @uses is_month() WordPress function to check if on month page814 * @uses is_year() WordPress function to check if on year page815 * @uses is_paged() WordPress function to check if on page816 * @uses is_single() WordPress function to check if on single post page817 * @return bool true if818 * @return bool false on no match.819 */820 function bp_core_is_blog() {821 global $bp, $cached_page_id;822 823 $blog_page_id = bp_get_page_id('Blog');824 if ( is_tag() || is_category() || is_day() || is_month() || is_year() || is_paged() || is_single() )825 return true;826 if ( isset($cached_page_id) && ( $blog_page_id == $cached_page_id ) )827 return true;828 if ( is_page('Blog') )829 return true;830 if ( $bp['current_component'] == 'blog' )831 return true;832 833 return false;834 744 } 835 745 … … 945 855 add_action( 'login_head', 'bp_core_record_activity' ); 946 856 857 /** 858 * bp_core_get_all_posts_for_user() 859 * 860 * Fetch every post that is authored by the given user for the current blog. 861 * 862 * @package BuddyPress Core 863 * @global $bp WordPress user data for the current logged in user. 864 * @global $wpdb WordPress user data for the current logged in user. 865 * @return array of post ids. 866 */ 867 function bp_core_get_all_posts_for_user( $user_id = null ) { 868 global $bp, $wpdb; 869 870 if ( !$user_id ) 871 $user_id = $bp['current_userid']; 872 873 return $wpdb->get_col( $wpdb->prepare( "SELECT post_id FROM $wpdb->posts WHERE post_author = %d AND post_status = 'publish' AND post_type = 'post'", $user_id ) ); 874 } 875 876 /** 877 * bp_core_replace_comment_author_link() 878 * 879 * Replace the author link on comments to point to a user home base. 880 * 881 * @package BuddyPress Core 882 * @global $comment WordPress comment global for the current comment. 883 * @uses bp_core_get_userlink_by_email() Fetches a userlink via email address. 884 */ 885 function bp_core_replace_comment_author_link( $author ) { 886 global $comment; 887 888 $bp_author_link = bp_core_get_userlink_by_email( $comment->comment_author_email ); 889 890 echo ( !$bp_author_link ) ? $author : $bp_author_link; 891 } 892 add_action( 'get_comment_author_link', 'bp_core_replace_comment_author_link', 10, 4 ); 893 947 894 948 895 ?> -
trunk/bp-core/bp-core-avatars.php
r304 r309 17 17 define( 'CORE_MAX_FILE_SIZE', get_site_option('fileupload_maxk') * 1024 ); 18 18 define( 'CORE_DEFAULT_AVATAR', get_option('siteurl') . '/wp-content/mu-plugins/bp-xprofile/images/none.gif' ); 19 20 /** 21 * bp_core_blog_switcher() 22 * 23 * Replaces the standard blog switcher included in the WordPress core so that 24 * BuddyPress specific icons can be used in tabs and the order can be changed. 25 * An output buffer is used, as the function cannot be overridden or replaced 26 * any other way. 27 * 28 * @package BuddyPress Core 29 * @param $contents str The contents of the buffer. 30 * @global $current_user obj WordPress global containing information and settings for the current user 31 * @global $blog_id int WordPress global containing the current blog id 32 * @return $siteuser Username for current blog or user home. 33 */ 34 function bp_core_get_avatar( $user, $version = 1, $in_css = false ) { 19 define( 'CORE_DEFAULT_AVATAR_THUMB', get_option('siteurl') . '/wp-content/mu-plugins/bp-xprofile/images/none-thumbnail.gif' ); 20 21 function bp_core_get_avatar( $user, $version = 1, $no_tag = false, $width = null, $height = null ) { 35 22 if ( !is_int($version) ) 36 23 $version = (int) $version; … … 39 26 $version = 1; 40 27 28 $home_base_id = get_usermeta( $user, 'home_base' ); 29 $url = get_blog_option($home_base_id, 'siteurl'); 30 31 if ( !$width ) 32 $width = constant('CORE_AVATAR_V' . $version . '_W'); 33 34 if ( !$height ) 35 $width = constant('CORE_AVATAR_V' . $version . '_H'); 36 41 37 $str = get_usermeta( $user, "bp_core_avatar_v$version" ); 42 38 43 39 if ( strlen($str) ) { 44 if ( $ in_css)40 if ( $no_tag ) 45 41 return $str; 46 42 else 47 return '<img src="' . $ str . '" alt="" class="avatar" width="' . constant('CORE_AVATAR_V' . $version . '_W') . '" height="' . constant('CORE_AVATAR_V' . $version . '_H'). '" />';43 return '<img src="' . $url . '/' . $str . '" alt="" class="avatar" width="' . $width . '" height="' . $height . '" />'; 48 44 } else { 49 if ( $ in_css)50 return CORE_DEFAULT_AVATAR ;45 if ( $no_tag ) 46 return CORE_DEFAULT_AVATAR_THUMB; 51 47 else 52 return '<img src="' . CORE_DEFAULT_AVATAR . '" alt="" class="avatar" width="' . constant('CORE_AVATAR_V' . $version . '_W') . '" height="' . constant('CORE_AVATAR_V' . $version . '_H') . '" />'; 53 } 54 } 55 56 // Load the cropper etc if we're on the right page 57 if ( isset($_REQUEST['page']) && $_REQUEST['page'] == 'bp-xprofile.php' ) { 58 wp_enqueue_script('cropper'); 59 } 60 61 // // Override internal "get_avatar()" function to use our own where possible 62 // // WARNING: Does NOT apply size restrictions 63 // function bp_core_get_avatar_filter( $avatar, $id_or_email, $size, $default ) { 64 // $str = ''; 65 // $ver = ( $size == 1 || $size == 2 ) ? $size : 1; 66 // 67 // if ( CORE_AVATAR_V2_W == false && CORE_AVATAR_V2_H == false ) 68 // $ver = 1; 69 // 70 // if ( is_numeric($id_or_email) ) { 71 // $str = bp_core_get_avatar( $id_or_email, $ver ); 72 // } elseif ( is_object($id_or_email) ) { 73 // if ( !empty($id_or_email->user_id) ) { 74 // $str = bp_core_get_avatar( $id_or_email->user_id, $ver ); 75 // } 76 // } 77 // 78 // return empty($str) ? $avatar : $str; 79 // } 80 // add_filter( 'get_avatar', 'bp_core_get_avatar_filter', 10, 4 ); 48 return '<img src="' . CORE_DEFAULT_AVATAR . '" alt="" class="avatar" width="' . $width . '" height="' . $height . '" />'; 49 } 50 } 51 52 // Override internal "get_avatar()" function to use our own where possible 53 // WARNING: Does NOT apply size restrictions 54 function bp_core_get_avatar_filter( $avatar, $id_or_email, $size, $default ) { 55 $str = ''; 56 $ver = ( $size == 1 || $size == 2 ) ? $size : 1; 57 58 if ( CORE_AVATAR_V2_W == false && CORE_AVATAR_V2_H == false ) 59 $ver = 1; 60 61 if ( is_numeric($id_or_email) ) { 62 $str = bp_core_get_avatar( $id_or_email, $ver ); 63 } elseif ( is_object($id_or_email) ) { 64 if ( !empty($id_or_email->user_id) ) { 65 $str = bp_core_get_avatar( $id_or_email->user_id, $ver ); 66 } 67 } 68 69 return empty($str) ? $avatar : $str; 70 } 71 add_filter( 'get_avatar', 'bp_core_get_avatar_filter', 10, 4 ); 81 72 82 73 83 74 // Main UI Rendering 84 function bp_core_avatar_admin( $message = null, $action = null) {75 function bp_core_avatar_admin( $message = null, $action = null, $delete_action = null ) { 85 76 ?> 86 77 <?php if ( !isset($_POST['slick_avatars_action']) && !isset($_GET['slick_avatars_action']) ) { ?> … … 100 91 <?php 101 92 if ( !$action ) 102 $action = get_option('home') . '/wp-admin/admin.php?page=bp-xprofile.php'; 93 $action = get_option('siteurl') . '/wp-admin/admin.php?page=bp-xprofile.php'; 94 95 if ( !$delete_action ) 96 $delete_action = get_option('siteurl') . '/wp-admin/admin.php?page=bp-xprofile.php&slick_avatars_action=delete'; 103 97 104 98 bp_core_render_avatar_upload_form($action); … … 109 103 echo '<span class="crop-img avatar">' . bp_core_get_avatar(get_current_user_id(), 1) . '</span>'; 110 104 echo '<span class="crop-img avatar">' . bp_core_get_avatar(get_current_user_id(), 2) . '</span>'; 111 echo '<a href="' . get_option('siteurl') . '/wp-admin/admin.php?page=bp-xprofile.php&slick_avatars_action=delete">Delete</a>';105 echo '<a href="' . $delete_action . '">Delete</a>'; 112 106 } 113 107 … … 243 237 } 244 238 245 function bp_core_render_avatar_cropper($original, $new, $action, $user_id = null, $no_form_tag = false ) {239 function bp_core_render_avatar_cropper($original, $new, $action, $user_id = null, $no_form_tag = false, $url = false) { 246 240 $size = getimagesize($new); 247 241 248 242 if ( !$user_id ) 249 243 $user_id = get_current_user_id(); 250 251 if ( VHOST == 'yes' ) { 252 $url = PROTOCOL . get_usermeta( $user_id, 'source_domain' ) . '/'; 253 } else { 254 $url = PROTOCOL . get_usermeta( $user_id, 'source_domain' ) . '/' . get_usermeta( $user_id, 'nickname' ) . '/'; 244 245 if ( !$url ) { 246 $home_base_id = get_usermeta( $user_id, 'home_base' ); 247 $url = get_blog_option($home_base_id, 'siteurl'); 255 248 } 256 249 … … 261 254 // V1 UI 262 255 if ( !$no_form_tag ) 263 echo '<form action="' . $action . '" method="post" >';256 echo '<form action="' . $action . '" method="post" id="avatar-cropper">'; 264 257 265 258 echo '<input type="hidden" name="slick_avatars_action" value="crop" />'; … … 393 386 } 394 387 395 function bp_core_avatar_save( $vars, $user_id = false, $upload_dir = false ) {388 function bp_core_avatar_save( $vars, $user_id = false, $upload_dir = false, $url = false ) { 396 389 if ( !$user_id ) 397 390 $user_id = get_current_user_id(); 398 391 399 if ( VHOST == 'yes' ) { 400 $src = PROTOCOL . get_usermeta( $user_id, 'source_domain' ) . '/'; 401 } else { 402 $src = PROTOCOL . get_usermeta( $user_id, 'source_domain' ) . '/' . get_usermeta( $user_id, 'nickname' ) . '/'; 392 if ( !$url ) { 393 $home_base_id = get_usermeta( $user_id, 'home_base' ); 394 $url = get_blog_option($home_base_id, 'siteurl'); 403 395 } 404 396 … … 420 412 function bp_core_render_avatar_upload_form($action, $no_form_tag = false) { 421 413 if ( !$no_form_tag ) { ?> 422 <form method="post" action="<?php echo $action ?>" enctype="multipart/form-data" >414 <form method="post" action="<?php echo $action ?>" enctype="multipart/form-data" id="avatar-upload"> 423 415 <?php } ?> 424 416 <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo CORE_MAX_FILE_SIZE; ?>" /> -
trunk/bp-core/bp-core-catchuri.php
r304 r309 76 76 $action_variables = array_merge( array(), $action_variables ); 77 77 78 /* catch 'blog' */79 if ( $current_component == 'blog' )80 bp_catch_uri( 'blog' );81 78 } 82 79 add_action( 'wp', 'bp_core_set_uri_globals', 0 ); … … 110 107 */ 111 108 function bp_core_do_catch_uri() { 112 global $bp_path ;109 global $bp_path, $bp, $wpdb; 113 110 114 111 $pages = $bp_path; 112 113 if ( $wpdb->blogid == get_usermeta( $bp['current_userid'], 'home_base' ) ) { 114 if ( !file_exists( TEMPLATEPATH . "/header.php" ) || !file_exists( TEMPLATEPATH . "/footer.php" ) ) 115 wp_die( 'Please make sure your BuddyPress enabled theme includes a header.php and footer.php file.'); 115 116 116 if ( is_array( $pages ) ) { 117 foreach( $pages as $page ) { 118 if ( file_exists( TEMPLATEPATH . "/" . $page . ".php" ) ) { 119 require( TEMPLATEPATH . "/" . $page . ".php" ); die; 117 do_action( 'get_header' ); 118 load_template( TEMPLATEPATH . "/header.php" ); 119 120 if ( is_array( $pages ) ) { 121 foreach( $pages as $page ) { 122 if ( file_exists( TEMPLATEPATH . "/" . $page . ".php" ) ) { 123 load_template( TEMPLATEPATH . "/" . $page . ".php" ); 124 } 125 } 126 } else { 127 if ( file_exists( TEMPLATEPATH . "/" . $pages . ".php" ) ) { 128 load_template( TEMPLATEPATH . "/" . $pages . ".php" ); 129 } else { 130 load_template( TEMPLATEPATH . "/index.php" ); 120 131 } 121 132 } 122 } else { 123 if ( file_exists( TEMPLATEPATH . "/" . $pages . ".php" ) ) { 124 require( TEMPLATEPATH . "/" . $pages . ".php" ); die; 125 } else { 126 require( TEMPLATEPATH . "/index.php" ); die; 127 } 133 134 do_action( 'get_footer' ); 135 load_template( TEMPLATEPATH . "/footer.php" ); 136 die; 128 137 } 129 138 } -
trunk/bp-core/bp-core-classes.php
r304 r309 16 16 var $id; 17 17 var $avatar; 18 var $avatar_thumb; 19 var $avatar_mini; 18 20 var $fullname; 19 21 var $email; … … 77 79 78 80 if ( BP_XPROFILE_IS_INSTALLED ) { 79 $this->avatar = bp_core_get_avatar( $this->id, 1 ); 81 $this->avatar = bp_core_get_avatar( $this->id, 2 ); 82 $this->avatar_thumb = bp_core_get_avatar( $this->id, 1 ); 83 $this->avatar_mini = bp_core_get_avatar( $this->id, 1, false, 25, 25 ); 84 80 85 $this->profile_last_updated = bp_profile_last_updated_date( $this->id, false ); 81 86 } -
trunk/bp-core/bp-core-cssjs.php
r304 r309 18 18 } 19 19 add_action( 'wp_head', 'bp_core_add_js' ); 20 //add_action( 'admin_menu', 'core_add_js' );x 20 21 /** 22 * bp_core_add_css() 23 * 24 * Add the CSS required by all BP components, regardless of the current theme. 25 * 26 * @package BuddyPress Core 27 * @uses get_option() Selects a site setting from the DB. 28 */ 29 function bp_core_add_css() { 30 if ( bp_core_user_has_home() && is_user_logged_in() ) 31 echo '<link rel="stylesheet" href="' . get_option('siteurl') . '/wp-content/mu-plugins/bp-core/css/admin-bar.css" type="text/css" />'; 32 } 33 add_action( 'wp_head', 'bp_core_add_css' ); 34 35 function bp_core_add_admin_js() { 36 if ( strpos( $_GET['page'], 'bp-core' ) !== false ) { 37 wp_enqueue_script( 'bp-account-admin-js', get_option('siteurl') . '/wp-content/mu-plugins/bp-core/js/account-admin.js' ); 38 } 39 } 40 add_action( 'admin_menu', 'bp_core_add_admin_js' ); 41 42 function bp_core_enqueue_admin_js() { 43 if ( strpos( $_GET['page'], 'bp-core/admin-mods' ) !== false ) { 44 wp_enqueue_script('password-strength-meter'); 45 } 46 47 if ( strpos( $_GET['page'], 'bp-core/homebase-creation' ) !== false ) { 48 add_action( 'admin_head', 'bp_core_add_cropper_js' ); 49 } 50 } 51 add_action( 'admin_menu', 'bp_core_enqueue_admin_js' ); 52 53 function bp_core_enqueue_admin_css() { 54 if ( strpos( $_GET['page'], 'bp-core/homebase-creation' ) !== false ) { 55 wp_enqueue_style( 'bp-core-home-base-css', get_option('siteurl') . '/wp-content/mu-plugins/bp-core/css/home-base.css' ); 56 } 57 } 58 add_action( 'admin_menu', 'bp_core_enqueue_admin_css' ); -
trunk/bp-core/bp-core-templatetags.php
r304 r309 41 41 if ( $bp['current_userid'] != $bp['loggedin_userid'] ) { 42 42 if ( function_exists('friends_check_friendship') ) { 43 if ( friends_check_friendship( $bp['current_userid']) && $nav_item['id'] == $bp['friends']['bp_friends_slug'] ) {43 if ( friends_check_friendship( $bp['current_userid'] ) == 'is_friend' && $nav_item['id'] == $bp['friends']['slug'] ) { 44 44 $selected = ' class="current"'; 45 45 } else { … … 89 89 90 90 /* If the current action or an action variable matches the nav item id, then add a highlight CSS class. */ 91 if ( $slug == $bp['current_action'] || $slug == $bp['action_variables'][0] || ( $slug == '' && ( $bp['current_component'] == 'blog' && bp_is_blog() ) )) {91 if ( $slug == $bp['current_action'] || $slug == $bp['action_variables'][0] ) { 92 92 $selected = ' class="current"'; 93 93 } else { … … 119 119 global $bp; 120 120 121 foreach ( $bp['bp_users_nav'] as $user_nav_item ) { 121 /* Sort the nav by key as the array has been put together in different locations */ 122 ksort($bp['bp_users_nav']); 123 124 foreach ( $bp['bp_users_nav'] as $user_nav_item ) { 122 125 if ( $bp['current_component'] == $user_nav_item['id'] ) { 123 126 $selected = ' class="current"'; … … 210 213 } 211 214 212 function bp_is_blog() { 213 return bp_core_is_blog(); 215 function bp_my_or_name() { 216 global $bp; 217 218 if ( $bp['current_userid'] == $bp['loggedin_userid'] ) { 219 _e('My'); 220 } else { 221 echo $bp['bp_options_title'] . "'s"; 222 } 223 } 224 225 function bp_you_or_name() { 226 global $bp; 227 228 if ( $bp['current_userid'] == $bp['loggedin_userid'] ) { 229 _e('You haven\'t'); 230 } else { 231 echo $bp['bp_options_title'] . " hasn't"; 232 } 233 } 234 235 function bp_your_or_name() { 236 global $bp; 237 238 if ( $bp['current_userid'] == $bp['loggedin_userid'] ) { 239 _e('Your'); 240 } else { 241 echo $bp['bp_options_title'] . "'s"; 242 } 214 243 } 215 244 -
trunk/bp-core/js/general.js
r237 r309 47 47 for(var i=0; i<radioButtons.length; i++) { 48 48 radioButtons[i].checked = false; 49 } 50 } 51 52 /* For admin-bar */ 53 sfHover = function() { 54 var sfEls = document.getElementById("nav").getElementsByTagName("LI"); 55 for (var i=0; i<sfEls.length; i++) { 56 sfEls[i].onmouseover=function() { 57 this.className+=" sfhover"; 58 } 59 sfEls[i].onmouseout=function() { 60 this.className=this.className.replace(new RegExp(" sfhover\\b"), ""); 61 } 49 62 } 50 51 63 } 64 if (window.attachEvent) window.attachEvent("onload", sfHover); -
trunk/bp-friends.php
r304 r309 55 55 } 56 56 add_action( 'wp', 'friends_setup_globals', 1 ); 57 add_action( ' admin_menu', 'friends_setup_globals');57 add_action( '_admin_menu', 'friends_setup_globals', 1 ); 58 58 59 59 … … 68 68 global $wpdb, $bp, $userdata; 69 69 70 if ( $wpdb->blogid == $userdata->primary_blog ) { 71 //add_menu_page( __("Friends"), __("Friends"), 1, basename(__FILE__), "friends_list" ); 72 //add_submenu_page( basename(__FILE__), __("My Friends"), __("My Friends"), 1, basename(__FILE__), "friends_list" ); 73 //add_submenu_page( basename(__FILE__), __("Friend Finder"), __("Friend Finder"), 1, "friend_finder", "friends_find" ); 74 70 if ( $wpdb->blogid == get_usermeta( $bp['current_userid'], 'home_base' ) ) { 75 71 /* Add the administration tab under the "Site Admin" tab for site administrators */ 76 72 //add_submenu_page( 'wpmu-admin.php', __("Friends"), __("Friends"), 1, basename(__FILE__), "friends_settings" ); … … 80 76 if ( ( $wpdb->get_var("show tables like '%" . $bp['friends']['table_name'] . "%'") == false ) || ( get_site_option('bp-friends-version') < BP_FRIENDS_VERSION ) ) 81 77 friends_install(BP_FRIENDS_VERSION); 82 83 78 } 84 79 add_action( 'admin_menu', 'friends_add_admin_menu' ); … … 104 99 'link' => $bp['current_domain'] . $bp['friends']['slug'] . '/' 105 100 ); 101 102 $bp['bp_options_nav'][$bp['friends']['slug']] = array( 103 'my-friends' => array( 104 'name' => __('My Friends'), 105 'link' => $bp['loggedin_domain'] . $bp['friends']['slug'] . '/my-friends' ), 106 'requests' => array( 107 'name' => __('Requests'), 108 'link' => $bp['loggedin_domain'] . $bp['friends']['slug'] . '/requests' ), 109 'friend-finder' => array( 110 'name' => __('Friend Finder'), 111 'link' => $bp['loggedin_domain'] . $bp['friends']['slug'] . '/friend-finder' ), 112 'invite-friend' => array( 113 'name' => __('Invite Friends'), 114 'link' => $bp['loggedin_domain'] . $bp['friends']['slug'] . '/invite-friend' ) 115 ); 106 116 107 117 if ( $bp['current_component'] == $bp['friends']['slug'] ) { 108 118 if ( bp_is_home() ) { 109 119 $bp['bp_options_title'] = __('My Friends'); 110 $bp['bp_options_nav'][$bp['friends']['slug']] = array(111 'my-friends' => array(112 'name' => __('My Friends'),113 'link' => $bp['loggedin_domain'] . $bp['friends']['slug'] . '/my-friends' ),114 'requests' => array(115 'name' => __('Requests'),116 'link' => $bp['loggedin_domain'] . $bp['friends']['slug'] . '/requests' ),117 'friend-finder' => array(118 'name' => __('Friend Finder'),119 'link' => $bp['loggedin_domain'] . $bp['friends']['slug'] . '/friend-finder' ),120 'invite-friend' => array(121 'name' => __('Invite Friends'),122 'link' => $bp['loggedin_domain'] . $bp['friends']['slug'] . '/invite-friend' )123 );124 120 } else { 125 121 $bp['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 ); … … 141 137 142 138 if ( $bp['current_component'] == $bp['friends']['slug'] && $current_blog->blog_id > 1 ) { 139 140 if ( $bp['current_action'] == '' ) 141 $bp['current_action'] = 'my-friends'; 142 143 143 switch ( $bp['current_action'] ) { 144 144 case 'my-friends': … … 182 182 add_action( 'wp', 'friends_catch_action', 3 ); 183 183 184 /**************************************************************************185 friends_template()186 187 Set up template tags for use in templates.188 **************************************************************************/189 190 function friends_template() {191 global $bp, $friends_template;192 193 if ( $bp['current_component'] == $bp['friends']['slug'] ) {194 if ( $bp['current_action'] != 'friend-finder' || $bp['current_action'] != 'invite-friends' )195 $friends_template = new BP_Friendship_Template( $bp['current_userid'] );196 }197 198 }199 add_action( 'wp_head', 'friends_template' );200 201 184 202 185 /************************************************************************** -
trunk/bp-friends/bp-friends-classes.php
r295 r309 159 159 global $wpdb, $bp; 160 160 161 $result = $wpdb->get_results( $wpdb->prepare( "SELECT id, is_confirmed FROM " . $bp['friends']['table_name'] . " WHERE (initiator_user_id = %d AND friend_user_id = %d) OR (initiator_user_id = %d AND friend_user_id = %d)", $ bp['loggedin_userid'], $possible_friend_userid, $possible_friend_userid, $bp['loggedin_userid']) );161 $result = $wpdb->get_results( $wpdb->prepare( "SELECT id, is_confirmed FROM " . $bp['friends']['table_name'] . " WHERE (initiator_user_id = %d AND friend_user_id = %d) OR (initiator_user_id = %d AND friend_user_id = %d)", $loggedin_userid, $possible_friend_userid, $possible_friend_userid, $loggedin_userid ) ); 162 162 163 163 if ( $result ) { -
trunk/bp-friends/bp-friends-cssjs.php
r251 r309 12 12 $_GET['page'] = null; 13 13 14 if ( strpos( $_GET['page'], 'friends' ) !== false ||$bp['current_component'] == $bp['friends']['slug'] ) {14 if ( $bp['current_component'] == $bp['friends']['slug'] ) { 15 15 echo ' 16 16 <script src="' . get_option('siteurl') . '/wp-content/mu-plugins/bp-friends/js/general.js" type="text/javascript"></script>'; … … 18 18 } 19 19 add_action( 'wp_head', 'friends_add_js' ); 20 add_action( 'admin_menu', 'friends_add_js' );21 22 /**************************************************************************23 add_css()24 25 Inserts the CSS needed to style the friends pages.26 **************************************************************************/27 28 function friends_add_css()29 {30 ?>31 32 <?php33 }34 20 35 21 ?> -
trunk/bp-friends/bp-friends-templatetags.php
r304 r309 116 116 117 117 function bp_has_friendships() { 118 global $friends_template; 118 global $bp, $friends_template; 119 120 $friends_template = new BP_Friendship_Template( $bp['current_userid'] ); 119 121 120 122 return $friends_template->has_friendships(); … … 147 149 $template = &$friends_template->friendship->friend; 148 150 149 echo $template->avatar ;151 echo $template->avatar_thumb; 150 152 } 151 153 function bp_friends_user_avatar_thumb() { … … 313 315 global $bp; 314 316 315 if ( !$potential_friend_id ) 316 $potential_friend_id = $bp['current_userid']; 317 318 if ( $bp['loggedin_userid'] == $potential_friend_id ) 319 return false; 320 321 $friend_status = BP_Friends_Friendship::check_is_friend( $bp['loggedin_userid'], $potential_friend_id ); 322 323 echo '<div class="friendship-button" id="friendship-button-' . $potential_friend_id . '">'; 324 if ( $friend_status == 'pending' ) { 325 _e('Friendship Requested'); 326 } else if ( $friend_status == 'is_friend') { 327 echo '<a href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/remove-friend/' . $potential_friend_id . '" title="' . __('Cancel Friendship') . '" id="friend-' . $potential_friend_id . '" rel="remove" class="remove">' . __('Cancel Friendship') . '</a>'; 328 } else { 329 echo '<a href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/add-friend/' . $potential_friend_id . '" title="' . __('Add Friend') . '" id="friend-' . $potential_friend_id . '" rel="add">' . __('Add Friend') . '</a>'; 330 } 331 echo '</div>'; 332 333 if ( function_exists('wp_nonce_field') ) 334 wp_nonce_field('addremove_friend'); 317 if ( is_user_logged_in() ) { 318 if ( !$potential_friend_id ) 319 $potential_friend_id = $bp['current_userid']; 320 321 if ( $bp['loggedin_userid'] == $potential_friend_id ) 322 return false; 323 324 $friend_status = BP_Friends_Friendship::check_is_friend( $bp['loggedin_userid'], $potential_friend_id ); 325 326 echo '<div class="friendship-button" id="friendship-button-' . $potential_friend_id . '">'; 327 if ( $friend_status == 'pending' ) { 328 _e('Friendship Requested'); 329 } else if ( $friend_status == 'is_friend') { 330 echo '<a href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/remove-friend/' . $potential_friend_id . '" title="' . __('Cancel Friendship') . '" id="friend-' . $potential_friend_id . '" rel="remove" class="remove">' . __('Cancel Friendship') . '</a>'; 331 } else { 332 echo '<a href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/add-friend/' . $potential_friend_id . '" title="' . __('Add Friend') . '" id="friend-' . $potential_friend_id . '" rel="add">' . __('Add Friend') . '</a>'; 333 } 334 echo '</div>'; 335 336 if ( function_exists('wp_nonce_field') ) 337 wp_nonce_field('addremove_friend'); 338 } 335 339 } 336 340 -
trunk/bp-groups.php
r307 r309 79 79 } 80 80 add_action( 'wp', 'groups_setup_globals', 1 ); 81 add_action( ' admin_menu', 'groups_setup_globals');81 add_action( '_admin_menu', 'groups_setup_globals', 1 ); 82 82 83 83 … … 92 92 global $wpdb, $bp, $userdata; 93 93 94 if ( $wpdb->blogid == $userdata->primary_blog ) { 95 //add_menu_page( __("Groups"), __("Groups"), 1, basename(__FILE__), "" ); 94 if ( $wpdb->blogid == get_usermeta( $bp['current_userid'], 'home_base' ) ) { 95 /* Add the administration tab under the "Site Admin" tab for site administrators */ 96 //add_submenu_page( 'wpmu-admin.php', __("Friends"), __("Friends"), 1, basename(__FILE__), "friends_settings" ); 96 97 } 97 98 … … 122 123 'id' => $bp['groups']['slug'], 123 124 'name' => __('Groups'), 124 'link' => $current_domain . $bp['groups']['slug'] . '/' 125 'link' => $bp['current_domain'] . $bp['groups']['slug'] . '/' 126 ); 127 128 $bp['bp_options_nav'][$bp['groups']['slug']] = array( 129 'my-groups' => array( 130 'name' => __('My Groups'), 131 'link' => $bp['loggedin_domain'] . $bp['groups']['slug'] . '/my-groups' ), 132 'group-finder' => array( 133 'name' => __('Group Finder'), 134 'link' => $bp['loggedin_domain'] . $bp['groups']['slug'] . '/group-finder' ), 135 'create' => array( 136 'name' => __('Create a Group'), 137 'link' => $bp['loggedin_domain'] . $bp['groups']['slug'] . '/create' ), 138 'invites' => array( 139 'name' => __('Invites'), 140 'link' => $bp['loggedin_domain'] . $bp['groups']['slug'] . '/invites' ) 125 141 ); 126 142 … … 130 146 131 147 $bp['bp_options_title'] = __('My Groups'); 132 $bp['bp_options_nav'][$bp['groups']['slug']] = array( 133 'my-groups' => array( 134 'name' => __('My Groups'), 135 'link' => $bp['loggedin_domain'] . $bp['groups']['slug'] . '/my-groups' ), 136 'group-finder' => array( 137 'name' => __('Group Finder'), 138 'link' => $bp['loggedin_domain'] . $bp['groups']['slug'] . '/group-finder' ), 139 'create' => array( 140 'name' => __('Create a Group'), 141 'link' => $bp['loggedin_domain'] . $bp['groups']['slug'] . '/create' ), 142 'invites' => array( 143 'name' => __('Invites'), 144 'link' => $bp['loggedin_domain'] . $bp['groups']['slug'] . '/invites' ) 145 ); 146 148 149 } else if ( !bp_is_home() && !$is_single_group ) { 150 151 $bp['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 ); 152 $bp['bp_options_title'] = bp_user_fullname( $bp['current_userid'], false ); 153 147 154 } else if ( $is_single_group ) { 148 155 … … 401 408 add_action( 'wp', 'groups_catch_action', 3 ); 402 409 403 /**************************************************************************404 groups_template()405 406 Set up template tags for use in templates.407 **************************************************************************/408 409 function groups_template() {410 global $groups_template, $bp;411 global $is_single_group;412 413 if ( $bp['current_component'] == $bp['groups']['slug'] && !$is_single_group ) {414 $groups_template = new BP_Groups_Template( $bp['current_userid'] );415 } else if ( $bp['current_component'] == $bp['groups']['slug'] && $is_single_group ) {416 $groups_template = new BP_Groups_Template( $bp['current_userid'], $bp['current_action'] );417 }418 419 }420 add_action( 'wp_head', 'groups_template' );421 422 410 423 411 /************************************************************************** … … 456 444 $avatar_error = false; 457 445 458 if ( bp_core_check_avatar_upload($file) ) {459 if ( ! bp_core_check_avatar_upload($file) ) {446 if ( core_check_avatar_upload($file) ) { 447 if ( !core_check_avatar_upload($file) ) { 460 448 $avatar_error = true; 461 449 $avatar_error_msg = __('Your group avatar upload failed, please try again.'); 462 450 } 463 451 464 if ( ! bp_core_check_avatar_size($file) ) {452 if ( !core_check_avatar_size($file) ) { 465 453 $avatar_error = true; 466 454 $avatar_size = size_format(1024 * CORE_MAX_FILE_SIZE); … … 468 456 } 469 457 470 if ( ! bp_core_check_avatar_type($file) ) {458 if ( !core_check_avatar_type($file) ) { 471 459 $avatar_error = true; 472 460 $avatar_error_msg = __('Please upload only JPG, GIF or PNG photos.'); … … 474 462 475 463 // "Handle" upload into temporary location 476 if ( !$original = bp_core_handle_avatar_upload($file) ) {464 if ( !$original = core_handle_avatar_upload($file) ) { 477 465 $avatar_error = true; 478 466 $avatar_error_msg = __('Upload Failed! Your photo dimensions are likely too big.'); 479 467 } 480 468 481 if ( ! bp_core_check_avatar_dimensions($original) ) {469 if ( !core_check_avatar_dimensions($original) ) { 482 470 $avatar_error = true; 483 471 $avatar_error_msg = sprintf( __('The image you upload must have dimensions of %d x %d pixels or larger.'), CORE_CROPPING_CANVAS_MAX, CORE_CROPPING_CANVAS_MAX ); 484 472 } 485 473 486 if ( !$canvas = bp_core_resize_avatar($original) ) {474 if ( !$canvas = core_resize_avatar($original) ) { 487 475 $avatar_error = true; 488 476 $avatar_error_msg = __('Could not create thumbnail, try another photo.'); … … 612 600 case '3': 613 601 // Image already cropped and uploaded, lets store a reference in the DB. 614 if ( !wp_verify_nonce($_POST['nonce'], 'slick_avatars') || !$result = bp_core_avatar_cropstore( $_POST['orig'], $_POST['canvas'], $_POST['v1_x1'], $_POST['v1_y1'], $_POST['v1_w'], $_POST['v1_h'], $_POST['v2_x1'], $_POST['v2_y1'], $_POST['v2_w'], $_POST['v2_h'], false, 'groupavatar', $group_id ) )602 if ( !wp_verify_nonce($_POST['nonce'], 'slick_avatars') || !$result = core_avatar_cropstore( $_POST['orig'], $_POST['canvas'], $_POST['v1_x1'], $_POST['v1_y1'], $_POST['v1_w'], $_POST['v1_h'], $_POST['v2_x1'], $_POST['v2_y1'], $_POST['v2_w'], $_POST['v2_h'], false, 'groupavatar', $group_id ) ) 615 603 return false; 616 604 -
trunk/bp-groups/bp-groups-cssjs.php
r263 r309 18 18 } 19 19 add_action( 'wp_head', 'groups_add_js' ); 20 add_action( 'admin_ menu', 'groups_add_js' );20 add_action( 'admin_head', 'groups_add_js' ); 21 21 22 22 /************************************************************************** -
trunk/bp-groups/bp-groups-templatetags.php
r304 r309 99 99 100 100 function bp_has_groups() { 101 global $groups_template; 101 global $groups_template, $bp; 102 global $is_single_group; 103 104 if ( !$is_single_group ) { 105 $groups_template = new BP_Groups_Template( $bp['current_userid'] ); 106 } else { 107 $groups_template = new BP_Groups_Template( $bp['current_userid'], $bp['current_action'] ); 108 } 109 102 110 return $groups_template->has_groups(); 103 111 } … … 381 389 groups_avatar_upload($_FILES); 382 390 } else { 383 core_render_avatar_upload_form( '', true );391 bp_core_render_avatar_upload_form( '', true ); 384 392 } 385 393 ?> -
trunk/bp-messages.php
r307 r309 92 92 } 93 93 add_action( 'wp', 'messages_setup_globals', 1 ); 94 add_action( ' admin_menu', 'messages_setup_globals');94 add_action( '_admin_menu', 'messages_setup_globals', 1 ); 95 95 96 96 … … 105 105 global $wpdb, $bp, $userdata; 106 106 107 if ( $wpdb->blogid == $userdata->primary_blog ) { 108 if ( $inbox_count = BP_Messages_Thread::get_inbox_count() ) { 109 $count_indicator = ' <span id="awaiting-mod" class="count-1"><span class="message-count">' . $inbox_count . '</span></span>'; 110 } 111 112 //add_menu_page ( __('Messages'), sprintf( __('Messages%s'), $count_indicator ), 1, basename(__FILE__), "messages_inbox" ); 113 //add_submenu_page ( basename(__FILE__), __('Messages › Inbox'), __('Inbox'), 1, basename(__FILE__), "messages_inbox" ); 114 //add_submenu_page ( basename(__FILE__), __('Messages › Sent Messages'), __('Sent Messages'), 1, "messages_sentbox", "messages_sentbox" ); 115 //add_submenu_page ( basename(__FILE__), __('Messages › Compose'), __('Compose'), 1, "messages_write_new", "messages_write_new" ); 116 117 // Add the administration tab under the "Site Admin" tab for site administrators 107 if ( $wpdb->blogid == get_usermeta( $bp['current_userid'], 'home_base' ) ) { 108 //Add the administration tab under the "Site Admin" tab for site administrators 118 109 //add_submenu_page ( 'wpmu-admin.php', __('Messages'), __('Messages'), 1, basename(__FILE__), "messages_settings" ); 119 110 } … … 140 131 ); 141 132 133 $bp['bp_options_nav'][$bp['messages']['slug']] = array( 134 'inbox' => array( 135 'name' => __('Inbox') . $count_indicator, 136 'link' => $bp['loggedin_domain'] . $bp['messages']['slug'] . '/' ), 137 'sentbox' => array( 138 'name' => __('Sent Messages'), 139 'link' => $bp['loggedin_domain'] . $bp['messages']['slug'] . '/sentbox' ), 140 'compose' => array( 141 'name' => __('Compose'), 142 'link' => $bp['loggedin_domain'] . $bp['messages']['slug'] . '/compose' ) 143 ); 144 145 if ( is_site_admin() ) { 146 $bp['bp_options_nav'][$bp['messages']['slug']]['notices'] = array( 147 'name' => __('Sent Notices'), 148 'link' => $bp['loggedin_domain'] . $bp['messages']['slug'] . '/notices' 149 ); 150 } 151 142 152 $inbox_count = BP_Messages_Thread::get_inbox_count(); 143 153 $inbox_display = ( $inbox_count ) ? ' style="display:inline;"' : ' style="display:none;"'; … … 146 156 if ( $bp['current_component'] == $bp['messages']['slug'] ) { 147 157 if ( bp_is_home() ) { 148 $bp['bp_options_title'] = __('My Messages'); 149 $bp['bp_options_nav'][$bp['messages']['slug']] = array( 150 'inbox' => array( 151 'name' => __('Inbox') . $count_indicator, 152 'link' => $bp['loggedin_domain'] . $bp['messages']['slug'] . '/' ), 153 'sentbox' => array( 154 'name' => __('Sent Messages'), 155 'link' => $bp['loggedin_domain'] . $bp['messages']['slug'] . '/sentbox' ), 156 'compose' => array( 157 'name' => __('Compose'), 158 'link' => $bp['loggedin_domain'] . $bp['messages']['slug'] . '/compose' ) 159 ); 160 161 if ( is_site_admin() ) { 162 $bp['bp_options_nav'][$bp['messages']['slug']]['notices'] = array( 163 'name' => __('Sent Notices'), 164 'link' => $bp['loggedin_domain'] . $bp['messages']['slug'] . '/notices' 165 ); 166 } 167 158 $bp['bp_options_title'] = __('My Messages'); 168 159 } else { 169 160 $bp_options_avatar = bp_core_get_avatar( $bp['current_userid'], 1 ); … … 315 306 } 316 307 add_action( 'wp', 'messages_catch_action', 3 ); 317 318 /**************************************************************************319 messages_template()320 321 Set up template tags for use in templates.322 **************************************************************************/323 324 function messages_template() {325 global $messages_template, $bp;326 327 if ( $bp['current_component'] == $bp['messages']['slug'] ) {328 if ( $bp['current_action'] == 'inbox' || $bp['current_action'] == 'sentbox' || ( $bp['current_action'] == 'notices' && is_site_admin() ) )329 $messages_template = new BP_Messages_Template( $bp['loggedin_userid'], $bp['current_action'] );330 }331 332 }333 add_action( 'wp_head', 'messages_template' );334 335 308 336 309 /************************************************************************** -
trunk/bp-messages/bp-messages-cssjs.php
r251 r309 36 36 } 37 37 add_action( 'wp_head', 'messages_add_js' ); 38 add_action( 'admin_menu', 'messages_add_js' ); 39 40 41 /************************************************************************** 42 add_css() 43 44 Inserts the CSS needed to style the messages pages. 45 **************************************************************************/ 46 47 function messages_add_css() 48 { 49 ?> 50 <style type="text/css"> 51 .unread td { 52 font-weight: bold; 53 background: #ffffec; 54 } 55 56 #send_message_form fieldset input { 57 width: 98%; 58 font-size: 1.7em; 59 padding: 4px 3px; 60 } 61 62 .message-box { 63 border: 1px solid #eee; 64 border-top: 3px solid #EAF3FA; 65 padding: 15px 10px; 66 padding-left: 135px; 67 } 68 .message-box .avatar-box { 69 float: left; 70 width: 110px; 71 margin: 0 0 0 -125px; 72 } 73 .message-box .avatar-box h3 { 74 margin: 10px 0 5px 0; 75 } 76 77 #message-list td { 78 vertical-align: middle; 79 } 80 #message-list .is-read { 81 width: 1px; 82 } 83 84 #message-list .avatar { 85 width: 50px; 86 } 87 88 img.avatar { 89 padding: 3px; 90 border: 1px solid #ddd; 91 background: #fff; 92 } 93 94 #message-list .sender-details { 95 96 } 97 #message-list .sender-details h3 { 98 margin: 0 0 3px 0; 99 } 100 101 #message-list .sender-details { 102 width: 160px; 103 } 104 105 #message-list .message-details h4 { 106 margin: 0 0 3px 0; 107 } 108 109 div.ajax_reply, div.error-box { 110 text-align: center; 111 font-size: 13px; 112 padding: 15px; 113 border: 1px solid #eee; 114 border-bottom: none; 115 border-top: 3px solid #EAF3FA; 116 background: #EAF3FA; 117 color: #2583AD; 118 } 119 120 div.error-box { 121 background: #FFFEDB; 122 color: #D54E21; 123 border-top: none; 124 } 125 div.div.ajax_reply img, div.error-box img { vertical-align: middle; } 126 127 128 129 </style> 130 <?php 131 } 132 add_action( 'admin_menu', 'messages_add_css' ); 38 //add_action( 'admin_menu', 'messages_add_js' ); 133 39 134 40 ?> -
trunk/bp-messages/bp-messages-templatetags.php
r304 r309 97 97 98 98 function bp_has_message_threads() { 99 global $messages_template; 99 global $bp, $messages_template; 100 101 if ( $bp['current_action'] == 'notices' && !is_site_admin() ) { 102 wp_die('No Access'); 103 } else { 104 $messages_template = new BP_Messages_Template( $bp['loggedin_userid'], $bp['current_action'] ); 105 } 106 100 107 return $messages_template->has_threads(); 101 108 } … … 210 217 <select name="message-type-select" id="message-type-select"> 211 218 <option value=""></option> 212 <option value="read"> Read</option>213 <option value="unread"> Unread</option>214 <option value="all"> All</option>219 <option value="read"><?php _e('Read') ?></option> 220 <option value="unread"><?php _e('Unread') ?></option> 221 <option value="all"><?php _e('All') ?></option> 215 222 </select> 216 <a href="#" id="mark_as_read"> Mark as Read</a> 217 <a href="#" id="mark_as_unread"> Mark as Unread</a> 218 <a href="#" id="delete_messages"> Delete</a> 223 <a href="#" id="mark_as_read"><?php _e('Mark as Read') ?></a> 224 <a href="#" id="mark_as_unread"><?php _e('Mark as Unread') ?></a> 225 <a href="#" id="delete_messages"><?php _e('Delete') ?></a> 219 226 <?php 220 227 } … … 224 231 225 232 if ( $messages_template->thread->is_active ) { 226 echo "<strong>Currently Active</strong>"; 233 echo "<strong>"; 234 _e('Currently Active'); 235 echo "</strong>"; 227 236 } 228 237 } … … 281 290 282 291 if ( is_array($closed_notices) ) { 283 if ( !in_array( $notice->id, $closed_notices ) ) {292 if ( !in_array( $notice->id, $closed_notices ) && $notice->id ) { 284 293 ?> 285 294 <div class="notice" id="<?php echo $notice->id ?>"> -
trunk/bp-xprofile.php
r304 r309 97 97 } 98 98 add_action( 'wp', 'xprofile_setup_globals', 1 ); 99 add_action( ' admin_menu', 'xprofile_setup_globals');99 add_action( '_admin_menu', 'xprofile_setup_globals', 1 ); 100 100 101 101 … … 110 110 global $wpdb, $bp, $groups, $userdata; 111 111 112 if ( $wpdb->blogid == $userdata->primary_blog ) { 113 //add_menu_page( __('Profile'), __('Profile'), 1, basename(__FILE__), 'xprofile_avatar_admin' ); 114 //add_submenu_page( basename(__FILE__), __('Profile › Avatar'), __('Avatar'), 1, basename(__FILE__), 'xprofile_avatar_admin' ); 115 //add_options_page( __('Profile'), __('Profile'), 1, basename(__FILE__), 'xprofile_add_settings' ); 116 117 //$groups = BP_XProfile_Group::get_all(); 118 119 // for ( $i=0; $i < count($groups); $i++ ) { 120 // if ( $groups[$i]->fields ) { 121 // add_submenu_page( basename(__FILE__), __('Profile') . ' › ' . $groups[$i]->name, $groups[$i]->name, 1, "xprofile_" . $groups[$i]->name, "xprofile_edit" ); 122 // } 123 // } 124 // 112 if ( $wpdb->blogid == get_usermeta( $bp['current_userid'], 'home_base' ) ) { 113 add_menu_page( __('Profile'), __('Profile'), 1, basename(__FILE__), 'bp_core_avatar_admin' ); 114 add_submenu_page( basename(__FILE__), __('Profile › Avatar'), __('Avatar'), 1, basename(__FILE__), 'xprofile_avatar_admin' ); 115 add_options_page( __('Profile'), __('Profile'), 1, basename(__FILE__), 'xprofile_add_settings' ); 116 117 $groups = BP_XProfile_Group::get_all(); 118 119 for ( $i=0; $i < count($groups); $i++ ) { 120 if ( $groups[$i]->fields ) { 121 add_submenu_page( basename(__FILE__), __('Profile') . ' › ' . $groups[$i]->name, $groups[$i]->name, 1, "xprofile_" . $groups[$i]->name, "xprofile_edit" ); 122 } 123 } 124 } 125 126 if ( is_site_admin() ) { 125 127 wp_enqueue_script( 'jquery.tablednd', '/wp-content/mu-plugins/bp-core/js/jquery/jquery.tablednd.js', array( 'jquery' ), '0.4' ); 126 128 127 129 /* Add the administration tab under the "Site Admin" tab for site administrators */ 128 130 add_submenu_page( 'wpmu-admin.php', __("Profiles"), __("Profiles"), 1, "xprofile_settings", "xprofile_admin" ); 129 131 } 130 132 131 133 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 132 134 if ( ( $wpdb->get_var("show tables like '%" . $bp['xprofile']['table_name_groups'] . "%'") == false ) || ( get_site_option('bp-xprofile-version') < BP_XPROFILE_VERSION ) ) … … 135 137 } 136 138 add_action( 'admin_menu', 'xprofile_add_admin_menu' ); 137 138 139 /**************************************************************************140 xprofile_admin_setup()141 142 Setup CSS, JS and other things needed for the admin area of the xprofile component.143 **************************************************************************/144 145 function xprofile_admin_setup() {146 add_action( 'admin_head', 'xprofile_add_css' );147 add_action( 'admin_head', 'xprofile_add_js' );148 add_action( 'admin_head', 'bp_core_add_cropper_js' );149 }150 add_action( 'admin_menu', 'xprofile_admin_setup' );151 139 152 140 … … 171 159 'link' => $bp['current_domain'] . $bp['xprofile']['slug'] 172 160 ); 173 161 162 $bp['bp_options_nav'][$bp['xprofile']['slug']] = array( 163 'public' => array( 164 'name' => __('Public'), 165 'link' => $bp['loggedin_domain'] . $bp['xprofile']['slug'] . '/' ), 166 'edit' => array( 167 'name' => __('Edit Profile'), 168 'link' => $bp['loggedin_domain'] . $bp['xprofile']['slug'] . '/edit' ), 169 'change-avatar' => array( 170 'name' => __('Change Avatar'), 171 'link' => $bp['loggedin_domain'] . $bp['xprofile']['slug'] . '/change-avatar' ) 172 ); 173 174 174 if ( $bp['current_component'] == $bp['xprofile']['slug'] ) { 175 175 if ( bp_is_home() ) { 176 176 $bp['bp_options_title'] = __('My Profile'); 177 $bp['bp_options_nav'][$bp['xprofile']['slug']] = array(178 '' => array(179 'name' => __('Public'),180 'link' => $bp['loggedin_domain'] . $bp['xprofile']['slug'] . '/' ),181 'edit' => array(182 'name' => __('Edit Profile'),183 'link' => $bp['loggedin_domain'] . $bp['xprofile']['slug'] . '/edit' ),184 'change-avatar' => array(185 'name' => __('Change Avatar'),186 'link' => $bp['loggedin_domain'] . $bp['xprofile']['slug'] . '/change-avatar' )187 );188 177 } else { 189 178 $bp['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 ); … … 206 195 207 196 if ( $bp['current_component'] == $bp['xprofile']['slug'] && $current_blog->blog_id > 1 ) { 208 if ( !$bp['current_action'] ) { 197 198 if ( $bp['current_action'] == 'public' ) { 209 199 bp_catch_uri( 'profile/index' ); 210 200 } else if ( $bp['current_action'] == 'edit' && $bp['loggedin_userid'] == $bp['current_userid'] ) { … … 213 203 add_action( 'wp_head', 'bp_core_add_cropper_js' ); 214 204 bp_catch_uri( 'profile/change-avatar' ); 205 } else if ( $bp['current_action'] == 'delete-avatar' && $bp['loggedin_userid'] == $bp['current_userid'] ) { 206 bp_core_delete_avatar(); 207 add_action( 'wp_head', 'bp_core_add_cropper_js' ); 208 bp_catch_uri( 'profile/change-avatar' ); 215 209 } else { 210 $bp['current_action'] = 'public'; 216 211 bp_catch_uri( 'profile/index' ); 217 212 } … … 219 214 } 220 215 add_action( 'wp', 'xprofile_catch_action', 3 ); 221 222 223 /**************************************************************************224 xprofile_profile_template()225 226 Set up template tags for use in templates.227 **************************************************************************/228 229 function xprofile_profile_template() {230 global $profile_template, $bp;231 232 if ( $bp['current_component'] == $bp['xprofile']['slug'] ) {233 $profile_template = new BP_XProfile_Template($bp['current_userid']);234 }235 }236 add_action( 'wp_head', 'xprofile_profile_template' );237 216 238 217 /************************************************************************** … … 372 351 </p> 373 352 374 </div> 353 </div> 375 354 <?php 376 355 } … … 391 370 } 392 371 372 /************************************************************************** 373 xprofile_remove_data_on_blog_deletion() 374 375 Removes all profile data from the DB if the admin deletes a Home Base. 376 **************************************************************************/ 377 378 function xprofile_remove_data_on_blog_deletion( $blog_id ) { 379 global $wpdb, $bp; 380 381 /* Only delete profile data if we are removing a home base */ 382 if ( $user_id = bp_core_get_homebase_userid( $blog_id ) ) { 383 BP_XProfile_ProfileData::delete_data_for_user( $user_id ); 384 385 // delete any avatar files. 386 @unlink( get_usermeta( $user_id, 'bp_core_avatar_v1_path' ) ); 387 @unlink( get_usermeta( $user_id, 'bp_core_avatar_v2_path' ) ); 388 389 // unset the usermeta for avatars from the usermeta table. 390 delete_usermeta( $user_id, 'bp_core_avatar_v1' ); 391 delete_usermeta( $user_id, 'bp_core_avatar_v1_path' ); 392 delete_usermeta( $user_id, 'bp_core_avatar_v2' ); 393 delete_usermeta( $user_id, 'bp_core_avatar_v2_path' ); 394 } 395 } 396 add_action( 'delete_blog', 'xprofile_remove_data_on_blog_deletion', 1 ); 393 397 394 398 ?> -
trunk/bp-xprofile/bp-xprofile-classes.php
r304 r309 461 461 } 462 462 463 $html .= '<span class="signup-description">' . $this->desc . '</span>';464 $html .= '</div>';465 466 463 if ( !$this->is_required ) { 467 $html .= '<a href="javascript:clear(\'field_' . $this->id . '\');"><img src="' . $bp['xprofile']['image_base'] . '/cross.gif" alt="Clear" /> Clear</a>'; 468 } 464 $html .= '<a class="clear-value" style="text-decoration: none;" href="javascript:clear(\'field_' . $this->id . '\');"><img src="' . $bp['xprofile']['image_base'] . '/cross.gif" alt="Clear" /> Clear</a>'; 465 } 466 467 $html .= '<span class="signup-description">' . $this->desc . '</span>'; 468 $html .= '<div class="clear"></div></div>'; 469 469 470 470 break; 471 471 472 472 case 'checkbox': 473 $value = explode( ",", $value );474 475 473 $options = $this->get_children(); 476 474 477 475 $html .= '<div class="checkbox signup-field" id="field_' . $this->id . '"><span class="signup-label">' . $asterisk . $this->name . ':</span>' . $this->message; 478 476 479 $option_values = BP_XProfile_ProfileData::get_value_byid($options[0]->parent_id); 480 $option_values = unserialize($option_values); 481 477 if ( $value ) { 478 $option_values = unserialize($value); 479 } else { 480 $option_values = BP_XProfile_ProfileData::get_value_byid($options[0]->parent_id); 481 $option_values = unserialize($option_values); 482 } 483 482 484 for ( $k = 0; $k < count($options); $k++ ) { 483 485 for ( $j = 0; $j < count($option_values); $j++ ) { … … 493 495 494 496 $html .= '<span class="signup-description">' . $this->desc . '</span>'; 495 $html .= '< /div>';497 $html .= '<div class="clear"></div></div>'; 496 498 497 499 break; … … 1139 1141 return $last_updated; 1140 1142 } 1143 1144 function delete_data_for_user( $user_id ) { 1145 global $wpdb, $bp; 1146 1147 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['xprofile']['table_name_data'] . " WHERE user_id = %d", $user_id ) ); 1148 1149 } 1141 1150 } 1142 1151 ?> -
trunk/bp-xprofile/bp-xprofile-cssjs.php
r251 r309 2 2 3 3 function xprofile_add_signup_css() { 4 if ( $_SERVER['SCRIPT_NAME'] == '/wp-signup.php' ) { 5 ?> 6 <style type="text/css"> 7 8 table#extraFields td label, 9 div.radio span, 10 div.checkbox span { 11 font-weight: bold; 12 display: block; 13 float: left; 14 width: 115px; 15 } 16 17 table#extraFields td input { 18 font-size: 24px; 19 width: 280px; 20 } 21 22 table#extraFields td textarea { 23 width: 280px; 24 height: 120px; 25 } 26 27 table#extraFields td select { 28 width: 280px; 29 } 30 31 table#extraFields td div.datefield select { 32 width: auto; 33 } 34 35 table#extraFields td div.radio label, 36 table#extraFields td div.checkbox label { 37 display: inline; 38 font-weight: normal; 39 float: none; 40 } 41 42 table#extraFields td div.radio input, 43 table#extraFields td div.checkbox input { 44 width: auto; 45 } 46 47 span.desc { 48 margin-left: 115px; 49 font-weight: normal; 50 } 51 52 div.error { 53 font-weight: bold; 54 margin: 10px 0 10px 113px; 55 } 56 57 </style> 58 <?php 59 } 4 if ( $_SERVER['SCRIPT_NAME'] == '/wp-signup.php' ) 5 echo '<link rel="stylesheet" href="' . get_option('siteurl') . '/wp-content/mu-plugins/bp-xprofile/css/signup.css" type="text/css" />'; 60 6 } 61 7 add_action( 'wp_head', 'xprofile_add_signup_css' ); 62 8 63 9 64 function xprofile_add_css() { 65 global $userdata, $wpdb; 66 67 ?> 68 <style type="text/css"> 69 70 tr.header td { 71 border-bottom: 2px solid #eee; 72 font-weight: bold; 73 } 74 75 tr.core td { color: #999; } 76 77 thead tr th { 78 font-size: 16px; 79 } 80 81 #profilePicture { 82 margin: 0 0 0 -280px; 83 float: left; 84 width: 280px; 85 } 86 87 #currentPicture { 88 padding: 15px; 89 width: 280px; 90 margin-left: 280px; 91 } 92 93 #currentPicture img, #otherPictures img { 94 border: 1px solid #ccc; 95 padding: 4px; 96 background: #fff; 97 } 98 #otherPictures img:hover { 99 background: #f0f0f0; 100 } 101 102 #currentPicture a, #otherPictures a { border: none; } 103 104 #otherPictures { 105 float: right; 106 padding: 20px; 107 margin-left: 300px; 108 margin-top: -5px; 109 } 110 111 #otherPictures ul { 112 list-style: none; 113 margin: 0; 114 padding: 0; 115 } 116 #otherPictures ul li { 117 float: left; 118 margin: 0 10px 10px 0; 119 } 120 121 #profilePicture form { 122 border: 1px solid #ccc; 123 width: 255px; 124 margin-top: 20px; 125 padding: 5px; 126 } 127 #profilePicture form h3 { 128 background: #fafafa; 129 margin: 0 0 15px 0; 130 padding: 10px; 131 } 132 133 ul.forTab { 134 list-style: none; 135 padding: 0; 136 margin: 0 0 0 1em; 137 } 138 ul.forTab li { 139 margin: 0 0 1em 0; 140 } 141 142 ul.forTab li label { 143 display: block; 144 145 } 146 147 ul.forTab li input { 148 font-size: 1.4em; 149 } 150 151 p.success { background: green;} 152 p.err { 153 border-top: 2px solid red; 154 border-bottom: 2px solid red; 155 color: red; 156 padding: 5px 0; 157 width: 40%; 158 } 159 160 span.desc, span.signup-description { 161 display: block; 162 font-size: 11px; 163 color: #555; 164 } 165 166 select.multi-select{ 167 width:90%; 168 height:10em !important; 169 } 170 171 ul.multi-checkbox { 172 margin: 0 5px 0 0px; 173 padding: .5em .9em; 174 height: 10em; 175 overflow: auto; 176 list-style: none; 177 border: solid 1px #ccc; 178 width:90%; 179 } 180 181 ul.multi-checkbox li{ 182 padding: 0; 183 margin: 0; 184 } 185 186 div.options-box { 187 margin-left: 20px !important; 188 margin-right: 10px !important; 189 border-left: 4px solid #EAF3FA; 190 padding-left: 15px; 191 } 192 193 th a { 194 background: #fff; 195 padding: 2px 5px; 196 -moz-border-radius: 3px; 197 -khtml-border-radius: 3px; 198 -webkit-border-radius: 3px; 199 border-radius: 3px; 200 top: -2px; 201 } 202 203 </style> 204 <?php 205 //} 206 } 207 208 function xprofile_add_js() { 10 function xprofile_add_admin_css() { 209 11 if ( strpos( $_GET['page'], 'xprofile' ) !== false ) { 210 ?> 211 <script type="text/javascript"> 212 var ajaxurl = '<?php echo get_option('siteurl') . "/wp-admin/admin-ajax.php"; ?>'; 213 214 function add_option(forWhat) { 215 var holder = document.getElementById(forWhat + "_more"); 216 var theId = document.getElementById(forWhat + '_option_number').value; 217 218 var newDiv = document.createElement('p'); 219 newDiv.setAttribute('id', forWhat + '_div' + theId); 220 221 var newOption = document.createElement('input'); 222 newOption.setAttribute('type', 'text'); 223 newOption.setAttribute('name', forWhat + '_option[' + theId + ']'); 224 newOption.setAttribute('id', forWhat + '_option' + theId); 225 226 var label = document.createElement('label'); 227 label.setAttribute('for', forWhat + '_option' + theId); 228 229 var txt = document.createTextNode("Option " + theId + ": "); 230 label.appendChild(txt); 231 232 var isDefault = document.createElement('input'); 233 234 if(forWhat == 'checkbox' || forWhat == 'multiselectbox') { 235 isDefault.setAttribute('type', 'checkbox'); 236 isDefault.setAttribute('name', 'isDefault_' + forWhat + '_option[' + theId + ']'); 237 } else { 238 isDefault.setAttribute('type', 'radio'); 239 isDefault.setAttribute('name', 'isDefault_' + forWhat + '_option'); 240 } 241 242 isDefault.setAttribute('value', theId); 243 244 var label1 = document.createElement('label'); 245 var txt1 = document.createTextNode(" Default Value "); 246 247 label1.appendChild(txt1); 248 label1.setAttribute('for', 'isDefault_' + forWhat + '_option[]'); 249 toDelete = document.createElement('a'); 250 251 toDeleteText = document.createTextNode('[x]'); 252 toDelete.setAttribute('href',"javascript:hide('" + forWhat + '_div' + theId + "')"); 253 254 toDelete.setAttribute('class','delete'); 255 256 toDelete.appendChild(toDeleteText); 257 258 newDiv.appendChild(label); 259 newDiv.appendChild(newOption); 260 newDiv.appendChild(document.createTextNode(" ")); 261 newDiv.appendChild(isDefault); 262 newDiv.appendChild(label1); 263 newDiv.appendChild(toDelete); 264 holder.appendChild(newDiv); 265 266 267 theId++ 268 document.getElementById(forWhat + "_option_number").value = theId; 269 } 270 271 function show_options(forWhat) { 272 document.getElementById("radio").style.display = "none"; 273 document.getElementById("selectbox").style.display = "none"; 274 document.getElementById("multiselectbox").style.display = "none"; 275 document.getElementById("checkbox").style.display = "none"; 276 277 if(forWhat == "radio") { 278 document.getElementById("radio").style.display = ""; 279 } 280 281 if(forWhat == "selectbox") { 282 document.getElementById("selectbox").style.display = ""; 283 } 284 285 if(forWhat == "multiselectbox") { 286 document.getElementById("multiselectbox").style.display = ""; 287 } 288 289 if(forWhat == "checkbox") { 290 document.getElementById("checkbox").style.display = ""; 291 } 292 } 293 294 function reorderFields(table, row, field_ids) { 295 jQuery.post( ajaxurl, { 296 action: 'xprofile_reorder_fields', 297 'cookie': encodeURIComponent(document.cookie), 298 '_wpnonce': jQuery("input#_wpnonce").val(), 299 'group': table.id.split('_')[1], 300 'row': row, 301 'field_ids': field_ids 302 }, 303 function(response) { 304 305 }, 306 1250 307 ); 308 } 309 310 function hide(id) { 311 if ( !document.getElementById(id) ) return false; 312 313 document.getElementById(id).style.display = "none"; 314 document.getElementById(id).value = ''; 315 } 316 317 // Set up deleting options ajax 318 jQuery(document).ready( function() { 319 var links = jQuery("a.ajax-option-delete"); 320 321 jQuery.each(links, 322 function(link, val) { 323 link.click( 324 function() { 325 } 326 ); 327 } 328 ); 329 330 jQuery("a.ajax-option-delete").click( 331 function() { 332 alert(ajaxUrl); 333 alert("test"); 334 return false; 335 var theId = this.id.split('-'); 336 theId = theId[1]; 337 338 jQuery.post( ajaxurl, { 339 action: 'xprofile_delete_option', 340 'cookie': encodeURIComponent(document.cookie), 341 '_wpnonce': jQuery("input#_wpnonce").val(), 342 343 'option_id': theId 344 }, 345 function(response) 346 { 347 alert(response); 348 }); 349 350 351 } 352 ); 353 }); 354 </script> 355 356 <?php 12 echo '<link rel="stylesheet" href="' . get_option('siteurl') . '/wp-content/mu-plugins/bp-xprofile/css/admin.css" type="text/css" />'; 357 13 } 358 14 } 15 add_action( 'admin_head', 'xprofile_add_admin_css' ); 16 17 18 function xprofile_add_admin_js() { 19 if ( strpos( $_GET['page'], 'xprofile' ) !== false ) { 20 wp_enqueue_script( 'bp-xprofile-admin-js', get_option('siteurl') . "/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 359 26 ?> -
trunk/bp-xprofile/bp-xprofile-signup.php
r304 r309 12 12 /* Fetch the fields needed for the signup form */ 13 13 $fields = BP_XProfile_Field::get_signup_fields(); 14 14 15 15 if ( $fields ) { 16 16 ?> … … 101 101 102 102 function xprofile_validate_signup_fields() { 103 global $bp_xprofile_callback, $avatar_error, $avatar_error_msg; 104 103 global $bp_xprofile_callback, $avatar_error, $avatar_error_msg, $has_errors; 104 global $canvas, $original; 105 105 106 if ( isset( $_POST['validate_custom'] ) ) { 106 107 // form has been submitted, let's validate the form … … 165 166 $prev_field_id = $field->id; 166 167 } 167 168 168 169 // validate the avatar upload if there is one. 169 170 $avatar_error = false; … … 204 205 } 205 206 206 $result = wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] ); 207 extract($result); 208 209 if ( $errors->get_error_code() || $has_errors || $avatar_error ) { 210 signup_user($user_name, $user_email, $errors); 211 212 echo '</div>'; 213 get_footer(); 214 die; 207 if ( !is_user_logged_in() ) { 208 $result = wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] ); 209 extract($result); 210 211 if ( $errors->get_error_code() || $has_errors || $avatar_error ) { 212 signup_user($user_name, $user_email, $errors); 213 214 echo '</div>'; 215 get_footer(); 216 die; 217 } 215 218 } 216 219 217 if ( !$hasErrors ) { 218 $result = wpmu_validate_blog_signup( $_POST['blog_id'], $_POST['blog_title'] ); 219 extract($result); 220 221 if ( $errors->get_error_code() ) { 220 if ( !$has_errors ) { 221 if ( !is_user_logged_in() ) { 222 // This is a new user signing up, not an existing user creating a home base. 223 $result = wpmu_validate_blog_signup( $_POST['blog_id'], $_POST['blog_title'] ); 224 extract($result); 225 226 if ( $errors->get_error_code() ) { 227 signup_user( $user_name, $user_email, $errors ); 228 return; 229 } 230 231 $public = (int) $_POST['blog_public']; 232 $meta = array( 'lang_id' => 1, 'public' => $public ); 233 234 for ( $i = 0; $i < count($bp_xprofile_callback); $i++ ) { 235 $meta['field_' . $bp_xprofile_callback[$i]['field_id']] .= $bp_xprofile_callback[$i]['value']; 236 } 237 238 $meta['xprofile_field_ids'] = $_POST['xprofile_ids']; 239 $meta['avatar_image_resized'] = $canvas; 240 $meta['avatar_image_original'] = $original; 241 242 $meta = apply_filters( "add_signup_meta", $meta ); 243 244 wpmu_signup_blog( $domain, $path, $blog_title, $user_name, $user_email, $meta ); 245 confirm_blog_signup( $domain, $path, $blog_title, $user_name, $user_email, $meta ); 246 247 echo '</div>'; 248 get_footer(); 249 die; 250 } else { 251 bp_core_validate_homebase_form_secondary(); 252 } 253 } else { 254 if ( !is_user_logged_in() ) { 222 255 signup_user( $user_name, $user_email, $errors ); 223 return; 224 } 225 226 $public = (int) $_POST['blog_public']; 227 $meta = array( 'lang_id' => 1, 'public' => $public ); 228 229 for ( $i = 0; $i < count($bp_xprofile_callback); $i++ ) { 230 $meta['field_' . $bp_xprofile_callback[$i]['field_id']] .= $bp_xprofile_callback[$i]['value']; 231 } 232 233 $meta['xprofile_field_ids'] = $_POST['xprofile_ids']; 234 $meta['avatar_image_resized'] = $canvas; 235 $meta['avatar_image_original'] = $original; 236 237 $meta = apply_filters( "add_signup_meta", $meta ); 238 239 wpmu_signup_blog( $domain, $path, $blog_title, $user_name, $user_email, $meta ); 240 confirm_blog_signup( $domain, $path, $blog_title, $user_name, $user_email, $meta ); 241 242 echo '</div>'; 243 get_footer(); 244 die; 245 } else { 246 signup_user( $user_name, $user_email, $errors ); 247 248 echo '</div>'; 249 get_footer(); 250 die; 256 257 echo '</div>'; 258 get_footer(); 259 die; 260 } else { 261 bp_core_validate_homebase_form_secondary( $user_name, $user_email, $errors ); 262 } 251 263 } 252 264 … … 291 303 function xprofile_on_activate( $blog_id = null, $user_id = null ) { 292 304 global $wpdb, $profile_picture_path; 293 294 // Extract signup meta fields to fill out profile 295 $field_ids = get_blog_option( $blog_id, 'xprofile_field_ids' ); 296 $field_ids = explode( ",", $field_ids ); 305 306 /* Only do this if this is a new user, and not a user creating a home base */ 307 if ( !is_user_logged_in() ) { 308 309 // Extract signup meta fields to fill out profile 310 $field_ids = get_blog_option( $blog_id, 'xprofile_field_ids' ); 311 $field_ids = explode( ",", $field_ids ); 297 312 298 // Get the new user ID. 299 $sql = "SELECT u.ID from " . $wpdb->base_prefix . "users u, 300 " . $wpdb->base_prefix . "usermeta um 301 WHERE u.ID = um.user_id 302 AND um.meta_key = 'primary_blog' 303 AND um.meta_value = " . $blog_id; 304 305 $user_id = $wpdb->get_var($sql); 306 307 // Loop through each bit of profile data and save it to profile. 308 for ( $i = 0; $i < count($field_ids); $i++ ) { 309 $field_value = get_blog_option( $blog_id, 'field_' . $field_ids[$i] ); 310 311 $field = new BP_XProfile_ProfileData(); 312 $field->user_id = $user_id; 313 $field->value = $field_value; 314 $field->field_id = $field_ids[$i]; 315 $field->last_updated = time(); 316 317 $field->save(); 318 delete_blog_option( $blog_id, 'field_' . $field_ids[$i] ); 319 } 320 delete_blog_option( $blog_id, 'xprofile_field_ids' ); 321 322 // move and set the avatar if one has been provided. 323 $resized = get_blog_option( $blog_id, 'avatar_image_resized' ); 324 $original = get_blog_option( $blog_id, 'avatar_image_original' ); 325 326 if ( $resized && $original ) { 327 $upload_dir = bp_upload_dir(NULL, $blog_id); 328 329 if ( $upload_dir ) { 330 $resized_strip_path = explode( '/', $resized ); 331 $original_strip_path = explode( '/', $original ); 332 333 $resized_filename = $resized_strip_path[count($resized_strip_path) - 1]; 334 $original_filename = $original_strip_path[count($original_strip_path) - 1]; 335 336 $resized_new = $upload_dir['path'] . '/' . $resized_filename; 337 $original_new = $upload_dir['path'] . '/' . $original_filename; 338 339 @copy( $resized, $resized_new ); 340 @copy( $original, $original_new ); 341 342 @unlink($resized); 343 @unlink($original); 344 345 $resized = $resized_new; 346 $original = $original_new; 313 // Get the new user ID. 314 $sql = "SELECT u.ID from " . $wpdb->base_prefix . "users u, 315 " . $wpdb->base_prefix . "usermeta um 316 WHERE u.ID = um.user_id 317 AND um.meta_key = 'primary_blog' 318 AND um.meta_value = " . $blog_id; 319 320 $user_id = $wpdb->get_var($sql); 321 322 // Loop through each bit of profile data and save it to profile. 323 for ( $i = 0; $i < count($field_ids); $i++ ) { 324 $field_value = get_blog_option( $blog_id, 'field_' . $field_ids[$i] ); 325 326 $field = new BP_XProfile_ProfileData(); 327 $field->user_id = $user_id; 328 $field->value = $field_value; 329 $field->field_id = $field_ids[$i]; 330 $field->last_updated = time(); 331 332 $field->save(); 333 delete_blog_option( $blog_id, 'field_' . $field_ids[$i] ); 347 334 } 348 349 // Render the cropper UI 350 $action = PROTOCOL . get_usermeta( $user_id, 'source_domain' ) . '/wp-activate.php?key=' . $_GET['key'] . '&cropped=true'; 351 bp_core_render_avatar_cropper($original, $resized, $action, $user_id); 352 353 //$result = bp_core_avatar_cropstore( $image, $image, $v1_x, $v1_y, XPROFILE_AVATAR_V1_W, XPROFILE_AVATAR_V1_H, $v2_x, $v2_y, XPROFILE_AVATAR_V2_W, XPROFILE_AVATAR_V2_H, true ); 354 //bp_core_avatar_save( $result, $user_id, $upload_dir ); 335 delete_blog_option( $blog_id, 'xprofile_field_ids' ); 336 337 /* Make this blog the "home base" for the new user */ 338 update_usermeta( $user_id, 'home_base', $blog_id ); 339 340 /* Set the BuddyPress theme as the theme for this blog */ 341 $wpdb->set_blog_id($blog_id); 342 switch_theme( 'buddypress', 'buddypress' ); 343 344 // move and set the avatar if one has been provided. 345 $resized = get_blog_option( $blog_id, 'avatar_image_resized' ); 346 $original = get_blog_option( $blog_id, 'avatar_image_original' ); 347 348 if ( $resized && $original ) { 349 $upload_dir = bp_upload_dir(NULL, $blog_id); 350 351 if ( $upload_dir ) { 352 $resized_strip_path = explode( '/', $resized ); 353 $original_strip_path = explode( '/', $original ); 354 355 $resized_filename = $resized_strip_path[count($resized_strip_path) - 1]; 356 $original_filename = $original_strip_path[count($original_strip_path) - 1]; 357 358 $resized_new = $upload_dir['path'] . '/' . $resized_filename; 359 $original_new = $upload_dir['path'] . '/' . $original_filename; 360 361 @copy( $resized, $resized_new ); 362 @copy( $original, $original_new ); 363 364 @unlink($resized); 365 @unlink($original); 366 367 $resized = $resized_new; 368 $original = $original_new; 369 } 370 371 // Render the cropper UI 372 $action = get_blog_option( $blog_id, 'siteurl' ) . '/wp-activate.php?key=' . $_GET['key'] . '&cropped=true'; 373 bp_core_render_avatar_cropper($original, $resized, $action, $user_id); 374 } 355 375 } 356 376 … … 364 384 365 385 // Confirm that the nonce is valid 366 if ( !isset( $_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'slick_avatars') )367 header('Location:' . get_option('home'));386 if ( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'slick_avatars' ) ) 387 wp_redirect( get_option('home') ); 368 388 369 389 $user_id = xprofile_get_user_by_key($_GET['key']); 370 390 371 if ( $user_id && isset( $_POST['orig']) && isset($_POST['canvas']) ) {391 if ( $user_id && isset( $_POST['orig'] ) && isset( $_POST['canvas'] ) ) { 372 392 bp_core_check_crop( $_POST['orig'], $_POST['canvas'] ); 373 393 $result = bp_core_avatar_cropstore( $_POST['orig'], $_POST['canvas'], $_POST['v1_x1'], $_POST['v1_y1'], $_POST['v1_w'], $_POST['v1_h'], $_POST['v2_x1'], $_POST['v2_y1'], $_POST['v2_w'], $_POST['v2_h'] ); 374 bp_core_avatar_save( $result, $user_id);394 bp_core_avatar_save( $result, $user_id ); 375 395 } 376 396 377 if ( VHOST == 'yes' ) { 378 $url = PROTOCOL . get_usermeta( $user_id, 'source_domain' ) . '/'; 379 } else { 380 $url = PROTOCOL . get_usermeta( $user_id, 'source_domain' ) . '/' . get_usermeta( $user_id, 'nickname' ); 381 } 382 383 header("Location: $url"); 397 $blog_id = get_usermeta( $user_id, 'home_base' ); 398 $url = get_blog_option( $blog_id, 'siteurl' ); 399 400 wp_redirect( $url ); 384 401 } 385 402 } -
trunk/bp-xprofile/bp-xprofile-templatetags.php
r304 r309 135 135 136 136 function bp_has_profile() { 137 global $profile_template; 137 global $bp, $profile_template; 138 139 $profile_template = new BP_XProfile_Template($bp['current_userid']); 140 138 141 return $profile_template->has_groups(); 139 142 } … … 251 254 function bp_user_status() { 252 255 // TODO: dummy function now, until status component is developed. 253 echo '[ TODO: Status Updates ]';256 return false; 254 257 } 255 258 … … 304 307 global $bp; 305 308 306 bp_core_avatar_admin( null, $bp['loggedin_domain'] . $bp['xprofile']['slug'] . '/change-avatar/');309 bp_core_avatar_admin( null, $bp['loggedin_domain'] . $bp['xprofile']['slug'] . '/change-avatar/', $bp['loggedin_domain'] . $bp['xprofile']['slug'] . '/delete-avatar/' ); 307 310 } 308 311 -
trunk/buddypress-theme/home/style.css
r262 r309 1 1 /* 2 Theme Name: BuddyPress Profile Default2 Theme Name: BuddyPress Home Theme 3 3 Theme URI: http://buddypress.com/ 4 Description: The default profile theme for BuddyPress4 Description: The theme for the home of an install 5 5 Version: 0.1 6 6 Author: Andy Peatling … … 221 221 padding: 0 0 0.2em 0; 222 222 } 223 /** TEMP **/ 223 224 /** SIGNUP FIELDS CSS **/ 224 225 225 226 table#extraFields td label, 226 div.radio span, 227 div.checkbox span { 228 font-weight: bold; 229 display: block; 230 float: left; 231 width: 115px; 232 } 233 234 table#extraFields td input { 235 font-size: 24px; 236 width: 280px; 237 } 238 239 table#extraFields td textarea { 240 width: 280px; 241 height: 120px; 242 } 243 244 table#extraFields td select { 245 width: 280px; 246 } 247 248 table#extraFields td div.datefield select { 249 width: auto; 250 } 251 252 table#extraFields td div.radio label, 253 table#extraFields td div.checkbox label { 254 display: inline; 255 font-weight: normal; 256 float: none; 257 } 258 259 table#extraFields td div.radio input, 260 table#extraFields td div.checkbox input { 261 width: auto; 262 } 263 264 span.desc { 265 margin-left: 115px; 266 font-weight: normal; 267 } 268 269 div.error { 270 font-weight: bold; 271 margin: 10px 0 10px 113px; 272 } 273 274 275 .signup-field { padding: 0.6em 0 !important;} 276 .signup-field label { padding: 1em 2em !important;} 277 .signup-field input[type='text'], .signup-field textarea { width: 55% !important;} 278 .signup-description { display: block; color: #888; font-size: 10px; padding: 0.5em 0 0 16.3em;} 279 .error { padding-left: 4.2em !important;} 227 div.radio span.signup-label, 228 div.checkbox span.signup-label { 229 font-weight: bold; 230 margin-top: 25px; 231 margin-bottom: 10px; 232 font-size: 1.2em; 233 display: block; 234 } 235 236 table#extraFields td input { 237 font-size: 24px; 238 width: 100%; 239 } 240 241 table#extraFields td textarea { 242 width: 80%; 243 height: 120px; 244 } 245 246 table#extraFields td select { 247 width: 280px; 248 font-size: 1.4em; 249 } 250 251 table#extraFields td div.datefield select { 252 width: auto; 253 } 254 255 table#extraFields td div.radio label, 256 table#extraFields td div.checkbox label { 257 display: inline; 258 font-weight: normal; 259 float: none; 260 padding: 0 !important; 261 margin-right: 15px; 262 } 263 264 table#extraFields td div.radio input, 265 table#extraFields td div.checkbox input { 266 width: auto; 267 } 268 269 span.desc { 270 margin-left: 115px; 271 font-weight: normal; 272 } 273 274 div.error { 275 font-weight: bold; 276 } 277 278 span.signup-description { 279 display: block; 280 margin: 5px 0 0 0; 281 } -
trunk/buddypress-theme/readme.txt
r170 r309 2 2 '''''''''''''''' 3 3 4 1. Backup /wp-content/themes/default/ 5 2. Copy the 'default' directory from /buddypress-theme/ into /wp-content/themes/ 6 3. All done. 4 1. Backup /wp-content/themes/home/ 5 2. Delete the existing 'home' theme from /wp-content/themes/ 6 3. Copy the 'buddypress' and 'home' directories from /buddypress-theme/ into /wp-content/themes/ 7 4. DO NOT rename the 'buddypress' theme (including the folder name and css file theme name) 8 4. All done.
Note: See TracChangeset
for help on using the changeset viewer.