Changeset 1021
- Timestamp:
- 02/06/2009 03:07:48 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 58 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity.php
r1017 r1021 27 27 global $wpdb, $bp; 28 28 29 if ( !$bp ['current_userid'])29 if ( !$bp->displayed_user->id ) 30 30 return false; 31 31 … … 33 33 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 34 34 35 $sql[] = "CREATE TABLE ". $bp ['activity']['table_name_current_user']." (35 $sql[] = "CREATE TABLE ". $bp->activity->table_name_current_user ." ( 36 36 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 37 37 item_id int(11) NOT NULL, … … 49 49 ) {$charset_collate};"; 50 50 51 $sql[] = "CREATE TABLE ". $bp ['activity']['table_name_current_user_cached']." (51 $sql[] = "CREATE TABLE ". $bp->activity->table_name_current_user_cached ." ( 52 52 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 53 53 item_id int(11) NOT NULL, … … 67 67 ) {$charset_collate};"; 68 68 69 $sql[] = "CREATE TABLE ". $bp ['activity']['table_name_current_user_friends_cached']." (69 $sql[] = "CREATE TABLE ". $bp->activity->table_name_current_user_friends_cached ." ( 70 70 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 71 71 user_id int(11) NOT NULL, … … 85 85 dbDelta($sql); 86 86 87 update_usermeta( $bp ['current_userid'], 'bp-activity-db-version', BP_ACTIVITY_DB_VERSION );87 update_usermeta( $bp->displayed_user->id, 'bp-activity-db-version', BP_ACTIVITY_DB_VERSION ); 88 88 } 89 89 … … 94 94 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 95 95 96 $sql[] = "CREATE TABLE ". $bp ['activity']['table_name_sitewide']." (96 $sql[] = "CREATE TABLE ". $bp->activity->table_name_sitewide ." ( 97 97 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 98 98 user_id int(11) NOT NULL, … … 117 117 // dbDelta won't change character sets, so we need to do this seperately. 118 118 // This will only be in here pre v1.0 119 $wpdb->query( $wpdb->prepare( "ALTER TABLE " . $bp ['activity']['table_name_sitewide']. " DEFAULT CHARACTER SET %s", $wpdb->charset ) );119 $wpdb->query( $wpdb->prepare( "ALTER TABLE " . $bp->activity->table_name_sitewide . " DEFAULT CHARACTER SET %s", $wpdb->charset ) ); 120 120 121 121 update_site_option( 'bp-activity-db-version', BP_ACTIVITY_DB_VERSION ); … … 132 132 global $bp, $wpdb, $current_blog; 133 133 134 $bp['activity'] = array( 135 'table_name_loggedin_user' => $wpdb->base_prefix . 'user_' . $bp['loggedin_userid'] . '_activity', 136 'table_name_loggedin_user_cached' => $wpdb->base_prefix . 'user_' . $bp['loggedin_userid'] . '_activity_cached', 137 138 'table_name_current_user' => $wpdb->base_prefix . 'user_' . $bp['current_userid'] . '_activity', 139 'table_name_current_user_cached' => $wpdb->base_prefix . 'user_' . $bp['current_userid'] . '_activity_cached', 140 141 'table_name_loggedin_user_friends_cached' => $wpdb->base_prefix . 'user_' . $bp['loggedin_userid'] . '_friends_activity_cached', 142 'table_name_current_user_friends_cached' => $wpdb->base_prefix . 'user_' . $bp['current_userid'] . '_friends_activity_cached', 143 144 'table_name_sitewide' => $wpdb->base_prefix . 'bp_activity_sitewide', 145 146 'image_base' => site_url( MUPLUGINDIR . '/bp-activity/images' ), 147 'slug' => BP_ACTIVITY_SLUG 148 ); 149 150 $bp['version_numbers'][$bp['activity']['slug']] = BP_ACTIVITY_VERSION; 151 152 if ( $bp['current_userid'] ) { 134 $bp->activity->table_name_loggedin_user = $wpdb->base_prefix . 'user_' . $bp->loggedin_user->id . '_activity'; 135 $bp->activity->table_name_loggedin_user_cached = $wpdb->base_prefix . 'user_' . $bp->loggedin_user->id . '_activity_cached'; 136 137 $bp->activity->table_name_current_user = $wpdb->base_prefix . 'user_' . $bp->displayed_user->id . '_activity'; 138 $bp->activity->table_name_current_user_cached = $wpdb->base_prefix . 'user_' . $bp->displayed_user->id . '_activity_cached'; 139 140 $bp->activity->table_name_loggedin_user_friends_cached = $wpdb->base_prefix . 'user_' . $bp->loggedin_user->id . '_friends_activity_cached'; 141 $bp->activity->table_name_current_user_friends_cached = $wpdb->base_prefix . 'user_' . $bp->displayed_user->id . '_friends_activity_cached'; 142 143 $bp->activity->table_name_sitewide = $wpdb->base_prefix . 'bp_activity_sitewide'; 144 145 $bp->activity->image_base = site_url( MUPLUGINDIR . '/bp-activity/images' ); 146 $bp->activity->slug = BP_ACTIVITY_SLUG; 147 148 $bp->version_numbers->activity = BP_ACTIVITY_VERSION; 149 150 if ( $bp->displayed_user->id ) { 153 151 /* Check to see if the current user has their activity table set up. If not, set them up. */ 154 if ( !$wpdb->get_var("SHOW TABLES LIKE '%" . $bp ['activity']['table_name_current_user'] . "%'") || get_usermeta( $bp['current_userid'], 'bp-activity-db-version' ) < BP_ACTIVITY_VERSION )152 if ( !$wpdb->get_var("SHOW TABLES LIKE '%" . $bp->activity->table_name_current_user . "%'") || get_usermeta( $bp->displayed_user->id, 'bp-activity-db-version' ) < BP_ACTIVITY_VERSION ) 155 153 bp_activity_user_install(); 156 154 } … … 158 156 if ( is_site_admin() && $current_blog->blog_id == 1 ) { 159 157 /* Check to see if the site wide activity table is set up. */ 160 if ( !$wpdb->get_var("SHOW TABLES LIKE '%" . $bp ['activity']['table_name_sitewide']. "%'") || get_site_option( 'bp-activity-db-version' ) < BP_ACTIVITY_VERSION )158 if ( !$wpdb->get_var("SHOW TABLES LIKE '%" . $bp->activity->table_name_sitewide . "%'") || get_site_option( 'bp-activity-db-version' ) < BP_ACTIVITY_VERSION ) 161 159 bp_activity_sitewide_install(); 162 160 } … … 176 174 177 175 /* Add 'Activity' to the main navigation */ 178 bp_core_add_nav_item( __('Activity', 'buddypress'), $bp ['activity']['slug']);179 bp_core_add_nav_default( $bp ['activity']['slug'], 'bp_activity_screen_my_activity', 'just-me' );176 bp_core_add_nav_item( __('Activity', 'buddypress'), $bp->activity->slug ); 177 bp_core_add_nav_default( $bp->activity->slug, 'bp_activity_screen_my_activity', 'just-me' ); 180 178 181 $activity_link = $bp ['loggedin_domain'] . $bp['activity']['slug']. '/';179 $activity_link = $bp->loggedin_user->domain . $bp->activity->slug . '/'; 182 180 183 181 /* Add the subnav items to the activity nav item */ 184 bp_core_add_subnav_item( $bp ['activity']['slug'], 'just-me', __('Just Me', 'buddypress'), $activity_link, 'bp_activity_screen_my_activity' );185 bp_core_add_subnav_item( $bp ['activity']['slug'], 'my-friends', __('My Friends', 'buddypress'), $activity_link, 'bp_activity_screen_friends_activity', 'activity-my-friends', bp_is_home() );186 187 if ( $bp ['current_component'] == $bp['activity']['slug']) {182 bp_core_add_subnav_item( $bp->activity->slug, 'just-me', __('Just Me', 'buddypress'), $activity_link, 'bp_activity_screen_my_activity' ); 183 bp_core_add_subnav_item( $bp->activity->slug, 'my-friends', __('My Friends', 'buddypress'), $activity_link, 'bp_activity_screen_friends_activity', 'activity-my-friends', bp_is_home() ); 184 185 if ( $bp->current_component == $bp->activity->slug ) { 188 186 if ( bp_is_home() ) { 189 $bp ['bp_options_title'] = __('My Activity', 'buddypress');187 $bp->bp_options_title = __( 'My Activity', 'buddypress' ); 190 188 } else { 191 $bp ['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 );192 $bp ['bp_options_title'] = $bp['current_fullname'];189 $bp->bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 ); 190 $bp->bp_options_title = $bp->displayed_user->fullname; 193 191 } 194 192 } … … 215 213 216 214 if ( !$user_id ) 217 $user_id = $bp ['loggedin_userid'];215 $user_id = $bp->loggedin_user->id; 218 216 219 217 $recorded_time = time(); … … 255 253 global $bp; 256 254 257 if ( $bp ['current_component'] != $bp['activity']['slug'] || $bp['current_action'] != 'feed' || $bp['current_userid'])255 if ( $bp->current_component != $bp->activity->slug || $bp->current_action != 'feed' || $bp->displayed_user->id ) 258 256 return false; 259 257 … … 266 264 global $bp; 267 265 268 if ( $bp ['current_component'] != $bp['activity']['slug'] || !$bp['current_userid'] || $bp['current_action']!= 'feed' )266 if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'feed' ) 269 267 return false; 270 268 … … 277 275 global $bp; 278 276 279 if ( $bp ['current_component'] != $bp['activity']['slug'] || !$bp['current_userid'] || $bp['current_action'] != 'my-friends' || $bp['action_variables'][0] != 'feed' )277 if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'my-friends' || $bp->action_variables[0] != 'feed' ) 280 278 return false; 281 279 -
trunk/bp-activity/bp-activity-classes.php
r909 r1021 31 31 global $wpdb, $bp; 32 32 33 $activity = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $this->table_name . "WHERE id = %d", $this->id ) );33 $activity = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$this->table_name} WHERE id = %d", $this->id ) ); 34 34 35 35 $this->item_id = $activity->item_id; … … 55 55 if ( !$this->exists() ) { 56 56 // Insert the new activity into the activity table. 57 $activity = $wpdb->query( $wpdb->prepare( "INSERT INTO " . $this->table_name . "( item_id, secondary_item_id, user_id, component_name, component_action, date_recorded, is_private, no_sitewide_cache ) VALUES ( %d, %d, %d, %s, %s, FROM_UNIXTIME(%d), %d, %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_recorded, $this->is_private, $this->no_sitewide_cache ) );57 $activity = $wpdb->query( $wpdb->prepare( "INSERT INTO {$this->table_name} ( item_id, secondary_item_id, user_id, component_name, component_action, date_recorded, is_private, no_sitewide_cache ) VALUES ( %d, %d, %d, %s, %s, FROM_UNIXTIME(%d), %d, %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_recorded, $this->is_private, $this->no_sitewide_cache ) ); 58 58 59 59 // Fetch the formatted activity content so we can add it to the cache. 60 if ( function_exists( $bp [$this->component_name]['format_activity_function']) ) {61 if ( !$activity_content = call_user_func( $bp[$this->component_name]['format_activity_function'], $this->item_id, $this->user_id, $this->component_action, $this->secondary_item_id, $this->for_secondary_user ) )60 if ( function_exists( $bp->{$this->component_name}->format_activity_function ) ) { 61 if ( !$activity_content = call_user_func( $bp->{$this->component_name}->format_activity_function, $this->item_id, $this->user_id, $this->component_action, $this->secondary_item_id, $this->for_secondary_user ) ) 62 62 return false; 63 63 } 64 64 65 65 // Add the cached version of the activity to the cached activity table. 66 $activity_cached = $wpdb->query( $wpdb->prepare( "INSERT INTO " . $this->table_name_cached . "( item_id, secondary_item_id, content, primary_link, component_name, component_action, date_cached, date_recorded, is_private ) VALUES ( %d, %d, %s, %s, %s, %s, FROM_UNIXTIME(%d), FROM_UNIXTIME(%d), %d )", $this->item_id, $this->secondary_item_id, $activity_content['content'], $activity_content['primary_link'], $this->component_name, $this->component_action, time(), $this->date_recorded, $this->is_private ) );66 $activity_cached = $wpdb->query( $wpdb->prepare( "INSERT INTO {$this->table_name_cached} ( item_id, secondary_item_id, content, primary_link, component_name, component_action, date_cached, date_recorded, is_private ) VALUES ( %d, %d, %s, %s, %s, %s, FROM_UNIXTIME(%d), FROM_UNIXTIME(%d), %d )", $this->item_id, $this->secondary_item_id, $activity_content['content'], $activity_content['primary_link'], $this->component_name, $this->component_action, time(), $this->date_recorded, $this->is_private ) ); 67 67 68 68 // Add the cached version of the activity to the sitewide activity table. 69 69 if ( !$this->no_sitewide_cache ) 70 $sitewide_cached = $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['activity']['table_name_sitewide'] . "( user_id, item_id, secondary_item_id, content, primary_link, component_name, component_action, date_cached, date_recorded ) VALUES ( %d, %d, %d, %s, %s, %s, %s, FROM_UNIXTIME(%d), FROM_UNIXTIME(%d) )", $this->user_id, $this->item_id, $this->secondary_item_id, $activity_content['content'], $activity_content['primary_link'], $this->component_name, $this->component_action, time(), $this->date_recorded ) );70 $sitewide_cached = $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->activity->table_name_sitewide} ( user_id, item_id, secondary_item_id, content, primary_link, component_name, component_action, date_cached, date_recorded ) VALUES ( %d, %d, %d, %s, %s, %s, %s, FROM_UNIXTIME(%d), FROM_UNIXTIME(%d) )", $this->user_id, $this->item_id, $this->secondary_item_id, $activity_content['content'], $activity_content['primary_link'], $this->component_name, $this->component_action, time(), $this->date_recorded ) ); 71 71 72 72 if ( $activity && $activity_cached ) … … 79 79 function exists() { 80 80 global $wpdb, $bp; 81 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM " . $this->table_name . "WHERE item_id = %d AND secondary_item_id = %d AND user_id = %d AND component_name = %s AND component_action = %s", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action ) );81 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$this->table_name} WHERE item_id = %d AND secondary_item_id = %d AND user_id = %d AND component_name = %s AND component_action = %s", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action ) ); 82 82 } 83 83 … … 90 90 return false; 91 91 92 if ( !$bp ['activity'])92 if ( !$bp->activity ) 93 93 bp_activity_setup_globals(); 94 94 … … 98 98 //error_log($wpdb->prepare( "DELETE FROM {$wpdb->base_prefix}user_{$user_id}_activity WHERE item_id = %d{$secondary_sql} AND user_id = %d AND component_name = %s AND component_action = %s", $item_id, $user_id, $component_name, $component_action ) ); 99 99 //error_log($wpdb->prepare( "DELETE FROM {$wpdb->base_prefix}user_{$user_id}_activity_cached WHERE item_id = %d{$secondary_sql} AND component_name = %s AND component_action = %s", $item_id, $component_name, $component_action ) ); 100 //error_log($wpdb->prepare( "DELETE FROM " . $bp ['activity']['table_name_sitewide']. " WHERE item_id = %d{$secondary_sql} AND user_id = %d AND component_name = %s AND component_action = %s", $item_id, $user_id, $component_name, $component_action ) );100 //error_log($wpdb->prepare( "DELETE FROM " . $bp->activity->table_name_sitewide . " WHERE item_id = %d{$secondary_sql} AND user_id = %d AND component_name = %s AND component_action = %s", $item_id, $user_id, $component_name, $component_action ) ); 101 101 102 102 $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->base_prefix}user_{$user_id}_activity WHERE item_id = %d{$secondary_sql} AND user_id = %d AND component_name = %s AND component_action = %s", $item_id, $user_id, $component_name, $component_action ) ); … … 104 104 // Delete this entry from the users' cache table and the sitewide cache table 105 105 $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->base_prefix}user_{$user_id}_activity_cached WHERE item_id = %d{$secondary_sql} AND component_name = %s AND component_action = %s", $item_id, $component_name, $component_action ) ); 106 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['activity']['table_name_sitewide'] . "WHERE item_id = %d{$secondary_sql} AND user_id = %d AND component_name = %s AND component_action = %s", $item_id, $user_id, $component_name, $component_action ) );106 $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_sitewide} WHERE item_id = %d{$secondary_sql} AND user_id = %d AND component_name = %s AND component_action = %s", $item_id, $user_id, $component_name, $component_action ) ); 107 107 108 108 return true; … … 113 113 114 114 if ( !$user_id ) 115 $user_id = $bp ['current_userid'];115 $user_id = $bp->displayed_user->id; 116 116 117 117 if ( !$user_id ) … … 127 127 128 128 /* Determine whether or not to use the cached activity stream, or re-select and cache a new stream */ 129 $last_cached = get_usermeta( $bp ['current_userid'], 'bp_activity_last_cached' );129 $last_cached = get_usermeta( $bp->displayed_user->id, 'bp_activity_last_cached' ); 130 130 131 131 if ( strtotime( BP_ACTIVITY_CACHE_LENGTH, (int)$last_cached ) >= time() ) { … … 134 134 135 135 // Use the cached activity stream. 136 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp['activity']['table_name_current_user_cached'] . "WHERE date_recorded >= FROM_UNIXTIME(%d) $privacy_sql ORDER BY date_recorded DESC $limit_sql", $since ) );136 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name_current_user_cached} WHERE date_recorded >= FROM_UNIXTIME(%d) $privacy_sql ORDER BY date_recorded DESC $limit_sql", $since ) ); 137 137 138 138 for ( $i = 0; $i < count( $activities ); $i++ ) { … … 152 152 153 153 // Reselect, format and cache a new activity stream. Override the limit otherwise we might only cache 5 items when viewing a profile page. 154 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp['activity']['table_name_current_user'] . "WHERE date_recorded >= FROM_UNIXTIME(%d) $privacy_sql ORDER BY date_recorded DESC LIMIT 30", $since ) );154 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name_current_user} WHERE date_recorded >= FROM_UNIXTIME(%d) $privacy_sql ORDER BY date_recorded DESC LIMIT 30", $since ) ); 155 155 156 156 for ( $i = 0; $i < count( $activities ); $i++ ) { 157 if ( function_exists( $bp [$activities[$i]->component_name]['format_activity_function']) ) {158 if ( !$content = call_user_func( $bp[$activities[$i]->component_name]['format_activity_function'], $activities[$i]->item_id, $activities[$i]->user_id, $activities[$i]->component_action, $activities[$i]->secondary_item_id ) )157 if ( function_exists( $bp->{$activities[$i]->component_name}->format_activity_function ) ) { 158 if ( !$content = call_user_func( $bp->{$activities[$i]->component_name}->format_activity_function, $activities[$i]->item_id, $activities[$i]->user_id, $activities[$i]->component_action, $activities[$i]->secondary_item_id ) ) 159 159 continue; 160 160 … … 199 199 200 200 /* Determine whether or not to use the cached friends activity stream, or re-select and cache a new stream */ 201 $last_cached = get_usermeta( $bp ['loggedin_userid'], 'bp_activity_friends_last_cached' );201 $last_cached = get_usermeta( $bp->loggedin_user->id, 'bp_activity_friends_last_cached' ); 202 202 203 203 if ( strtotime( BP_ACTIVITY_CACHE_LENGTH, (int)$last_cached ) >= time() ) { … … 206 206 207 207 // Use the cached activity stream. 208 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp['activity']['table_name_loggedin_user_friends_cached'] . "ORDER BY date_recorded DESC $limit_sql" ) );208 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name_loggedin_user_friends_cached} ORDER BY date_recorded DESC $limit_sql" ) ); 209 209 210 210 for ( $i = 0; $i < count( $activities ); $i++ ) { … … 231 231 $table_name = $wpdb->base_prefix . 'user_' . $friend_ids[$i] . '_activity_cached'; 232 232 233 $activities[$i]['activity'] = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $table_name . "WHERE is_private = 0 ORDER BY date_recorded $limit_sql" ) );233 $activities[$i]['activity'] = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$table_name} WHERE is_private = 0 ORDER BY date_recorded $limit_sql" ) ); 234 234 $activities[$i]['full_name'] = bp_fetch_user_fullname( $friend_ids[$i], false ); 235 235 } … … 265 265 266 266 /* Remove entries that are older than 6 months */ 267 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp ['activity']['table_name_sitewide']. " WHERE DATE_ADD(date_recorded, INTERVAL 6 MONTH) <= NOW()" ) );268 269 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp ['activity']['table_name_sitewide']. " ORDER BY date_recorded DESC $limit_sql" ) );267 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->activity->table_name_sitewide . " WHERE DATE_ADD(date_recorded, INTERVAL 6 MONTH) <= NOW()" ) ); 268 269 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp->activity->table_name_sitewide . " ORDER BY date_recorded DESC $limit_sql" ) ); 270 270 271 271 for ( $i = 0; $i < count( $activities ); $i++ ) { … … 289 289 $activity_feed[$i]['title'] = trim( strip_tags( $title[0] ) ); 290 290 $activity_feed[$i]['link'] = $activities[$i]['primary_link']; 291 $activity_feed[$i]['description'] = sprintf 291 $activity_feed[$i]['description'] = sprintf( $activities[$i]['content'], '' ); 292 292 $activity_feed[$i]['pubdate'] = $activities[$i]['date_recorded']; 293 293 } … … 300 300 301 301 /* Empty the cache */ 302 $wpdb->query( "TRUNCATE TABLE " . $bp['activity']['table_name_loggedin_user_friends_cached']);302 $wpdb->query( "TRUNCATE TABLE {$bp->activity->table_name_loggedin_user_friends_cached}" ); 303 303 304 304 for ( $i = 0; $i < count($activity_array); $i++ ) { 305 305 // Cache that sucka... 306 $cached = $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['activity']['table_name_loggedin_user_friends_cached'] . "( user_id, content, primary_link, component_name, component_action, date_cached, date_recorded ) VALUES ( %d, %s, %s, %s, %s, FROM_UNIXTIME(%d), %s )", $activity_array[$i]['user_id'], $activity_array[$i]['content'], $activity_array[$i]['primary_link'], $activity_array[$i]['component_name'], $activity_array[$i]['component_action'], time(), $activity_array[$i]['date_recorded'] ) );307 } 308 309 update_usermeta( $bp ['loggedin_userid'], 'bp_activity_friends_last_cached', time() );306 $cached = $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->activity->table_name_loggedin_user_friends_cached} ( user_id, content, primary_link, component_name, component_action, date_cached, date_recorded ) VALUES ( %d, %s, %s, %s, %s, FROM_UNIXTIME(%d), %s )", $activity_array[$i]['user_id'], $activity_array[$i]['content'], $activity_array[$i]['primary_link'], $activity_array[$i]['component_name'], $activity_array[$i]['component_action'], time(), $activity_array[$i]['date_recorded'] ) ); 307 } 308 309 update_usermeta( $bp->loggedin_user->id, 'bp_activity_friends_last_cached', time() ); 310 310 } 311 311 … … 314 314 315 315 /* Empty the cache */ 316 $wpdb->query( "TRUNCATE TABLE " . $bp['activity']['table_name_current_user_cached']);316 $wpdb->query( "TRUNCATE TABLE {$bp->activity->table_name_current_user_cached}" ); 317 317 318 318 /* Empty user's activities from the sitewide stream */ 319 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp ['activity']['table_name_sitewide']. " WHERE user_id = %d", $user_id ) );319 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->activity->table_name_sitewide . " WHERE user_id = %d", $user_id ) ); 320 320 321 321 for ( $i = 0; $i < count($activity_array); $i++ ) { … … 323 323 324 324 // Cache that sucka... 325 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp ['activity']['table_name_current_user_cached']. " ( content, item_id, secondary_item_id, primary_link, component_name, component_action, date_cached, date_recorded, is_private ) VALUES ( %s, %d, %d, %s, %s, %s, FROM_UNIXTIME(%d), %s, %d )", $activity_array[$i]['content'], $activity_array[$i]['item_id'], $activity_array[$i]['secondary_item_id'], $activity_array[$i]['primary_link'], $activity_array[$i]['component_name'], $activity_array[$i]['component_action'], time(), $activity_array[$i]['date_recorded'], $activity_array[$i]['is_private'] ) );325 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp->activity->table_name_current_user_cached . " ( content, item_id, secondary_item_id, primary_link, component_name, component_action, date_cached, date_recorded, is_private ) VALUES ( %s, %d, %d, %s, %s, %s, FROM_UNIXTIME(%d), %s, %d )", $activity_array[$i]['content'], $activity_array[$i]['item_id'], $activity_array[$i]['secondary_item_id'], $activity_array[$i]['primary_link'], $activity_array[$i]['component_name'], $activity_array[$i]['component_action'], time(), $activity_array[$i]['date_recorded'], $activity_array[$i]['is_private'] ) ); 326 326 327 327 // Add to the sitewide activity stream 328 328 if ( !$activity_array[$i]['is_private'] && !$activity_array[$i]['no_sitewide_cache'] ) 329 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp ['activity']['table_name_sitewide']. " ( user_id, content, item_id, secondary_item_id, primary_link, component_name, component_action, date_cached, date_recorded ) VALUES ( %d, %s, %d, %d, %s, %s, %s, FROM_UNIXTIME(%d), %s )", $user_id, $activity_array[$i]['content'], $activity_array[$i]['item_id'], $activity_array[$i]['secondary_item_id'], $activity_array[$i]['primary_link'], $activity_array[$i]['component_name'], $activity_array[$i]['component_action'], time(), $activity_array[$i]['date_recorded'] ) );330 } 331 332 update_usermeta( $bp ['current_userid'], 'bp_activity_last_cached', time() );329 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp->activity->table_name_sitewide . " ( user_id, content, item_id, secondary_item_id, primary_link, component_name, component_action, date_cached, date_recorded ) VALUES ( %d, %s, %d, %d, %s, %s, %s, FROM_UNIXTIME(%d), %s )", $user_id, $activity_array[$i]['content'], $activity_array[$i]['item_id'], $activity_array[$i]['secondary_item_id'], $activity_array[$i]['primary_link'], $activity_array[$i]['component_name'], $activity_array[$i]['component_action'], time(), $activity_array[$i]['date_recorded'] ) ); 330 } 331 332 update_usermeta( $bp->displayed_user->id, 'bp_activity_last_cached', time() ); 333 333 } 334 334 … … 337 337 338 338 /* Empty user's activities from the sitewide stream */ 339 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp ['activity']['table_name_sitewide']. " WHERE user_id = %d", $user_id ) );339 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->activity->table_name_sitewide . " WHERE user_id = %d", $user_id ) ); 340 340 341 341 /* Empty the user's activity items and cached activity items */ … … 349 349 global $bp, $wpdb; 350 350 351 return $wpdb->get_var( $wpdb->prepare( "SELECT date_recorded FROM " . $bp ['activity']['table_name_sitewide']. " ORDER BY date_recorded ASC LIMIT 1" ) );351 return $wpdb->get_var( $wpdb->prepare( "SELECT date_recorded FROM " . $bp->activity->table_name_sitewide . " ORDER BY date_recorded ASC LIMIT 1" ) ); 352 352 } 353 353 -
trunk/bp-activity/bp-activity-templatetags.php
r933 r1021 24 24 25 25 if ( !$user_id ) 26 $user_id = $bp ['current_userid'];27 28 if ( $bp ['current_component'] != $bp['activity']['slug'] || ( $bp['current_component'] == $bp['activity']['slug'] && $bp['current_action'] == 'just-me' || $bp['current_action']== 'feed' ) ) {26 $user_id = $bp->displayed_user->id; 27 28 if ( $bp->current_component != $bp->activity->slug || ( $bp->current_component == $bp->activity->slug && $bp->current_action == 'just-me' || $bp->current_action == 'feed' ) ) { 29 29 $this->activities = BP_Activity_Activity::get_activity_for_user( $user_id, $limit ); 30 30 } else { … … 34 34 $this->activity_count = count($this->activities); 35 35 36 $this->full_name = $bp ['current_fullname'];36 $this->full_name = $bp->displayed_user->fullname; 37 37 38 38 $this->is_home = bp_is_home(); … … 99 99 global $bp, $activities_template, $bp_activity_user_id, $bp_activity_limit; 100 100 101 if ( $bp ['current_action']== 'my-friends' )101 if ( $bp->current_action == 'my-friends' ) 102 102 $filter_content = false; 103 103 else … … 105 105 106 106 if ( !$bp_activity_user_id ) 107 $bp_activity_user_id = $bp ['current_userid'];107 $bp_activity_user_id = $bp->displayed_user->id; 108 108 109 109 if ( !$bp_activity_limit ) … … 200 200 global $bp; 201 201 202 echo apply_filters( 'bp_sitewide_activity_feed_link', site_url() . '/' . $bp ['activity']['slug']. '/feed' );202 echo apply_filters( 'bp_sitewide_activity_feed_link', site_url() . '/' . $bp->activity->slug . '/feed' ); 203 203 } 204 204 … … 206 206 global $bp; 207 207 208 if ( ( $bp ['current_component'] == $bp['profile']['slug'] ) || $bp['current_action']== 'just-me' )209 echo apply_filters( 'bp_activities_member_rss_link', $bp ['current_domain'] . $bp['activity']['slug']. '/feed' );208 if ( ( $bp->current_component == $bp->profile->slug ) || $bp->current_action == 'just-me' ) 209 echo apply_filters( 'bp_activities_member_rss_link', $bp->displayed_user->domain . $bp->activity->slug . '/feed' ); 210 210 else 211 echo apply_filters( 'bp_activities_member_rss_link', $bp ['current_domain'] . $bp['activity']['slug']. '/my-friends/feed' );211 echo apply_filters( 'bp_activities_member_rss_link', $bp->displayed_user->domain . $bp->activity->slug . '/my-friends/feed' ); 212 212 } 213 213 -
trunk/bp-activity/bp-activity-widgets.php
r954 r1021 33 33 <?php if ( $activity ) : ?> 34 34 <div class="item-options" id="activity-list-options"> 35 <img src="<?php echo $bp ['activity']['image_base']?>/rss.png" alt="<?php _e( 'RSS Feed', 'buddypress' ) ?>" /> <a href="<?php bp_sitewide_activity_feed_link() ?>" title="<?php _e( 'Site Wide Activity RSS Feed', 'buddypress' ) ?>"><?php _e( 'RSS Feed', 'buddypress' ) ?></a>35 <img src="<?php echo $bp->activity->image_base; ?>/rss.png" alt="<?php _e( 'RSS Feed', 'buddypress' ) ?>" /> <a href="<?php bp_sitewide_activity_feed_link() ?>" title="<?php _e( 'Site Wide Activity RSS Feed', 'buddypress' ) ?>"><?php _e( 'RSS Feed', 'buddypress' ) ?></a> 36 36 </div> 37 37 <ul id="site-wide-stream" class="activity-list"> -
trunk/bp-activity/feeds/bp-activity-friends-feed.php
r608 r1021 20 20 21 21 <channel> 22 <title><?php echo $bp ['current_fullname']; ?> - <?php _e( 'Friends Activity', 'buddypress' ) ?></title>22 <title><?php echo $bp->displayed_user->fullname; ?> - <?php _e( 'Friends Activity', 'buddypress' ) ?></title> 23 23 <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> 24 <link><?php $bp ['current_domain'] . '/' . $bp['activity']['slug']. '/my-friends/feed' ?></link>25 <description><?php _e( sprintf( '%s - Friends Activity Feed', $bp ['current_fullname']), 'buddypress' ) ?></description>24 <link><?php $bp->displayed_user->domain . '/' . $bp->activity->slug . '/my-friends/feed' ?></link> 25 <description><?php _e( sprintf( '%s - Friends Activity Feed', $bp->displayed_user->fullname ), 'buddypress' ) ?></description> 26 26 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_activity_get_last_updated(), false); ?></pubDate> 27 27 <generator>http://buddypress.org/?bp-activity-version=<?php echo BP_ACTIVITY_VERSION ?></generator> -
trunk/bp-activity/feeds/bp-activity-personal-feed.php
r601 r1021 19 19 20 20 <channel> 21 <title><?php echo $bp ['current_fullname']; ?> - <?php _e( 'Activity', 'buddypress' ) ?></title>21 <title><?php echo $bp->displayed_user->fullname; ?> - <?php _e( 'Activity', 'buddypress' ) ?></title> 22 22 <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> 23 <link><?php echo $bp ['current_domain'] . $bp['activity']['slug']. '/feed' ?></link>24 <description><?php _e( sprintf( '%s - Activity Feed', $bp ['current_fullname']), 'buddypress' ) ?></description>23 <link><?php echo $bp->displayed_user->domain . $bp->activity->slug . '/feed' ?></link> 24 <description><?php _e( sprintf( '%s - Activity Feed', $bp->displayed_user->fullname ), 'buddypress' ) ?></description> 25 25 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_activity_get_last_updated(), false); ?></pubDate> 26 26 <generator>http://buddypress.org/?bp-activity-version=<?php echo BP_ACTIVITY_VERSION ?></generator> -
trunk/bp-activity/feeds/bp-activity-sitewide-feed.php
r601 r1021 22 22 <title><?php echo get_site_option( 'site_name' ); ?> - <?php _e( 'Site Wide Activity', 'buddypress' ) ?></title> 23 23 <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> 24 <link><?php echo site_url() . '/' . $bp ['activity']['slug']. '/feed' ?></link>24 <link><?php echo site_url() . '/' . $bp->activity->slug . '/feed' ?></link> 25 25 <description><?php _e( 'Site Wide Activity Feed', 'buddypress' ) ?></description> 26 26 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_activity_get_last_updated(), false); ?></pubDate> -
trunk/bp-blogs.php
r1017 r1021 31 31 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 32 32 33 $sql[] = "CREATE TABLE ". $bp['blogs']['table_name'] ."(33 $sql[] = "CREATE TABLE {$bp->blogs->table_name} ( 34 34 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 35 35 user_id int(11) NOT NULL, … … 39 39 ) {$charset_collate};"; 40 40 41 $sql[] = "CREATE TABLE ". $bp['blogs']['table_name_blog_posts'] ."(41 $sql[] = "CREATE TABLE {$bp->blogs->table_name_blog_posts} ( 42 42 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 43 43 user_id int(11) NOT NULL, … … 50 50 ) {$charset_collate};"; 51 51 52 $sql[] = "CREATE TABLE ". $bp['blogs']['table_name_blog_comments'] ."(52 $sql[] = "CREATE TABLE {$bp->blogs->table_name_blog_comments} ( 53 53 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 54 54 user_id int(11) NOT NULL, … … 63 63 ) {$charset_collate};"; 64 64 65 $sql[] = "CREATE TABLE ". $bp['blogs']['table_name_blogmeta'] ."(65 $sql[] = "CREATE TABLE {$bp->blogs->table_name_blogmeta} ( 66 66 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 67 67 blog_id int(11) NOT NULL, … … 87 87 // Import blog titles and descriptions into the blogmeta table 88 88 if ( get_site_option( 'bp-blogs-version' ) <= '0.1.5' ) { 89 $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM " . $bp ['blogs']['table_name']) );89 $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM " . $bp->blogs->table_name ) ); 90 90 91 91 for ( $i = 0; $i < count($blog_ids); $i++ ) { … … 110 110 if ( is_site_admin() ) { 111 111 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 112 if ( ( $wpdb->get_var("SHOW TABLES LIKE '%" . $bp ['blogs']['table_name']. "%'") == false ) || ( get_site_option('bp-blogs-db-version') < BP_BLOGS_DB_VERSION ) )112 if ( ( $wpdb->get_var("SHOW TABLES LIKE '%" . $bp->blogs->table_name . "%'") == false ) || ( get_site_option('bp-blogs-db-version') < BP_BLOGS_DB_VERSION ) ) 113 113 bp_blogs_install(); 114 114 } … … 127 127 global $bp, $wpdb; 128 128 129 $bp['blogs'] = array( 130 'table_name' => $wpdb->base_prefix . 'bp_user_blogs', 131 'table_name_blog_posts' => $wpdb->base_prefix . 'bp_user_blogs_posts', 132 'table_name_blog_comments' => $wpdb->base_prefix . 'bp_user_blogs_comments', 133 'table_name_blogmeta' => $wpdb->base_prefix . 'bp_user_blogs_blogmeta', 134 'format_activity_function' => 'bp_blogs_format_activity', 135 'image_base' => site_url( MUPLUGINDIR . '/bp-groups/images' ), 136 'slug' => BP_BLOGS_SLUG 137 ); 138 139 $bp['version_numbers'][$bp['blogs']['slug']] = BP_BLOGS_VERSION; 140 141 /* Register 'groups' as a root component */ 142 bp_core_add_root_component( $bp['blogs']['slug'] ); 129 $bp->blogs->table_name = $wpdb->base_prefix . 'bp_user_blogs'; 130 $bp->blogs->table_name_blog_posts = $wpdb->base_prefix . 'bp_user_blogs_posts'; 131 $bp->blogs->table_name_blog_comments = $wpdb->base_prefix . 'bp_user_blogs_comments'; 132 $bp->blogs->table_name_blogmeta = $wpdb->base_prefix . 'bp_user_blogs_blogmeta'; 133 $bp->blogs->format_activity_function = 'bp_blogs_format_activity'; 134 $bp->blogs->image_base = site_url( MUPLUGINDIR . '/bp-groups/images' ); 135 $bp->blogs->slug = BP_BLOGS_SLUG; 136 137 $bp->version_numbers->blogs = BP_BLOGS_VERSION; 143 138 } 144 139 add_action( 'wp', 'bp_blogs_setup_globals', 1 ); … … 155 150 * 156 151 * Adds "Blog" to the navigation arrays for the current and logged in user. 157 * $bp['bp_nav'] represents the main component navigation158 * $bp['bp_users_nav'] represents the sub navigation when viewing a users159 * profile other than that of the current logged in user.160 152 * 161 153 * @package BuddyPress Blogs … … 167 159 168 160 /* Add 'Blogs' to the main navigation */ 169 bp_core_add_nav_item( __( 'Blogs', 'buddypress'), $bp['blogs']['slug']);170 171 if ( $bp ['current_userid'])172 bp_core_add_nav_default( $bp ['blogs']['slug'], 'bp_blogs_screen_my_blogs', 'my-blogs' );173 174 $blogs_link = $bp ['loggedin_domain'] . $bp['blogs']['slug']. '/';161 bp_core_add_nav_item( __( 'Blogs', 'buddypress' ), $bp->blogs->slug ); 162 163 if ( $bp->displayed_user->id ) 164 bp_core_add_nav_default( $bp->blogs->slug, 'bp_blogs_screen_my_blogs', 'my-blogs' ); 165 166 $blogs_link = $bp->loggedin_user->domain . $bp->blogs->slug . '/'; 175 167 176 168 /* Add the subnav items to the blogs nav item */ 177 bp_core_add_subnav_item( $bp ['blogs']['slug'], 'my-blogs', __('My Blogs', 'buddypress'), $blogs_link, 'bp_blogs_screen_my_blogs', 'my-blogs-list' );178 bp_core_add_subnav_item( $bp ['blogs']['slug'], 'recent-posts', __('Recent Posts', 'buddypress'), $blogs_link, 'bp_blogs_screen_recent_posts' );179 bp_core_add_subnav_item( $bp ['blogs']['slug'], 'recent-comments', __('Recent Comments', 'buddypress'), $blogs_link, 'bp_blogs_screen_recent_comments' );180 bp_core_add_subnav_item( $bp ['blogs']['slug'], 'create-a-blog', __('Create a Blog', 'buddypress'), $blogs_link, 'bp_blogs_screen_create_a_blog' );169 bp_core_add_subnav_item( $bp->blogs->slug, 'my-blogs', __('My Blogs', 'buddypress'), $blogs_link, 'bp_blogs_screen_my_blogs', 'my-blogs-list' ); 170 bp_core_add_subnav_item( $bp->blogs->slug, 'recent-posts', __('Recent Posts', 'buddypress'), $blogs_link, 'bp_blogs_screen_recent_posts' ); 171 bp_core_add_subnav_item( $bp->blogs->slug, 'recent-comments', __('Recent Comments', 'buddypress'), $blogs_link, 'bp_blogs_screen_recent_comments' ); 172 bp_core_add_subnav_item( $bp->blogs->slug, 'create-a-blog', __('Create a Blog', 'buddypress'), $blogs_link, 'bp_blogs_screen_create_a_blog' ); 181 173 182 174 /* Set up the component options navigation for Blog */ 183 if ( $bp ['current_component']== 'blogs' ) {175 if ( $bp->current_component == 'blogs' ) { 184 176 if ( bp_is_home() ) { 185 177 if ( function_exists('xprofile_setup_nav') ) { 186 $bp ['bp_options_title']= __('My Blogs', 'buddypress');178 $bp->bp_options_title = __('My Blogs', 'buddypress'); 187 179 } 188 180 } else { 189 181 /* If we are not viewing the logged in user, set up the current users avatar and name */ 190 $bp ['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 );191 $bp ['bp_options_title'] = $bp['current_fullname'];182 $bp->bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 ); 183 $bp->bp_options_title = $bp->displayed_user->fullname; 192 184 } 193 185 } … … 229 221 /* Because blog, comment, and blog post code execution happens before anything else 230 222 we need to manually instantiate the activity component globals */ 231 if ( !$bp ['activity']&& function_exists('bp_activity_setup_globals') )223 if ( !$bp->activity && function_exists('bp_activity_setup_globals') ) 232 224 bp_activity_setup_globals(); 233 225 … … 364 356 365 357 if ( !$user_id ) 366 $user_id = $bp ['loggedin_userid'];358 $user_id = $bp->loggedin_user->id; 367 359 368 360 $name = get_blog_option( $blog_id, 'blogname' ); … … 577 569 578 570 // Delete activity stream item 579 bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component_name' => 'blogs', 'component_action' => 'new_blog', 'user_id' => $bp ['loggedin_userid']) );571 bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component_name' => 'blogs', 'component_action' => 'new_blog', 'user_id' => $bp->loggedin_user->id ) ); 580 572 581 573 do_action( 'bp_blogs_remove_blog', $blog_id ); … … 635 627 636 628 // Delete activity stream item 637 bp_blogs_delete_activity( array( 'item_id' => $comment_id, 'component_name' => 'blogs', 'component_action' => 'new_blog_comment', 'user_id' => $bp ['loggedin_userid']) );629 bp_blogs_delete_activity( array( 'item_id' => $comment_id, 'component_name' => 'blogs', 'component_action' => 'new_blog_comment', 'user_id' => $bp->loggedin_user->id ) ); 638 630 639 631 do_action( 'bp_blogs_remove_comment', $blog_id, $comment_id ); … … 699 691 global $bp, $wpdb; 700 692 701 if ( $bp ['current_component'] == $bp['blogs']['slug']&& isset( $_GET['random-blog'] ) ) {693 if ( $bp->current_component == $bp->blogs->slug && isset( $_GET['random-blog'] ) ) { 702 694 $blog = bp_blogs_get_random_blog(); 703 695 … … 729 721 730 722 if ( !$meta_key ) { 731 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp ['blogs']['table_name_blogpmeta']. " WHERE blog_id = %d", $blog_id ) );723 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->blogs->table_name_blogpmeta . " WHERE blog_id = %d", $blog_id ) ); 732 724 } else if ( !$meta_value ) { 733 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['blogs']['table_name_blogmeta'] . "WHERE blog_id = %d AND meta_key = %s AND meta_value = %s", $blog_id, $meta_key, $meta_value ) );725 $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d AND meta_key = %s AND meta_value = %s", $blog_id, $meta_key, $meta_value ) ); 734 726 } else { 735 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['blogs']['table_name_blogmeta'] . "WHERE blog_id = %d AND meta_key = %s", $blog_id, $meta_key ) );727 $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d AND meta_key = %s", $blog_id, $meta_key ) ); 736 728 } 737 729 … … 760 752 // $metas = array($user->$meta_key); 761 753 //else 762 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM " . $bp['blogs']['table_name_blogmeta'] . "WHERE blog_id = %d AND meta_key = %s", $blog_id, $meta_key) );754 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d AND meta_key = %s", $blog_id, $meta_key) ); 763 755 } else { 764 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM " . $bp['blogs']['table_name_blogmeta'] . "WHERE blog_id = %d", $blog_id) );756 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d", $blog_id) ); 765 757 } 766 758 … … 797 789 } 798 790 799 $cur = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp['blogs']['table_name_blogmeta'] . "WHERE blog_id = %d AND meta_key = %s", $blog_id, $meta_key ) );791 $cur = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->blogs->table_name_blogmeta} WHERE blog_id = %d AND meta_key = %s", $blog_id, $meta_key ) ); 800 792 801 793 if ( !$cur ) { 802 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['blogs']['table_name_blogmeta'] . "( blog_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", $blog_id, $meta_key, $meta_value ) );794 $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->blogs->table_name_blogmeta} ( blog_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", $blog_id, $meta_key, $meta_value ) ); 803 795 } else if ( $cur->meta_value != $meta_value ) { 804 $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['blogs']['table_name_blogmeta'] . "SET meta_value = %s WHERE blog_id = %d AND meta_key = %s", $meta_value, $blog_id, $meta_key ) );796 $wpdb->query( $wpdb->prepare( "UPDATE {$bp->blogs->table_name_blogmeta} SET meta_value = %s WHERE blog_id = %d AND meta_key = %s", $meta_value, $blog_id, $meta_key ) ); 805 797 } else { 806 798 return false; -
trunk/bp-blogs/bp-blogs-ajax.php
r926 r1021 35 35 <div id="blog-dir-count" class="pag-count"> 36 36 <?php echo sprintf( __( 'Viewing blog %d to %d (%d total active blogs)', 'buddypress' ), $from_num, $to_num, $blogs['total'] ); ?> 37 <img id="ajax-loader-blogs" src="<?php echo $bp ['core']['image_base']?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />37 <img id="ajax-loader-blogs" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" /> 38 38 </div> 39 39 … … 46 46 <li> 47 47 <div class="item-avatar"> 48 <img src="<?php echo 'http://www.gravatar.com/avatar/' . md5( $blog->blog_id . '.blogs@' . $bp ['root_domain']) . '?d=identicon&s=50'; ?>" class="avatar" alt="Blog Identicon" />48 <img src="<?php echo 'http://www.gravatar.com/avatar/' . md5( $blog->blog_id . '.blogs@' . $bp->root_domain ) . '?d=identicon&s=50'; ?>" class="avatar" alt="Blog Identicon" /> 49 49 </div> 50 50 -
trunk/bp-blogs/bp-blogs-templatetags.php
r833 r1021 19 19 20 20 if ( !$user_id ) 21 $user_id = $bp ['current_userid'];21 $user_id = $bp->displayed_user->id; 22 22 23 23 $this->pag_page = isset( $_GET['fpage'] ) ? intval( $_GET['fpage'] ) : 1; … … 137 137 138 138 if ( !$user_id ) 139 $user_id = $bp ['current_userid'];139 $user_id = $bp->displayed_user->id; 140 140 141 141 $this->pag_page = isset( $_GET['fpage'] ) ? intval( $_GET['fpage'] ) : 1; … … 485 485 486 486 if ( !$user_id ) 487 $user_id = $bp ['current_userid'];487 $user_id = $bp->displayed_user->id; 488 488 489 489 $this->pag_page = isset( $_GET['fpage'] ) ? intval( $_GET['fpage'] ) : 1; … … 684 684 <p><?php _e("If you’re not going to use a great blog domain, leave it for a new user. Now have at it!", 'buddypress') ?></p> 685 685 686 <form id="setupform" method="post" action="<?php echo $bp ['loggedin_domain'] . $bp['blogs']['slug']. '/create-a-blog' ?>">686 <form id="setupform" method="post" action="<?php echo $bp->loggedin_user->domain . $bp->blogs->slug . '/create-a-blog' ?>"> 687 687 688 688 <input type="hidden" name="stage" value="gimmeanotherblog" /> … … 804 804 805 805 if ( bp_is_home() ) { 806 echo apply_filters( 'bp_create_blog_link', '<a href="' . $bp ['loggedin_domain'] . $bp['blogs']['slug']. '/create-a-blog">' . __('Create a Blog', 'buddypress') . '</a>' );806 echo apply_filters( 'bp_create_blog_link', '<a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/create-a-blog">' . __('Create a Blog', 'buddypress') . '</a>' ); 807 807 } 808 808 } … … 815 815 return false; 816 816 817 $current_tab = $bp ['current_action'];817 $current_tab = $bp->current_action 818 818 ?> 819 819 <ul class="content-header-nav"> 820 <li<?php if ( $current_tab == 'my-blogs' || $current_tab == '' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp ['current_domain'] . $bp['blogs']['slug'] ?>/my-blogs"><?php printf( __( "%s's Blogs", 'buddypress' ), $bp['current_fullname']) ?></a></li>821 <li<?php if ( $current_tab == 'recent-posts' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp ['current_domain'] . $bp['blogs']['slug'] ?>/recent-posts"><?php printf( __( "%s's Recent Posts", 'buddypress' ), $bp['current_fullname']) ?></a></li>822 <li<?php if ( $current_tab == 'recent-comments' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp ['current_domain'] . $bp['blogs']['slug'] ?>/recent-comments"><?php printf( __( "%s's Recent Comments", 'buddypress' ), $bp['current_fullname']) ?></a></li>820 <li<?php if ( $current_tab == 'my-blogs' || $current_tab == '' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->blogs->slug ?>/my-blogs"><?php printf( __( "%s's Blogs", 'buddypress' ), $bp->displayed_user->fullname ) ?></a></li> 821 <li<?php if ( $current_tab == 'recent-posts' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->blogs->slug ?>/recent-posts"><?php printf( __( "%s's Recent Posts", 'buddypress' ), $bp->displayed_user->fullname ) ?></a></li> 822 <li<?php if ( $current_tab == 'recent-comments' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->blogs->slug ?>/recent-comments"><?php printf( __( "%s's Recent Comments", 'buddypress' ), $bp->displayed_user->fullname ) ?></a></li> 823 823 </ul> 824 824 <?php -
trunk/bp-blogs/directories/bp-blogs-directory-blogs.php
r926 r1021 3 3 global $bp, $current_blog; 4 4 5 if ( $bp ['current_component'] == $bp['blogs']['slug'] && $bp['current_action']== '' ) {5 if ( $bp->current_component == $bp->blogs->slug && $bp->current_action == '' ) { 6 6 add_action( 'bp_template_content', 'bp_blogs_directory_blogs_content' ); 7 7 add_action( 'bp_template_sidebar', 'bp_blogs_directory_blogs_sidebar' ); … … 88 88 <div id="blog-dir-count" class="pag-count"> 89 89 <?php echo sprintf( __( 'Viewing blog %d to %d (%d total active blogs)', 'buddypress' ), $from_num, $to_num, $blogs['total'] ); ?> 90 <img id="ajax-loader-blogs" src="<?php echo $bp ['core']['image_base']?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />90 <img id="ajax-loader-blogs" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" /> 91 91 </div> 92 92 … … 99 99 <li> 100 100 <div class="item-avatar"> 101 <img src="<?php echo 'http://www.gravatar.com/avatar/' . md5( $blog->blog_id . '.blogs@' . $bp ['root_domain']) . '?d=identicon&s=50'; ?>" class="avatar" alt="Blog Identicon" />101 <img src="<?php echo 'http://www.gravatar.com/avatar/' . md5( $blog->blog_id . '.blogs@' . $bp->root_domain ) . '?d=identicon&s=50'; ?>" class="avatar" alt="Blog Identicon" /> 102 102 </div> 103 103 … … 154 154 <div class="widget"> 155 155 <h2 class="widgettitle"><?php _e( 'Find Blogs', 'buddypress' ) ?></h2> 156 <form action="<?php echo site_url() . '/' . $bp ['blogs']['slug']. '/search/' ?>" method="post" id="search-blogs-form">156 <form action="<?php echo site_url() . '/' . $bp->blogs->slug . '/search/' ?>" method="post" id="search-blogs-form"> 157 157 <label><input type="text" name="blogs_search" id="blogs_search" value="<?php if ( isset( $_GET['s'] ) ) { echo $_GET['s']; } else { _e('Search anything...', 'buddypress' ); } ?>" onfocus="if (this.value == '<?php _e('Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('Search anything...', 'buddypress' ) ?>';}" /></label> 158 158 <input type="submit" id="blogs_search_submit" name="blogs_search_submit" value="Search" /> -
trunk/bp-core.php
r1017 r1021 55 55 require_once( 'bp-core/bp-core-activation.php' ); 56 56 57 /* Define the slug for member pages and the members directory (e.g. example.com/[members] ) */57 /* Define the slug for member pages and the members directory (e.g. domain.com/[members] ) */ 58 58 define( 'MEMBERS_SLUG', apply_filters( 'bp_members_slug', 'members' ) ); 59 59 … … 91 91 global $bp, $wpdb; 92 92 global $current_user, $current_component, $current_action, $current_blog; 93 global $ current_userid;93 global $displayed_user_id; 94 94 global $action_variables; 95 95 96 96 /* The domain for the root of the site where the main blog resides */ 97 $bp ['root_domain']= bp_core_get_root_domain();97 $bp->root_domain = bp_core_get_root_domain(); 98 98 99 99 /* The user ID of the user who is currently logged in. */ 100 $bp['loggedin_userid'] = $current_user->ID; 100 $bp->loggedin_user->id = $current_user->ID; 101 102 /* The domain for the user currently logged in. eg: http://domain.com/members/andy */ 103 $bp->loggedin_user->domain = bp_core_get_user_domain($current_user->ID); 101 104 102 105 /* The user id of the user currently being viewed, set in /bp-core/bp-core-catchuri.php */ 103 $bp['current_userid'] = $current_userid; 104 105 /* The domain for the user currently logged in. eg: http://example.com/members/andy */ 106 $bp['loggedin_domain'] = bp_core_get_user_domain($current_user->ID); 107 108 /* The domain for the user currently being viewed */ 109 $bp['current_domain'] = bp_core_get_user_domain($current_userid); 110 111 /* The component being used eg: http://andy.example.com/ [profile] */ 112 $bp['current_component'] = $current_component; // type: string 113 114 /* The current action for the component eg: http://andy.example.com/profile/ [edit] */ 115 $bp['current_action'] = $current_action; // type: string 116 117 /* The action variables for the current action eg: http://andy.example.com/profile/edit/ [group] / [6] */ 118 $bp['action_variables'] = $action_variables; // type: array 119 120 /* Only used where a component has a sub item, e.g. groups: http://andy.example.com/groups/ [my-group] / home - manipulated in the actual component not in catch uri code.*/ 121 $bp['current_item'] = ''; // type: string 122 123 /* The default component to use if none are set and someone visits: http://andy.example.com/ */ 124 $bp['default_component'] = 'profile'; 106 $bp->displayed_user->id = $displayed_user_id; 107 108 /* The domain for the user currently being displayed */ 109 $bp->displayed_user->domain = bp_core_get_user_domain($displayed_user_id); 110 111 /* The component being used eg: http://andy.domain.com/ [profile] */ 112 $bp->current_component = $current_component; // type: string 113 114 /* The current action for the component eg: http://andy.domain.com/profile/ [edit] */ 115 $bp->current_action = $current_action; // type: string 116 117 /* The action variables for the current action eg: http://andy.domain.com/profile/edit/ [group] / [6] */ 118 $bp->action_variables = $action_variables; // type: array 119 120 /* Only used where a component has a sub item, e.g. groups: http://andy.domain.com/groups/ [my-group] / home - manipulated in the actual component not in catch uri code.*/ 121 $bp->current_item = ''; // type: string 122 123 /* The default component to use if none are set and someone visits: http://andy.domain.com/ */ 124 $bp->default_component = 'profile'; 125 125 126 126 /* Sets up the array container for the component navigation rendered by bp_get_nav() */ 127 $bp ['bp_nav']= array();127 $bp->bp_nav = array(); 128 128 129 129 /* Sets up the array container for the user navigation rendered by bp_get_user_nav() */ 130 $bp ['bp_users_nav']= array();130 $bp->bp_users_nav = array(); 131 131 132 132 /* Sets up the array container for the component options navigation rendered by bp_get_options_nav() */ 133 $bp ['bp_options_nav']= array();133 $bp->bp_options_nav = array(); 134 134 135 135 /* Sets up container used for the title of the current component option and rendered by bp_get_options_title() */ 136 $bp ['bp_options_title']= '';136 $bp->bp_options_title = ''; 137 137 138 138 /* Sets up container used for the avatar of the current component being viewed. Rendered by bp_get_options_avatar() */ 139 $bp ['bp_options_avatar']= '';139 $bp->bp_options_avatar = ''; 140 140 141 141 /* Fetch the full name for the logged in and current user */ 142 $bp ['loggedin_fullname'] = bp_core_global_user_fullname( $bp['loggedin_userid']);143 $bp ['current_fullname'] = bp_core_global_user_fullname( $bp['current_userid']);142 $bp->loggedin_user->fullname = bp_core_global_user_fullname( $bp->loggedin_user->id ); 143 $bp->displayed_user->fullname = bp_core_global_user_fullname( $bp->displayed_user->id ); 144 144 145 145 /* Used to determine if user has admin rights on current content. If the logged in user is viewing … … 147 147 generic variable so it can be used in other components. It can also be modified, so when viewing a group 148 148 'is_item_admin' would be 1 if they are a group admin, 0 if they are not. */ 149 $bp ['is_item_admin']= bp_is_home();149 $bp->is_item_admin = bp_is_home(); 150 150 151 151 /* Used to determine if the logged in user is a moderator for the current content. */ 152 $bp['is_item_mod'] = false; 153 154 $bp['core'] = array( 155 'image_base' => site_url( MUPLUGINDIR . '/bp-core/images' ), 156 'table_name_notifications' => $wpdb->base_prefix . 'bp_notifications' 157 ); 152 $bp->is_item_mod = false; 153 154 $bp->core->image_base = site_url( MUPLUGINDIR . '/bp-core/images' ); 155 $bp->core->table_name_notifications = $wpdb->base_prefix . 'bp_notifications'; 158 156 159 157 /* Used to print version numbers in the footer for reference */ 160 $bp['version_numbers']['core'] = BP_CORE_VERSION; 161 162 if ( !$bp['current_component'] ) 163 $bp['current_component'] = $bp['default_component']; 158 $bp->version_numbers = new stdClass; 159 $bp->version_numbers->core = BP_CORE_VERSION; 160 161 if ( !$bp->current_component ) 162 $bp->current_component = $bp->default_component; 164 163 } 165 164 add_action( 'wp', 'bp_core_setup_globals', 1 ); … … 193 192 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 194 193 195 $sql[] = "CREATE TABLE ". $bp['core']['table_name_notifications'] ."(194 $sql[] = "CREATE TABLE $bp->core->table_name_notifications ( 196 195 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 197 196 user_id int(11) NOT NULL, 198 197 item_id int(11) NOT NULL, 199 secondary_item_id int(11) NOT NULL,198 secondary_item_id int(11), 200 199 component_name varchar(75) NOT NULL, 201 200 component_action varchar(75) NOT NULL, … … 218 217 // dbDelta won't change character sets, so we need to do this seperately. 219 218 // This will only be in here pre v1.0 220 $wpdb->query( $wpdb->prepare( "ALTER TABLE " . $bp['core']['table_name_notifications'] . "DEFAULT CHARACTER SET %s", $wpdb->charset ) );219 $wpdb->query( $wpdb->prepare( "ALTER TABLE $bp->core->table_name_notifications DEFAULT CHARACTER SET %s", $wpdb->charset ) ); 221 220 222 221 update_site_option( 'bp-core-db-version', BP_CORE_DB_VERSION ); … … 241 240 if ( is_site_admin() ) { 242 241 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 243 if ( ( $wpdb->get_var(" SHOW TABLES LIKE '%" . $bp['core']['table_name_notifications'] . "%'") == false ) || ( get_site_option('bp-core-db-version') < BP_CORE_DB_VERSION ) )242 if ( ( $wpdb->get_var("show tables like '%{$bp->core->table_name_notifications}%'") == false ) || ( get_site_option('bp-core-db-version') < BP_CORE_DB_VERSION ) ) 244 243 bp_core_install(); 245 244 } … … 263 262 if ( is_site_admin() ) { 264 263 /* Add the administration tab under the "Site Admin" tab for site administrators */ 265 add_submenu_page( 'wpmu-admin.php', __( 'BuddyPress', 'buddypress'), __('BuddyPress', 'buddypress'), 1, 'bp_core_admin_settings', 'bp_core_admin_settings');264 add_submenu_page( 'wpmu-admin.php', __("BuddyPress", 'buddypress'), __("BuddyPress", 'buddypress'), 1, "bp_core_admin_settings", "bp_core_admin_settings" ); 266 265 } 267 266 } … … 272 271 * 273 272 * Checks to see if a component's URL should be in the root, not under a member page: 274 * eg: http:// example.com/groups/the-group NOT http://example.com/members/andy/groups/the-group273 * eg: http://domain.com/groups/the-group NOT http://domain.com/members/andy/groups/the-group 275 274 * 276 275 * @package BuddyPress Core … … 280 279 global $bp; 281 280 282 return in_array( $component_name, $bp ['root_components']);281 return in_array( $component_name, $bp->root_components ); 283 282 } 284 283 … … 304 303 bp_core_add_nav_default( 'profile', 'bp_core_catch_profile_uri', 'public' ); 305 304 306 $profile_link = $bp ['loggedin_domain']. '/profile/';305 $profile_link = $bp->loggedin_user->domain . '/profile/'; 307 306 308 307 /* Add the subnav items to the profile */ 309 308 bp_core_add_subnav_item( 'profile', 'public', __('Public', 'buddypress'), $profile_link, 'xprofile_screen_display_profile' ); 310 309 311 if ( $bp ['current_component']== 'profile' ) {310 if ( $bp->current_component == 'profile' ) { 312 311 if ( bp_is_home() ) { 313 $bp ['bp_options_title']= __('My Profile', 'buddypress');312 $bp->bp_options_title = __('My Profile', 'buddypress'); 314 313 } else { 315 $bp ['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 );316 $bp ['bp_options_title'] = $bp['current_fullname'];314 $bp->bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 ); 315 $bp->bp_options_title = $bp->displayed_user->fullname; 317 316 } 318 317 } … … 326 325 * 327 326 * Returns the domain for the passed user: 328 * e.g. http:// example.com/members/andy/327 * e.g. http://domain.com/members/andy/ 329 328 * 330 329 * @package BuddyPress Core … … 338 337 if ( !$user_id ) return; 339 338 340 $ud = get_userdata( $user_id);341 342 return $bp ['root_domain']. '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/';339 $ud = get_userdata($user_id); 340 341 return $bp->root_domain . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/'; 343 342 } 344 343 … … 347 346 * 348 347 * Returns the domain for the root blog. 349 * eg: http:// example.com/ OR https://example.com348 * eg: http://domain.com/ OR https://domain.com 350 349 * 351 350 * @package BuddyPress Core … … 364 363 365 364 /** 366 * bp_core_get_ current_userid()367 * 368 * Returns the user id for the user that is currently being viewed.369 * eg: http://andy. example.com/ or http://example.com/andy/365 * bp_core_get_displayed_userid() 366 * 367 * Returns the user id for the user that is currently being displayed. 368 * eg: http://andy.domain.com/ or http://domain.com/andy/ 370 369 * 371 370 * @package BuddyPress Core 372 371 * @global $current_blog WordPress global containing information and settings for the current blog being viewed. 373 372 * @uses bp_core_get_userid_from_user_login() Returns the user id for the username passed 374 * @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.375 */ 376 function bp_core_get_ current_userid( $user_login ) {373 * @return The user id for the user that is currently being displayed, return zero if this is not a user home and just a normal blog. 374 */ 375 function bp_core_get_displayed_userid( $user_login ) { 377 376 return bp_core_get_userid_from_user_login( $user_login ); 378 377 } … … 395 394 global $bp; 396 395 397 $nav_key = count($bp ['bp_nav']) + 1;398 $user_nav_key = count($bp ['bp_users_nav']) + 1;396 $nav_key = count($bp->bp_nav) + 1; 397 $user_nav_key = count($bp->bp_users_nav) + 1; 399 398 400 399 if ( !$css_id ) 401 400 $css_id = $slug; 402 401 403 $bp ['bp_nav'][$nav_key] = array(402 $bp->bp_nav[$nav_key] = array( 404 403 'name' => $name, 405 'link' => $bp ['loggedin_domain']. $slug,404 'link' => $bp->loggedin_user->domain . $slug, 406 405 'css_id' => $css_id 407 406 ); 408 407 409 408 if ( $add_to_usernav ) { 410 $bp ['bp_users_nav'][$user_nav_key] = array(409 $bp->bp_users_nav[$user_nav_key] = array( 411 410 'name' => $name, 412 'link' => $bp ['current_domain']. $slug,411 'link' => $bp->displayed_user->domain . $slug, 413 412 'css_id' => $css_id 414 413 ); … … 441 440 $css_id = $slug; 442 441 443 $bp ['bp_options_nav'][$parent_id][$slug] = array(442 $bp->bp_options_nav[$parent_id][$slug] = array( 444 443 'name' => $name, 445 444 'link' => $link . $slug, … … 447 446 ); 448 447 449 if ( function_exists($function) && $user_has_access && $bp ['current_action'] == $slug && $bp['current_component']== $parent_id )448 if ( function_exists($function) && $user_has_access && $bp->current_action == $slug && $bp->current_component == $parent_id ) 450 449 add_action( 'wp', $function, 3 ); 451 450 } … … 464 463 global $bp; 465 464 466 unset($bp ['bp_options_nav'][$parent_id]);465 unset($bp->bp_options_nav[$parent_id]); 467 466 } 468 467 … … 489 488 return false; 490 489 491 if ( $bp ['current_component'] == $parent_id && !$bp['current_action']) {490 if ( $bp->current_component == $parent_id && !$bp->current_action ) { 492 491 if ( function_exists($function) ) { 493 492 add_action( 'wp', $function, 3 ); … … 495 494 496 495 if ( $slug ) 497 $bp ['current_action']= $slug;496 $bp->current_action = $slug; 498 497 } 499 498 } … … 522 521 * bp_core_add_root_component() 523 522 * 524 * Adds a component to the $bp ['root_components']global.523 * Adds a component to the $bp->root_components global. 525 524 * Any component that runs in the "root" of an install should be added. 526 525 * The "root" as in, it can or always runs outside of the /members/username/ path. 527 526 * 528 527 * Example of a root component: 529 * Groups: http:// example.com/groups/group-name530 * http://community. example.com/groups/group-name531 * http:// example.com/wpmu/groups/group-name528 * Groups: http://domain.com/groups/group-name 529 * http://community.domain.com/groups/group-name 530 * http://domain.com/wpmu/groups/group-name 532 531 * 533 532 * Example of a component that is NOT a root component: 534 * Friends: http:// example.com/members/andy/friends535 * http://community. example.com/members/andy/friends536 * http:// example.com/wpmu/members/andy/friends533 * Friends: http://domain.com/members/andy/friends 534 * http://community.domain.com/members/andy/friends 535 * http://domain.com/wpmu/members/andy/friends 537 536 * 538 537 * @package BuddyPress Core … … 543 542 global $bp; 544 543 545 $bp ['root_components'][] = $slug;544 $bp->root_components[] = $slug; 546 545 } 547 546 … … 560 559 global $bp, $wpdb; 561 560 562 if ( $bp ['current_component']== MEMBERS_SLUG && isset( $_GET['random'] ) ) {561 if ( $bp->current_component == MEMBERS_SLUG && isset( $_GET['random'] ) ) { 563 562 $user = BP_Core_User::get_random_users(1); 564 563 565 564 $ud = get_userdata( $user['users'][0]->user_id ); 566 bp_core_redirect( $bp ['root_domain']. '/' . MEMBERS_SLUG . '/' . $ud->user_login );565 bp_core_redirect( $bp->root_domain . '/' . MEMBERS_SLUG . '/' . $ud->user_login ); 567 566 } 568 567 } … … 647 646 $ud = get_userdata($uid); 648 647 649 return $bp ['root_domain']. '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/';648 return $bp->root_domain . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/'; 650 649 } 651 650 … … 670 669 * 671 670 * Returns a HTML formatted link for a user with the user's full name as the link text. 672 * eg: <a href="http://andy. example.com/">Andy Peatling</a>671 * eg: <a href="http://andy.domain.com/">Andy Peatling</a> 673 672 * Optional parameters will return just the name, or just the URL, or disable "You" text when 674 673 * user matches the logged in user. … … 980 979 global $bp; 981 980 982 if ( !is_user_logged_in() || !get_usermeta( $bp['loggedin_userid'], 'last_activity'))981 if ( !is_user_logged_in() ) 983 982 return false; 984 983 985 if ( time() >= strtotime( '+5 minutes', get_usermeta( $bp['loggedin_userid'], 'last_activity') ) || get_usermeta( $bp['loggedin_userid'], 'last_activity') == '') {984 if ( time() >= strtotime( '+5 minutes', get_usermeta( $bp->loggedin_user->id, 'last_activity' ) ) || '' == get_usermeta( $bp->loggedin_user->id, 'last_activity' ) ) { 986 985 // Updated last site activity for this user. 987 update_usermeta( $bp ['loggedin_userid'], 'last_activity', time() );986 update_usermeta( $bp->loggedin_user->id, 'last_activity', time() ); 988 987 } 989 988 } … … 1003 1002 */ 1004 1003 function bp_core_get_last_activity( $last_activity_date, $string ) { 1005 if ( !$last_activity_date || $last_activity_date == '') {1004 if ( !$last_activity_date || empty( $last_activity_date ) ) { 1006 1005 $last_active = __('not recently active', 'buddypress'); 1007 1006 } else { … … 1032 1031 1033 1032 if ( !$user_id ) 1034 $user_id = $bp ['current_userid'];1033 $user_id = $bp->displayed_user->id; 1035 1034 1036 1035 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 ) ); … … 1103 1102 foreach ( (array)$nav_array as $key => $value ) { 1104 1103 switch ( $nav_array[$key]['css_id'] ) { 1105 case $bp ['activity']['slug']:1104 case $bp->activity->slug: 1106 1105 $new_nav[0] = $nav_array[$key]; 1107 1106 unset($nav_array[$key]); 1108 1107 break; 1109 case $bp ['profile']['slug']:1108 case $bp->profile->slug: 1110 1109 $new_nav[1] = $nav_array[$key]; 1111 1110 unset($nav_array[$key]); … … 1115 1114 unset($nav_array[$key]); 1116 1115 break; 1117 case $bp ['blogs']['slug']:1116 case $bp->blogs->slug: 1118 1117 $new_nav[2] = $nav_array[$key]; 1119 1118 unset($nav_array[$key]); 1120 1119 break; 1121 case $bp ['wire']['slug']:1120 case $bp->wire->slug: 1122 1121 $new_nav[3] = $nav_array[$key]; 1123 1122 unset($nav_array[$key]); 1124 1123 break; 1125 case $bp ['messages']['slug']:1124 case $bp->messages->slug: 1126 1125 $new_nav[4] = $nav_array[$key]; 1127 1126 unset($nav_array[$key]); 1128 1127 break; 1129 case $bp ['friends']['slug']:1128 case $bp->friends->slug: 1130 1129 $new_nav[5] = $nav_array[$key]; 1131 1130 unset($nav_array[$key]); 1132 1131 break; 1133 case $bp ['groups']['slug']:1132 case $bp->groups->slug: 1134 1133 $new_nav[6] = $nav_array[$key]; 1135 1134 unset($nav_array[$key]); 1136 1135 break; 1137 case $bp ['photos']['slug']:1136 case $bp->photos->slug: 1138 1137 $new_nav[7] = $nav_array[$key]; 1139 1138 unset($nav_array[$key]); 1140 1139 break; 1141 case $bp ['account']['slug']:1140 case $bp->account->slug: 1142 1141 $new_nav[8] = $nav_array[$key]; 1143 1142 unset($nav_array[$key]); … … 1197 1196 1198 1197 $current = maybe_unserialize( get_site_option( 'illegal_names' ) ); 1199 $bp_illegal_names = $bp ['root_components'];1198 $bp_illegal_names = $bp->root_components; 1200 1199 1201 1200 if ( is_array( $current ) ) { … … 1252 1251 require_once( ABSPATH . '/wp-admin/includes/user.php' ); 1253 1252 1254 return wpmu_delete_user( $bp ['loggedin_userid']);1253 return wpmu_delete_user( $bp->loggedin_user->id ); 1255 1254 } 1256 1255 … … 1258 1257 global $bp; 1259 1258 1260 if ( $bp ['current_component']== SEARCH_SLUG ) {1259 if ( $bp->current_component == SEARCH_SLUG ) { 1261 1260 $search_terms = $_POST['search-terms']; 1262 1261 $search_which = $_POST['search-which']; … … 1303 1302 global $bp; 1304 1303 1305 foreach ( $bp ['version_numbers']as $name => $version ) {1304 foreach ( $bp->version_numbers as $name => $version ) { 1306 1305 echo ucwords($name) . ': <b>' . $version . '</b> / '; 1307 1306 } -
trunk/bp-core/bp-core-admin.php
r940 r1021 15 15 if ( function_exists( 'xprofile_install' ) ) { 16 16 if ( $key == 'bp-xprofile-base-group-name' ) { 17 $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['profile']['table_name_groups'] . "SET name = %s WHERE name = %s AND id = 1", $value, stripslashes( get_site_option('bp-xprofile-base-group-name') ) ) );17 $wpdb->query( $wpdb->prepare( "UPDATE $bp->profile->table_name_groups SET name = %s WHERE name = %s AND id = 1", $value, stripslashes( get_site_option('bp-xprofile-base-group-name') ) ) ); 18 18 } 19 19 20 20 if ( $key == 'bp-xprofile-fullname-field-name' ) { 21 $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['profile']['table_name_fields'] . "SET name = %s WHERE name = %s AND group_id = 1", $value, stripslashes( get_site_option('bp-xprofile-fullname-field-name') ) ) );21 $wpdb->query( $wpdb->prepare( "UPDATE $bp->profile->table_name_fields SET name = %s WHERE name = %s AND group_id = 1", $value, stripslashes( get_site_option('bp-xprofile-fullname-field-name') ) ) ); 22 22 } 23 23 } -
trunk/bp-core/bp-core-adminbar.php
r969 r1021 27 27 global $bp; 28 28 29 echo '<a href="' . $bp ['root_domain']. '"><img id="admin-bar-logo" src="' . apply_filters( 'bp_admin_bar_logo_src', site_url( MUPLUGINDIR . '/bp-core/images/admin_bar_logo.gif' ) ) . '" alt="' . apply_filters( 'bp_admin_bar_logo_alt_text', __( 'BuddyPress', 'buddypress' ) ) . '" /></a>';29 echo '<a href="' . $bp->root_domain . '"><img id="admin-bar-logo" src="' . apply_filters( 'bp_admin_bar_logo_src', site_url( MUPLUGINDIR . '/bp-core/images/admin_bar_logo.gif' ) ) . '" alt="' . apply_filters( 'bp_admin_bar_logo_alt_text', __( 'BuddyPress', 'buddypress' ) ) . '" /></a>'; 30 30 } 31 31 … … 49 49 50 50 /* Sort the nav by key as the array has been put together in different locations */ 51 $bp ['bp_nav'] = bp_core_sort_nav_items( $bp['bp_nav']);51 $bp->bp_nav = bp_core_sort_nav_items( $bp->bp_nav ); 52 52 53 53 if ( is_user_logged_in() ) { … … 60 60 /* Loop through each navigation item */ 61 61 $counter = 0; 62 foreach( $bp ['bp_nav']as $nav_item ) {62 foreach( $bp->bp_nav as $nav_item ) { 63 63 $alt = ( $counter % 2 == 0 ) ? ' class="alt"' : ''; 64 64 … … 66 66 echo '<a id="bp-admin-' . $nav_item['css_id'] . '" href="' . $nav_item['link'] . '">' . $nav_item['name'] . '</a>'; 67 67 68 if ( is_array( $bp ['bp_options_nav'][$nav_item['css_id']] ) ) {68 if ( is_array( $bp->bp_options_nav[$nav_item['css_id']] ) ) { 69 69 echo '<ul>'; 70 70 $sub_counter = 0; 71 foreach( $bp ['bp_options_nav'][$nav_item['css_id']] as $subnav_item ) {71 foreach( $bp->bp_options_nav[$nav_item['css_id']] as $subnav_item ) { 72 72 $alt = ( $sub_counter % 2 == 0 ) ? ' class="alt"' : ''; 73 73 echo '<li' . $alt . '><a id="bp-admin-' . $subnav_item['css_id'] . '" href="' . $subnav_item['link'] . '">' . $subnav_item['name'] . '</a></li>'; … … 126 126 127 127 if ( function_exists('bp_blogs_install') ) { 128 $blogs = get_blogs_of_user( $bp ['loggedin_userid']); // find *all* blogs with any kind of role129 130 echo '<li><a href="' . $bp ['loggedin_domain'] . $bp['blogs']['slug']. '/my-blogs">';128 $blogs = get_blogs_of_user( $bp->loggedin_user->id ); // find *all* blogs with any kind of role 129 130 echo '<li><a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/my-blogs">'; 131 131 132 132 _e( 'My Blogs', 'buddypress' ); … … 139 139 $counter = 0; 140 140 foreach( $blogs as $blog ) { 141 $role = get_blog_role_for_user( $bp ['loggedin_userid'], $blog->userblog_id );141 $role = get_blog_role_for_user( $bp->loggedin_user->id, $blog->userblog_id ); 142 142 143 143 $alt = ( $counter % 2 == 0 ) ? ' class="alt"' : ''; … … 163 163 164 164 echo '<li' . $alt . '>'; 165 echo '<a href="' . $bp ['loggedin_domain'] . $bp['blogs']['slug']. '/create-a-blog">' . __('Create a Blog!', 'buddypress') . '</a>';165 echo '<a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/create-a-blog">' . __('Create a Blog!', 'buddypress') . '</a>'; 166 166 echo '</li>'; 167 167 … … 177 177 global $bp; 178 178 179 echo '<li id="bp-admin-notifications_menu"><a href="' . $bp ['loggedin_domain']. '">';179 echo '<li id="bp-admin-notifications_menu"><a href="' . $bp->loggedin_user->domain . '">'; 180 180 _e( 'Notifications', 'buddypress' ); 181 181 182 if ( $notifications = bp_core_get_notifications_for_user( $bp ['loggedin_userid']) ) { ?>182 if ( $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?> 183 183 <span><?php echo count($notifications) ?></span> 184 184 <?php … … 196 196 <?php } ?> 197 197 <?php } else { ?> 198 <li><a href="<?php echo $bp ['loggedin_domain']?>"><?php _e( 'No new notifications.', 'buddypress' ); ?></a></li>198 <li><a href="<?php echo $bp->loggedin_user->domain ?>"><?php _e( 'No new notifications.', 'buddypress' ); ?></a></li> 199 199 <?php 200 200 } … … 243 243 <a href="#"><?php _e( 'Visit', 'buddypress' ) ?></a> 244 244 <ul class="random-list"> 245 <li><a href="<?php echo $bp ['root_domain']. '/' . MEMBERS_SLUG . '/?random' ?>"><?php _e( 'Random Member', 'buddypress' ) ?></a></li>245 <li><a href="<?php echo $bp->root_domain . '/' . MEMBERS_SLUG . '/?random' ?>"><?php _e( 'Random Member', 'buddypress' ) ?></a></li> 246 246 247 247 <?php if ( function_exists('groups_install') ) : ?> 248 <li class="alt"><a href="<?php echo $bp ['root_domain'] . '/' . $bp['groups']['slug']. '/?random' ?>"><?php _e( 'Random Group', 'buddypress' ) ?></a></li>248 <li class="alt"><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug . '/?random' ?>"><?php _e( 'Random Group', 'buddypress' ) ?></a></li> 249 249 <?php endif; ?> 250 250 251 251 <?php if ( function_exists('bp_blogs_install') ) : ?> 252 <li><a href="<?php echo $bp ['root_domain'] . '/' . $bp['blogs']['slug']. '/?random-blog' ?>"><?php _e( 'Random Blog', 'buddypress' ) ?></a></li>252 <li><a href="<?php echo $bp->root_domain . '/' . $bp->blogs->slug . '/?random-blog' ?>"><?php _e( 'Random Blog', 'buddypress' ) ?></a></li> 253 253 254 254 <?php endif; ?> -
trunk/bp-core/bp-core-ajax.php
r692 r1021 92 92 <div id="member-dir-count" class="pag-count"> 93 93 <?php echo sprintf( __( 'Viewing member %d to %d (%d total active members)', 'buddypress' ), $from_num, $to_num, $users['total'] ); ?> 94 <img id="ajax-loader-members" src="<?php echo $bp ['core']['image_base']?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />94 <img id="ajax-loader-members" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" /> 95 95 </div> 96 96 -
trunk/bp-core/bp-core-avatars.php
r1011 r1021 35 35 36 36 $avatar_file = get_usermeta( $user, "bp_core_avatar_v$version" ); 37 $url = $bp ['root_domain']. '/' . $avatar_file;37 $url = $bp->root_domain . '/' . $avatar_file; 38 38 39 39 if ( strlen($avatar_file) ) { … … 46 46 $grav_option = get_site_option('user-avatar-default'); 47 47 48 if ( $grav_option == '') {48 if ( empty( $grav_option ) ) { 49 49 $default_grav = 'wavatar'; 50 50 } else if ( $grav_option == 'mystery' ) { … … 226 226 227 227 if ( !$user_id ) 228 $user_id = $bp ['loggedin_userid'];228 $user_id = $bp->loggedin_user->id; 229 229 230 230 $path = get_blog_option( 1, 'upload_path' ); … … 271 271 272 272 if ( !$user_id ) 273 $user_id = $bp ['loggedin_userid'];273 $user_id = $bp->loggedin_user->id; 274 274 275 275 $src = str_replace( array(ABSPATH), array(site_url() . '/'), $new ); … … 477 477 global $bp; 478 478 echo '<p><strong>' . $msg . '</strong></p>'; 479 echo '<p><a href="' . $bp ['loggedin_domain'] . $bp['profile']['slug']. '/change-avatar">' . __('Try Again', 'buddypress') . '</a></p>';479 echo '<p><a href="' . $bp->loggedin_user->domain . $bp->profile->slug . '/change-avatar">' . __('Try Again', 'buddypress') . '</a></p>'; 480 480 echo '</div>'; 481 481 exit; -
trunk/bp-core/bp-core-catchuri.php
r1017 r1021 15 15 * 16 16 * The URI's are broken down as follows: 17 * - http:// example.com / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...18 * - OUTSIDE ROOT: http:// example.com / sites / buddypress / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...17 * - http:// domain.com / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ... 18 * - OUTSIDE ROOT: http:// domain.com / sites / buddypress / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ... 19 19 * 20 20 * Example: 21 * - http:// example.com/members/andy/profile/edit/group/5/21 * - http://domain.com/members/andy/profile/edit/group/5/ 22 22 * - $current_component: string 'profile' 23 23 * - $current_action: string 'edit' … … 28 28 function bp_core_set_uri_globals() { 29 29 global $current_component, $current_action, $action_variables; 30 global $ current_userid;30 global $displayed_user_id; 31 31 global $is_member_page, $is_new_friend; 32 32 global $bp_unfiltered_uri; … … 85 85 86 86 /* Catch a member page and set the current member ID */ 87 if ( $bp_uri[0] == MEMBERS_SLUG && $bp_uri[1] != '') {87 if ( $bp_uri[0] == MEMBERS_SLUG && !empty( $bp_uri[1] ) ) { 88 88 $is_member_page = true; 89 89 $is_root_component = true; 90 90 91 91 // We are within a member page, set up user id globals 92 $ current_userid = bp_core_get_current_userid( $bp_uri[1] );92 $displayed_user_id = bp_core_get_displayed_userid( $bp_uri[1] ); 93 93 94 94 unset($bp_uri[0]); … … 105 105 $bp_uri = array_merge( array(), $bp_uri ); 106 106 } 107 107 108 108 /* This is used to determine where the component and action indexes should start */ 109 $root_components = $bp ['root_components'];109 $root_components = $bp->root_components; 110 110 111 111 if ( !isset($is_root_component) ) … … 160 160 161 161 $bp_path = $pages; 162 162 163 163 if ( !bp_is_blog_page() ) 164 164 remove_action( 'template_redirect', 'redirect_canonical' ); … … 227 227 228 228 // If this user does not exist, redirect to the root domain. 229 if ( !$bp ['current_userid']&& $bp_unfiltered_uri[0] == MEMBERS_SLUG && isset($bp_unfiltered_uri[1]) )230 bp_core_redirect( $bp ['root_domain']);229 if ( !$bp->displayed_user->id && $bp_unfiltered_uri[0] == MEMBERS_SLUG && isset($bp_unfiltered_uri[1]) ) 230 bp_core_redirect( $bp->root_domain ); 231 231 232 232 if ( !$bp_path && !bp_is_blog_page() ) { 233 233 if ( is_user_logged_in() ) { 234 wp_redirect( $bp ['loggedin_domain']);234 wp_redirect( $bp->loggedin_user->domain ); 235 235 } else { 236 236 wp_redirect( site_url( 'wp-login.php?redirect_to=' . site_url() . $_SERVER['REQUEST_URI'] ) ); … … 264 264 $member_theme = get_site_option('active-member-theme'); 265 265 266 if ( $member_theme == '')266 if ( empty( $member_theme ) ) 267 267 $member_theme = 'buddypress-member'; 268 268 … … 283 283 $member_theme = get_site_option('active-member-theme'); 284 284 285 if ( $member_theme == '')285 if ( empty( $member_theme ) ) 286 286 $member_theme = 'buddypress-member'; 287 287 … … 297 297 add_filter( 'stylesheet', 'bp_core_force_buddypress_stylesheet', 1, 1 ); 298 298 299 300 301 299 ?> -
trunk/bp-core/bp-core-classes.php
r973 r1021 91 91 $this->total_friends .= ' ' . __( 'friends', 'buddypress' ); 92 92 93 $this->total_friends = '<a href="' . $this->user_url . $bp ['friends']['slug']. '" title="' . sprintf( __( "%s's friend list", 'buddypress' ), $this->fullname ) . '">' . $this->total_friends . '</a>';93 $this->total_friends = '<a href="' . $this->user_url . $bp->friends->slug . '" title="' . sprintf( __( "%s's friend list", 'buddypress' ), $this->fullname ) . '">' . $this->total_friends . '</a>'; 94 94 } 95 95 } … … 102 102 $this->total_blogs .= ' ' . __( 'blogs', 'buddypress' ); 103 103 104 $this->total_blogs = '<a href="' . $this->user_url . $bp ['blogs']['slug']. '" title="' . sprintf( __( "%s's blog list", 'buddypress' ), $this->fullname ) . '">' . $this->total_blogs . '</a>';104 $this->total_blogs = '<a href="' . $this->user_url . $bp->blogs->slug . '" title="' . sprintf( __( "%s's blog list", 'buddypress' ), $this->fullname ) . '">' . $this->total_blogs . '</a>'; 105 105 } 106 106 } … … 115 115 $this->total_groups .= ' ' . __( 'groups', 'buddypress' ); 116 116 117 $this->total_groups = '<a href="' . $this->user_url . $bp ['groups']['slug']. '" title="' . sprintf( __( "%s's group list", 'buddypress' ), $this->fullname ) . '">' . $this->total_groups . '</a>';117 $this->total_groups = '<a href="' . $this->user_url . $bp->groups->slug . '" title="' . sprintf( __( "%s's group list", 'buddypress' ), $this->fullname ) . '">' . $this->total_groups . '</a>'; 118 118 } 119 119 } … … 167 167 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 168 168 169 $total_users = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(um.user_id) FROM {$wpdb->base_prefix}usermeta um LEFT JOIN {$wpdb->base_prefix}users u ON u.ID = um.user_id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND u.ID != %d ORDER BY RAND() DESC", $bp ['loggedin_userid']) );170 $paged_users = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT um.user_id FROM {$wpdb->base_prefix}usermeta um LEFT JOIN {$wpdb->base_prefix}users u ON u.ID = um.user_id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND u.ID != %d ORDER BY RAND(){$pag_sql}", $bp ['loggedin_userid']) );169 $total_users = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(um.user_id) FROM {$wpdb->base_prefix}usermeta um LEFT JOIN {$wpdb->base_prefix}users u ON u.ID = um.user_id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND u.ID != %d ORDER BY RAND() DESC", $bp->loggedin_user->id ) ); 170 $paged_users = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT um.user_id FROM {$wpdb->base_prefix}usermeta um LEFT JOIN {$wpdb->base_prefix}users u ON u.ID = um.user_id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND u.ID != %d ORDER BY RAND(){$pag_sql}", $bp->loggedin_user->id ) ); 171 171 172 172 return array( 'users' => $paged_users, 'total' => $total_users ); … … 181 181 $total_users = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(um.user_id) FROM {$wpdb->base_prefix}usermeta um LEFT JOIN {$wpdb->base_prefix}users u ON u.ID = um.user_id WHERE um.meta_key = 'last_activity' AND u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND DATE_ADD( FROM_UNIXTIME(um.meta_value), INTERVAL 5 MINUTE ) >= NOW() ORDER BY FROM_UNIXTIME(um.meta_value) DESC" ) ); 182 182 $paged_users = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT um.user_id FROM {$wpdb->base_prefix}usermeta um LEFT JOIN {$wpdb->base_prefix}users u ON u.ID = um.user_id WHERE um.meta_key = 'last_activity' AND u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND DATE_ADD( FROM_UNIXTIME(um.meta_value), INTERVAL 5 MINUTE ) >= NOW() ORDER BY FROM_UNIXTIME(um.meta_value) DESC{$pag_sql}" ) ); 183 183 184 184 return array( 'users' => $paged_users, 'total' => $total_users ); 185 185 } … … 199 199 like_escape($letter); 200 200 201 $total_users = count( $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT u.ID user_id FROM {$wpdb->base_prefix}users u LEFT JOIN {$bp['profile']['table_name_data']} pd ON u.ID = pd.user_id LEFT JOIN {$bp['profile']['table_name_fields']}pf ON pd.field_id = pf.id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND pf.name = %s AND pd.value LIKE '$letter%%' ORDER BY pd.value ASC", BP_XPROFILE_FULLNAME_FIELD_NAME ) ) );202 $paged_users = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT u.ID as user_id FROM {$wpdb->base_prefix}users u LEFT JOIN {$bp['profile']['table_name_data']} pd ON u.ID = pd.user_id LEFT JOIN {$bp['profile']['table_name_fields']}pf ON pd.field_id = pf.id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND pf.name = %s AND pd.value LIKE '$letter%%' ORDER BY pd.value ASC{$pag_sql}", BP_XPROFILE_FULLNAME_FIELD_NAME ) );201 $total_users = count( $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT u.ID user_id FROM {$wpdb->base_prefix}users u LEFT JOIN $bp->profile->table_name_data pd ON u.ID = pd.user_id LEFT JOIN $bp->profile->table_name_fields pf ON pd.field_id = pf.id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND pf.name = %s AND pd.value LIKE '$letter%%' ORDER BY pd.value ASC", BP_XPROFILE_FULLNAME_FIELD_NAME ) ) ); 202 $paged_users = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT u.ID as user_id FROM {$wpdb->base_prefix}users u LEFT JOIN $bp->profile->table_name_data pd ON u.ID = pd.user_id LEFT JOIN $bp->profile->table_name_fields pf ON pd.field_id = pf.id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND pf.name = %s AND pd.value LIKE '$letter%%' ORDER BY pd.value ASC{$pag_sql}", BP_XPROFILE_FULLNAME_FIELD_NAME ) ); 203 203 204 204 return array( 'users' => $paged_users, 'total' => $total_users ); … … 216 216 like_escape($search_terms); 217 217 218 $total_users = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(u.ID) as user_id FROM {$wpdb->base_prefix}users u LEFT JOIN {$bp['profile']['table_name_data']}pd ON u.ID = pd.user_id WHERE pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC" ) );219 $paged_users = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT u.ID as user_id FROM {$wpdb->base_prefix}users u LEFT JOIN {$bp['profile']['table_name_data']}pd ON u.ID = pd.user_id WHERE pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC{$pag_sql}" ) );218 $total_users = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(u.ID) as user_id FROM {$wpdb->base_prefix}users u LEFT JOIN $bp->profile->table_name_data pd ON u.ID = pd.user_id WHERE pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC" ) ); 219 $paged_users = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT u.ID as user_id FROM {$wpdb->base_prefix}users u LEFT JOIN $bp->profile->table_name_data pd ON u.ID = pd.user_id WHERE pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC{$pag_sql}" ) ); 220 220 221 221 return array( 'users' => $paged_users, 'total' => $total_users ); … … 251 251 global $wpdb, $bp; 252 252 253 if ( $notification = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp['core']['table_name_notifications'] . "WHERE id = %d", $this->id ) ) ) {253 if ( $notification = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->core->table_name_notifications} WHERE id = %d", $this->id ) ) ) { 254 254 $this->item_id = $notification->item_id; 255 255 $this->secondary_item_id = $notification->secondary_item_id; … … 267 267 if ( $this->id ) { 268 268 // Update 269 $sql = $wpdb->prepare( "UPDATE " . $bp['core']['table_name_notifications'] . "SET item_id = %d, secondary_item_id = %d, user_id = %d, component_name = %s, component_action = %d, date_notified = FROM_UNIXTIME(%d), is_new = %d ) WHERE id = %d", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new, $this->id );269 $sql = $wpdb->prepare( "UPDATE {$bp->core->table_name_notifications} SET item_id = %d, secondary_item_id = %d, user_id = %d, component_name = %s, component_action = %d, date_notified = FROM_UNIXTIME(%d), is_new = %d ) WHERE id = %d", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new, $this->id ); 270 270 } else { 271 271 // Save 272 $sql = $wpdb->prepare( "INSERT INTO " . $bp['core']['table_name_notifications'] . "( item_id, secondary_item_id, user_id, component_name, component_action, date_notified, is_new ) VALUES ( %d, %d, %d, %s, %s, FROM_UNIXTIME(%d), %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new );272 $sql = $wpdb->prepare( "INSERT INTO {$bp->core->table_name_notifications} ( item_id, secondary_item_id, user_id, component_name, component_action, date_notified, is_new ) VALUES ( %d, %d, %d, %s, %s, FROM_UNIXTIME(%d), %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new ); 273 273 } 274 274 … … 285 285 global $wpdb, $bp; 286 286 287 return $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['core']['table_name_notifications'] . "WHERE id = %d AND user_id = %d", $notification_id, $user_id ) );287 return $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->core->table_name_notifications} WHERE id = %d AND user_id = %d", $notification_id, $user_id ) ); 288 288 } 289 289 290 290 function get_all_for_user( $user_id ) { 291 291 global $wpdb, $bp; 292 293 return $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp['core']['table_name_notifications'] . "WHERE user_id = %d AND is_new = 1", $user_id ) );292 293 return $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->core->table_name_notifications} WHERE user_id = %d AND is_new = 1", $user_id ) ); 294 294 } 295 295 … … 297 297 global $wpdb, $bp; 298 298 299 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['core']['table_name_notifications'] . "WHERE user_id = %d AND component_name = %s AND component_action = %s", $user_id, $component_name, $component_action ) );299 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE user_id = %d AND component_name = %s AND component_action = %s", $user_id, $component_name, $component_action ) ); 300 300 } 301 301 … … 306 306 $secondary_item_sql = $wpdb->prepare( " AND secondary_item_id = %d", $secondary_item_id ); 307 307 308 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['core']['table_name_notifications'] . "WHERE user_id = %d AND item_id = %d AND component_name = %s AND component_action = %s{$secondary_item_sql}", $user_id, $item_id, $component_name, $component_action ) );308 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE user_id = %d AND item_id = %d AND component_name = %s AND component_action = %s{$secondary_item_sql}", $user_id, $item_id, $component_name, $component_action ) ); 309 309 } 310 310 -
trunk/bp-core/bp-core-notifications.php
r813 r1021 25 25 26 26 function bp_core_delete_notification( $id ) { 27 if ( !bp_core_check_notification_access( $bp ['loggedin_userid'], $id ) )27 if ( !bp_core_check_notification_access( $bp->loggedin_user->id, $id ) ) 28 28 return false; 29 29 -
trunk/bp-core/bp-core-settings.php
r959 r1021 7 7 bp_core_add_nav_default( 'settings', 'bp_core_screen_general_settings', 'general', false ); 8 8 9 bp_core_add_subnav_item( 'settings', 'general', __('General', 'buddypress'), $bp ['loggedin_domain']. 'settings/', 'bp_core_screen_general_settings', false, bp_is_home() );10 bp_core_add_subnav_item( 'settings', 'notifications', __('Notifications', 'buddypress'), $bp ['loggedin_domain']. 'settings/', 'bp_core_screen_notification_settings', false, bp_is_home() );11 bp_core_add_subnav_item( 'settings', 'delete-account', __('Delete Account', 'buddypress'), $bp ['loggedin_domain']. 'settings/', 'bp_core_screen_delete_account', false, bp_is_home() );9 bp_core_add_subnav_item( 'settings', 'general', __('General', 'buddypress'), $bp->loggedin_user->domain . 'settings/', 'bp_core_screen_general_settings', false, bp_is_home() ); 10 bp_core_add_subnav_item( 'settings', 'notifications', __('Notifications', 'buddypress'), $bp->loggedin_user->domain . 'settings/', 'bp_core_screen_notification_settings', false, bp_is_home() ); 11 bp_core_add_subnav_item( 'settings', 'delete-account', __('Delete Account', 'buddypress'), $bp->loggedin_user->domain . 'settings/', 'bp_core_screen_delete_account', false, bp_is_home() ); 12 12 } 13 13 add_action( 'wp', 'bp_core_add_settings_nav', 2 ); … … 37 37 $pass_error = true; 38 38 } 39 } else if ( $_POST['pass1'] == '' && $_POST['pass2'] != '' || $_POST['pass1'] != '' && $_POST['pass2'] == '') {39 } else if ( empty( $_POST['pass1'] ) && !empty( $_POST['pass2'] ) || !empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) { 40 40 $pass_error = true; 41 41 } else { … … 72 72 <?php } ?> 73 73 74 <form action="<?php echo $bp ['loggedin_domain']. 'settings/general' ?>" method="post" id="settings-form">74 <form action="<?php echo $bp->loggedin_user->domain . 'settings/general' ?>" method="post" id="settings-form"> 75 75 <label for="email"><?php _e( 'Account Email', 'buddypress' ) ?></label> 76 76 <input type="text" name="email" id="email" value="<?php echo $current_user->user_email ?>" class="settings-input" /> … … 122 122 <?php } ?> 123 123 124 <form action="<?php echo $bp ['loggedin_domain']. 'settings/notifications' ?>" method="post" id="settings-form">124 <form action="<?php echo $bp->loggedin_user->domain . 'settings/notifications' ?>" method="post" id="settings-form"> 125 125 <h3><?php _e( 'Email Notifications', 'buddypress' ) ?></h3> 126 126 <p><?php _e( 'Send a notification by email when:', 'buddypress' ) ?></p> … … 165 165 $pass_error = true; 166 166 } 167 } else if ( $_POST['pass1'] == '' && $_POST['pass2'] != '' || $_POST['pass1'] != '' && $_POST['pass2'] == '') {167 } else if ( empty( $_POST['pass1'] ) && !empty( $_POST['pass2'] ) || !empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) { 168 168 $pass_error = true; 169 169 } else { … … 188 188 global $bp, $current_user, $bp_settings_updated, $pass_error; ?> 189 189 190 <form action="<?php echo $bp ['loggedin_domain']. 'settings/delete-account'; ?>" name="account-delete-form" id="account-delete-form" class="standard-form" method="post">190 <form action="<?php echo $bp->loggedin_user->domain . 'settings/delete-account'; ?>" name="account-delete-form" id="account-delete-form" class="standard-form" method="post"> 191 191 192 192 <div id="message" class="info"> -
trunk/bp-core/bp-core-templatetags.php
r958 r1021 4 4 * TEMPLATE TAG 5 5 * 6 * Uses the $bp ['bp_nav']global to render out the navigation within a BuddyPress install.6 * Uses the $bp->bp_nav global to render out the navigation within a BuddyPress install. 7 7 * Each component adds to this navigation array within its own [component_name]_setup_nav() function. 8 8 * … … 20 20 21 21 /* Sort the nav by key as the array has been put together in different locations */ 22 $bp ['bp_nav'] = bp_core_sort_nav_items( $bp['bp_nav']);22 $bp->bp_nav = bp_core_sort_nav_items( $bp->bp_nav ); 23 23 24 24 /* Loop through each navigation item */ 25 foreach( (array) $bp ['bp_nav']as $nav_item ) {25 foreach( (array) $bp->bp_nav as $nav_item ) { 26 26 /* If the current component matches the nav item id, then add a highlight CSS class. */ 27 if ( $bp ['current_component']== $nav_item['css_id'] ) {27 if ( $bp->current_component == $nav_item['css_id'] ) { 28 28 $selected = ' class="current"'; 29 29 } else { … … 31 31 } 32 32 33 /* If we are viewing another person (current_userid does not equal loggedin_user id)33 /* If we are viewing another person (current_userid does not equal loggedin_user->id) 34 34 then check to see if the two users are friends. if they are, add a highlight CSS class 35 35 to the friends nav item if it exists. */ 36 if ( !bp_is_home() && $bp ['current_userid']) {36 if ( !bp_is_home() && $bp->displayed_user->id ) { 37 37 if ( function_exists('friends_install') ) { 38 if ( friends_check_friendship( $bp ['loggedin_userid'], $bp['current_userid'] ) && $nav_item['css_id'] == $bp['friends']['slug']) {38 if ( friends_check_friendship( $bp->loggedin_user->id, $bp->displayed_user->id ) && $nav_item['css_id'] == $bp->friends->slug ) { 39 39 $selected = ' class="current"'; 40 40 } else { … … 60 60 * TEMPLATE TAG 61 61 * 62 * Uses the $bp ['bp_options_nav']global to render out the sub navigation for the current component.62 * Uses the $bp->bp_options_nav global to render out the sub navigation for the current component. 63 63 * Each component adds to its sub navigation array within its own [component_name]_setup_nav() function. 64 64 * … … 78 78 /* Only render this navigation when the logged in user is looking at one of their own pages. */ 79 79 if ( bp_is_home() || $is_single_group ) { 80 if ( count( $bp ['bp_options_nav'][$bp['current_component']] ) < 1 )80 if ( count( $bp->bp_options_nav[$bp->current_component] ) < 1 ) 81 81 return false; 82 82 83 83 /* Loop through each navigation item */ 84 foreach ( $bp ['bp_options_nav'][$bp['current_component']] as $slug => $values ) {84 foreach ( $bp->bp_options_nav[$bp->current_component] as $slug => $values ) { 85 85 $title = $values['name']; 86 86 $link = $values['link']; … … 88 88 89 89 /* If the current action or an action variable matches the nav item id, then add a highlight CSS class. */ 90 if ( $slug == $bp ['current_action'] || in_array( $slug, $bp['action_variables']) ) {90 if ( $slug == $bp->current_action || in_array( $slug, $bp->action_variables ) ) { 91 91 $selected = ' class="current"'; 92 92 } else { … … 98 98 } 99 99 } else { 100 if ( !$bp ['bp_users_nav'])100 if ( !$bp->bp_users_nav ) 101 101 return false; 102 102 … … 109 109 * TEMPLATE TAG 110 110 * 111 * Uses the $bp ['bp_users_nav']global to render out the user navigation when viewing another user other than111 * Uses the $bp->bp_users_nav global to render out the user navigation when viewing another user other than 112 112 * yourself. 113 113 * … … 119 119 120 120 /* Sort the nav by key as the array has been put together in different locations */ 121 $bp ['bp_users_nav'] = bp_core_sort_nav_items( $bp['bp_users_nav']);122 123 foreach ( $bp ['bp_users_nav']as $user_nav_item ) {124 if ( $bp ['current_component']== $user_nav_item['css_id'] ) {121 $bp->bp_users_nav = bp_core_sort_nav_items( $bp->bp_users_nav ); 122 123 foreach ( $bp->bp_users_nav as $user_nav_item ) { 124 if ( $bp->current_component == $user_nav_item['css_id'] ) { 125 125 $selected = ' class="current"'; 126 126 } else { … … 145 145 global $bp; 146 146 147 if ( $bp['bp_options_avatar'] == '')147 if ( empty( $bp->bp_options_avatar ) ) 148 148 return false; 149 149 … … 164 164 global $bp; 165 165 166 echo apply_filters( 'bp_get_options_avatar', $bp ['bp_options_avatar']);166 echo apply_filters( 'bp_get_options_avatar', $bp->bp_options_avatar ); 167 167 } 168 168 … … 170 170 global $bp; 171 171 172 if ( $bp['bp_options_title'] == '')173 $bp ['bp_options_title'] = __('Options', 'buddypress');174 175 echo apply_filters( 'bp_get_options_avatar', $bp ['bp_options_title']);172 if ( empty( $bp->bp_options_title ) ) 173 $bp->bp_options_title = __( 'Options', 'buddypress' ); 174 175 echo apply_filters( 'bp_get_options_avatar', $bp->bp_options_title ); 176 176 } 177 177 … … 200 200 201 201 if ( $width && $height ) 202 echo apply_filters( 'bp_loggedinuser_avatar', bp_core_get_avatar( $bp ['loggedin_userid'], 2, $width, $height ) );202 echo apply_filters( 'bp_loggedinuser_avatar', bp_core_get_avatar( $bp->loggedin_user->id, 2, $width, $height ) ); 203 203 else 204 echo apply_filters( 'bp_loggedinuser_avatar', bp_core_get_avatar( $bp ['loggedin_userid'], 2 ) );204 echo apply_filters( 'bp_loggedinuser_avatar', bp_core_get_avatar( $bp->loggedin_user->id, 2 ) ); 205 205 } 206 206 … … 209 209 210 210 if ( $width && $height ) 211 echo apply_filters( 'bp_get_options_avatar', bp_core_get_avatar( $bp ['loggedin_userid'], 1, $width, $height ) );211 echo apply_filters( 'bp_get_options_avatar', bp_core_get_avatar( $bp->loggedin_user->id, 1, $width, $height ) ); 212 212 else 213 echo apply_filters( 'bp_get_options_avatar', bp_core_get_avatar( $bp ['loggedin_userid'], 1 ) );213 echo apply_filters( 'bp_get_options_avatar', bp_core_get_avatar( $bp->loggedin_user->id, 1 ) ); 214 214 } 215 215 … … 219 219 220 220 function bp_is_home() { 221 global $bp , $current_blog, $doing_admin_bar;222 223 if ( is_user_logged_in() && $bp ['loggedin_userid'] == $bp['current_userid'])221 global $bp; 222 223 if ( is_user_logged_in() && $bp->loggedin_user->id == $bp->displayed_user->id ) 224 224 return true; 225 225 … … 231 231 232 232 if ( !$user_id ) 233 $user_id = $bp ['current_userid'];233 $user_id = $bp->displayed_user->id; 234 234 235 235 if ( function_exists('xprofile_install') ) { 236 // First check the usermeta table for a easily fetchable value 237 //$data = get_usermeta( $user_id, 'bp_display_name' ); 238 239 //if ( $data == '' ) { 240 $data = bp_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id ); 241 242 if ( empty($data) ) { 243 $ud = get_userdata($user_id); 244 $data = $ud->display_name; 245 } else { 246 $data = ucfirst($data); 247 } 248 249 // store this in usermeta for less expensive fetching. 250 // update_usermeta( $user_id, 'bp_display_name', $data ); 251 //} 236 $data = bp_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id ); 237 238 if ( empty($data) ) { 239 $ud = get_userdata($user_id); 240 $data = $ud->display_name; 241 } else { 242 $data = ucfirst($data); 243 } 252 244 } else { 253 245 $ud = get_userdata($user_id); … … 265 257 266 258 if ( !$user_id ) 267 $user_id = $bp ['current_userid'];259 $user_id = $bp->displayed_user->id; 268 260 269 261 $last_activity = bp_core_get_last_activity( get_usermeta( $user_id, 'last_activity' ), __('active %s ago', 'buddypress') ); … … 277 269 function bp_the_avatar() { 278 270 global $bp; 279 echo apply_filters( 'bp_the_avatar', bp_core_get_avatar( $bp ['current_userid'], 2 ) );271 echo apply_filters( 'bp_the_avatar', bp_core_get_avatar( $bp->displayed_user->id, 2 ) ); 280 272 } 281 273 282 274 function bp_the_avatar_thumbnail() { 283 275 global $bp; 284 echo apply_filters( 'bp_the_avatar_thumbnail', bp_core_get_avatar( $bp ['current_userid'], 1 ) );276 echo apply_filters( 'bp_the_avatar_thumbnail', bp_core_get_avatar( $bp->displayed_user->id, 1 ) ); 285 277 } 286 278 … … 288 280 global $bp; 289 281 290 echo apply_filters( 'bp_the_avatar_thumbnail', $bp ['current_domain']);282 echo apply_filters( 'bp_the_avatar_thumbnail', $bp->displayed_user->domain ); 291 283 } 292 284 … … 322 314 $youtext = ucfirst($youtext); 323 315 324 if ( $bp ['current_userid'] == $bp['loggedin_userid']) {316 if ( $bp->displayed_user->id == $bp->loggedin_user->id ) { 325 317 if ( $echo ) 326 318 echo apply_filters( 'bp_word_or_name', $youtext ); … … 328 320 return apply_filters( 'bp_word_or_name', $youtext ); 329 321 } else { 330 $nametext = sprintf( $nametext, $bp['current_fullname']);322 $nametext = sprintf( $nametext, $bp->displayed_user->fullname ); 331 323 if ( $echo ) 332 324 echo apply_filters( 'bp_word_or_name', $nametext ); … … 342 334 $yourtext = ucfirst($yourtext); 343 335 344 if ( $bp ['current_userid'] == $bp['loggedin_userid']) {336 if ( $bp->displayed_user->id == $bp->loggedin_user->id ) { 345 337 if ( $echo ) 346 338 echo apply_filters( 'bp_your_or_their', $yourtext ); … … 358 350 global $bp, $current_user; 359 351 360 if ( $link = bp_core_get_userlink( $bp ['loggedin_userid']) ) {352 if ( $link = bp_core_get_userlink( $bp->loggedin_user->id ) ) { 361 353 echo apply_filters( 'bp_loggedinuser_link', $link ); 362 354 } else { 363 $ud = get_userdata($ current_user->ID);355 $ud = get_userdata($displayed_user->id); 364 356 echo apply_filters( 'bp_loggedinuser_link', $ud->user_login ); 365 357 } … … 374 366 global $bp, $is_member_page; 375 367 376 if ( $bp ['current_component'] == NEWS_SLUG )377 return true; 378 379 if ( !$is_member_page && !in_array( $bp ['current_component'], $bp['root_components']) )380 return true; 381 368 if ( $bp->current_component == HOME_BLOG_SLUG ) 369 return true; 370 371 if ( !$is_member_page && !in_array( $bp->current_component, $bp->root_components ) ) 372 return true; 373 382 374 return false; 383 375 } … … 386 378 global $bp; 387 379 388 if ( $bp['current_fullname'] != '') {389 echo apply_filters( 'bp_page_title', strip_tags( $bp ['current_fullname'] . ' » ' . ucwords($bp['current_component']) . ' » ' . $bp['bp_options_nav'][$bp['current_component']][$bp['current_action']]['name'] ) );390 } else { 391 echo apply_filters( 'bp_page_title', strip_tags( ucwords( $bp['current_component']) . ' » ' . ucwords($bp['bp_options_title']) . ' » ' . ucwords($bp['current_action']) ) );380 if ( !empty( $bp->displayed_user->fullname ) ) { 381 echo apply_filters( 'bp_page_title', strip_tags( $bp->displayed_user->fullname . ' » ' . ucwords( $bp->current_component ) . ' » ' . $bp->bp_options_nav[$bp->current_component][$bp->current_action]['name'] ) ); 382 } else { 383 echo apply_filters( 'bp_page_title', strip_tags( ucwords( $bp->current_component ) . ' » ' . ucwords( $bp->bp_options_title ) . ' » ' . ucwords( $bp->current_action ) ) ); 392 384 } 393 385 } … … 401 393 global $bp; 402 394 403 if ( $bp ['current_userid'])395 if ( $bp->displayed_user->id ) 404 396 return false; 405 397 406 if ( $page == $bp ['current_component'] || $page == 'home' && $bp['current_component'] == $bp['default_component'])398 if ( $page == $bp->current_component || $page == 'home' && $bp->current_component == $bp->default_component ) 407 399 return true; 408 400 … … 422 414 if ( bp_has_custom_signup_page() ) { 423 415 if ( $echo ) 424 echo $bp ['root_domain']. '/' . REGISTER_SLUG;425 else 426 return $bp ['root_domain']. '/' . REGISTER_SLUG;427 } else { 428 if ( $echo ) 429 echo $bp ['root_domain']. '/wp-signup.php';430 else 431 return $bp ['root_domain']. '/wp-signup.php';416 echo $bp->root_domain . '/' . REGISTER_SLUG; 417 else 418 return $bp->root_domain . '/' . REGISTER_SLUG; 419 } else { 420 if ( $echo ) 421 echo $bp->root_domain . '/wp-signup.php'; 422 else 423 return $bp->root_domain . '/wp-signup.php'; 432 424 } 433 425 } … … 528 520 529 521 if ( function_exists('friends_install') ) { 530 if ( friends_check_friendship( $bp ['loggedin_userid'], $bp['current_userid']) )522 if ( friends_check_friendship( $bp->loggedin_user->id, $bp->displayed_user->id ) ) 531 523 return true; 532 524 else … … 540 532 global $bp; 541 533 ?> 542 <li<?php if (bp_is_page('home')) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>" title="<?php _e( 'Home', 'buddypress' ) ?>"><?php _e( 'Home', 'buddypress' ) ?></a></li>543 <li<?php if (bp_is_page(HOME_BLOG_SLUG)) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo HOME_BLOG_SLUG ?>" title="<?php _e( 'Blog', 'buddypress' ) ?>"><?php _e( 'Blog', 'buddypress' ) ?></a></li>544 <li<?php if (bp_is_page(MEMBERS_SLUG)) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo MEMBERS_SLUG ?>" title="<?php _e( 'Members', 'buddypress' ) ?>"><?php _e( 'Members', 'buddypress' ) ?></a></li>545 546 <?php if ( function_exists( 'groups_install') ) { ?>547 <li<?php if (bp_is_page($bp['groups']['slug'])) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo $bp['groups']['slug']?>" title="<?php _e( 'Groups', 'buddypress' ) ?>"><?php _e( 'Groups', 'buddypress' ) ?></a></li>534 <li<?php if ( bp_is_page( 'home' ) ) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>" title="<?php _e( 'Home', 'buddypress' ) ?>"><?php _e( 'Home', 'buddypress' ) ?></a></li> 535 <li<?php if ( bp_is_page( HOME_BLOG_SLUG ) ) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo HOME_BLOG_SLUG ?>" title="<?php _e( 'Blog', 'buddypress' ) ?>"><?php _e( 'Blog', 'buddypress' ) ?></a></li> 536 <li<?php if ( bp_is_page( MEMBERS_SLUG ) ) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo MEMBERS_SLUG ?>" title="<?php _e( 'Members', 'buddypress' ) ?>"><?php _e( 'Members', 'buddypress' ) ?></a></li> 537 538 <?php if ( function_exists( 'groups_install' ) ) { ?> 539 <li<?php if ( bp_is_page( $bp->groups->slug ) ) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo $bp->groups->slug ?>" title="<?php _e( 'Groups', 'buddypress' ) ?>"><?php _e( 'Groups', 'buddypress' ) ?></a></li> 548 540 <?php } ?> 549 541 550 <?php if ( function_exists( 'bp_blogs_install') ) { ?>551 <li<?php if (bp_is_page($bp['blogs']['slug'])) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo $bp['blogs']['slug']?>" title="<?php _e( 'Blogs', 'buddypress' ) ?>"><?php _e( 'Blogs', 'buddypress' ) ?></a></li>542 <?php if ( function_exists( 'bp_blogs_install' ) ) { ?> 543 <li<?php if ( bp_is_page( $bp->blogs->slug ) ) {?> class="selected"<?php } ?>><a href="<?php echo get_option('home') ?>/<?php echo $bp->blogs->slug ?>" title="<?php _e( 'Blogs', 'buddypress' ) ?>"><?php _e( 'Blogs', 'buddypress' ) ?></a></li> 552 544 <?php } ?> 553 545 <?php … … 568 560 function bp_current_user_id() { 569 561 global $bp; 570 return apply_filters( 'bp_current_user_id', $bp ['current_userid']);562 return apply_filters( 'bp_current_user_id', $bp->displayed_user->id ); 571 563 } 572 564 573 565 function bp_user_fullname() { 574 566 global $bp; 575 echo apply_filters( 'bp_user_fullname', $bp ['current_fullname']);567 echo apply_filters( 'bp_user_fullname', $bp->displayed_user->fullname ); 576 568 } 577 569 -
trunk/bp-core/bp-core-widgets.php
r946 r1021 94 94 <?php if ( $users['users'] ) : ?> 95 95 <div class="item-options" id="members-list-options"> 96 <img id="ajax-loader-members" src="<?php echo $bp ['core']['image_base']?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /> 96 <img id="ajax-loader-members" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /> 97 97 <a href="<?php echo site_url() . '/' . MEMBERS_SLUG ?>" id="newest-members" class="selected"><?php _e("Newest", 'buddypress') ?></a> | 98 98 <a href="<?php echo site_url() . '/' . MEMBERS_SLUG ?>" id="recently-active-members"><?php _e("Active", 'buddypress') ?></a> | -
trunk/bp-core/directories/bp-core-directory-members.php
r897 r1021 2 2 function bp_core_directory_members_setup() { 3 3 global $bp, $current_blog; 4 5 if ( $bp ['current_component'] == MEMBERS_SLUG && $bp['current_action'] == '') {4 5 if ( $bp->current_component == MEMBERS_SLUG && empty( $bp->current_action ) ) { 6 6 add_action( 'bp_template_content', 'bp_core_directory_members_content' ); 7 7 add_action( 'bp_template_sidebar', 'bp_core_directory_members_sidebar' ); … … 87 87 <div id="member-dir-count" class="pag-count"> 88 88 <?php echo sprintf( __( 'Viewing member %d to %d (%d total active members)', 'buddypress' ), $from_num, $to_num, $users['total'] ); ?> 89 <img id="ajax-loader-members" src="<?php echo $bp ['core']['image_base']?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />89 <img id="ajax-loader-members" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" /> 90 90 </div> 91 91 -
trunk/bp-forums.php
r974 r1021 19 19 global $bp, $bbpress_live; 20 20 21 if ( get_usermeta( $bp ['loggedin_userid'], 'bb_capabilities' ) == '' )22 bp_forums_make_user_active_member( $bp ['loggedin_userid']);21 if ( get_usermeta( $bp->loggedin_user->id, 'bb_capabilities' ) == '' ) 22 bp_forums_make_user_active_member( $bp->loggedin_user->id ); 23 23 24 $bp ['version_numbers']['forums']= BP_FORUMS_VERSION;24 $bp->version_numbers->forums = BP_FORUMS_VERSION; 25 25 } 26 26 add_action( 'wp', 'bp_forums_setup', 3 ); -
trunk/bp-forums/bp-forums-templatetags.php
r927 r1021 265 265 echo apply_filters( 'bp_forum_pagination_count', sprintf( __( 'Viewing topic %d to %d (%d total topics)', 'buddypress' ), $from_num, $to_num, $forum_template->total_topic_count ) ); 266 266 ?> 267 <img id="ajax-loader-groups" src="<?php echo $bp ['core']['image_base']?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />267 <img id="ajax-loader-groups" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" /> 268 268 <?php 269 269 } … … 371 371 global $is_single_group, $group_obj; 372 372 373 $topic_id = $bp ['action_variables'][1];373 $topic_id = $bp->action_variables[1]; 374 374 375 375 if ( is_numeric( $topic_id ) ) … … 440 440 echo apply_filters( 'bp_the_topic_pagination_count', sprintf( __( 'Viewing post %d to %d (%d total posts)', 'buddypress' ), $from_num, $to_num, $topic_template->total_post_count ) ); 441 441 ?> 442 <img id="ajax-loader-groups" src="<?php echo $bp ['core']['image_base']?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />442 <img id="ajax-loader-groups" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" /> 443 443 <?php 444 444 } -
trunk/bp-friends.php
r1017 r1021 29 29 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 30 30 31 $sql[] = "CREATE TABLE ". $bp['friends']['table_name'] ."(31 $sql[] = "CREATE TABLE {$bp->friends->table_name} ( 32 32 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 33 33 initiator_user_id int(11) NOT NULL, … … 57 57 global $bp, $wpdb; 58 58 59 $bp['friends'] = array( 60 'table_name' => $wpdb->base_prefix . 'bp_friends', 61 'image_base' => site_url( MUPLUGINDIR . '/bp-friends/images' ), 62 'format_activity_function' => 'friends_format_activity', 63 'slug' => BP_FRIENDS_SLUG 64 ); 65 66 $bp['version_numbers'][$bp['friends']['slug']] = BP_FRIENDS_VERSION; 59 $bp->friends->table_name = $wpdb->base_prefix . 'bp_friends'; 60 $bp->friends->image_base = site_url( MUPLUGINDIR . '/bp-friends/images' ); 61 $bp->friends->format_activity_function = 'friends_format_activity'; 62 $bp->friends->slug = BP_FRIENDS_SLUG; 63 64 $bp->version_numbers->friends = BP_FRIENDS_VERSION; 67 65 } 68 66 add_action( 'wp', 'friends_setup_globals', 1 ); … … 74 72 if ( is_site_admin() ) { 75 73 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 76 if ( ( $wpdb->get_var( "SHOW TABLES LIKE '%" . $bp['friends']['table_name'] . "%'") == false ) || ( get_site_option('bp-friends-db-version') < BP_FRIENDS_DB_VERSION ) )74 if ( ( $wpdb->get_var( "SHOW TABLES LIKE '%{$bp->friends->table_name}%'") == false ) || ( get_site_option('bp-friends-db-version') < BP_FRIENDS_DB_VERSION ) ) 77 75 friends_install(); 78 76 } … … 90 88 91 89 /* Add 'Friends' to the main navigation */ 92 bp_core_add_nav_item( __('Friends', 'buddypress'), $bp ['friends']['slug']);93 bp_core_add_nav_default( $bp ['friends']['slug'], 'friends_screen_my_friends', 'my-friends' );94 95 $friends_link = $bp ['loggedin_domain'] . $bp['friends']['slug']. '/';90 bp_core_add_nav_item( __('Friends', 'buddypress'), $bp->friends->slug ); 91 bp_core_add_nav_default( $bp->friends->slug, 'friends_screen_my_friends', 'my-friends' ); 92 93 $friends_link = $bp->loggedin_user->domain . $bp->friends->slug . '/'; 96 94 97 95 /* Add the subnav items to the friends nav item */ 98 bp_core_add_subnav_item( $bp['friends']['slug'], 'my-friends', __('My Friends', 'buddypress'), $friends_link, 'friends_screen_my_friends', 'friends-my-friends' ); 99 bp_core_add_subnav_item( $bp['friends']['slug'], 'requests', __('Requests', 'buddypress'), $friends_link, 'friends_screen_requests', false, bp_is_home() ); 100 //bp_core_add_subnav_item( $bp['friends']['slug'], 'invite-friend', __('Invite Friends', 'buddypress'), $friends_link, 'friends_screen_invite_friends' ); 101 102 if ( $bp['current_component'] == $bp['friends']['slug'] ) { 96 bp_core_add_subnav_item( $bp->friends->slug, 'my-friends', __( 'My Friends', 'buddypress' ), $friends_link, 'friends_screen_my_friends', 'friends-my-friends' ); 97 bp_core_add_subnav_item( $bp->friends->slug, 'requests', __( 'Requests', 'buddypress' ), $friends_link, 'friends_screen_requests', false, bp_is_home() ); 98 99 if ( $bp->current_component == $bp->friends->slug ) { 103 100 if ( bp_is_home() ) { 104 $bp ['bp_options_title'] = __('My Friends', 'buddypress');101 $bp->bp_options_title = __( 'My Friends', 'buddypress' ); 105 102 } else { 106 $bp ['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 );107 $bp ['bp_options_title'] = $bp['current_fullname'];103 $bp->bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 ); 104 $bp->bp_options_title = $bp->displayed_user->fullname; 108 105 } 109 106 } … … 118 115 119 116 // Delete any friendship acceptance notifications for the user when viewing a profile 120 bp_core_delete_notifications_for_user_by_type( $bp ['loggedin_userid'], 'friends', 'friendship_accepted' );117 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'friends', 'friendship_accepted' ); 121 118 122 119 do_action( 'friends_screen_my_friends' ); … … 128 125 global $bp; 129 126 130 if ( isset($bp ['action_variables']) && $bp['action_variables'][0] == 'accept' && is_numeric($bp['action_variables'][1]) ) {131 132 if ( friends_accept_friendship( $bp ['action_variables'][1] ) ) {133 bp_core_add_message( __( 'Friendship accepted', 'buddypress') );127 if ( isset($bp->action_variables) && $bp->action_variables[0] == 'accept' && is_numeric($bp->action_variables[1]) ) { 128 129 if ( friends_accept_friendship( $bp->action_variables[1] ) ) { 130 bp_core_add_message( __( 'Friendship accepted', 'buddypress' ) ); 134 131 } else { 135 bp_core_add_message( __( 'Friendship could not be accepted', 'buddypress'), 'error' );132 bp_core_add_message( __( 'Friendship could not be accepted', 'buddypress' ), 'error' ); 136 133 } 137 bp_core_redirect( $bp ['loggedin_domain'] . $bp['current_component'] . '/' . $bp['current_action']);138 139 } else if ( isset($bp ['action_variables']) && $bp['action_variables'][0] == 'reject' && is_numeric($bp['action_variables'][1]) ) {140 141 if ( friends_reject_friendship( $bp ['action_variables'][1] ) ) {142 bp_core_add_message( __( 'Friendship rejected', 'buddypress') );134 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action ); 135 136 } else if ( isset($bp->action_variables) && $bp->action_variables[0] == 'reject' && is_numeric($bp->action_variables[1]) ) { 137 138 if ( friends_reject_friendship( $bp->action_variables[1] ) ) { 139 bp_core_add_message( __( 'Friendship rejected', 'buddypress' ) ); 143 140 } else { 144 bp_core_add_message( __( 'Friendship could not be rejected', 'buddypress'), 'error' );141 bp_core_add_message( __( 'Friendship could not be rejected', 'buddypress' ), 'error' ); 145 142 } 146 bp_core_redirect( $bp ['loggedin_domain'] . $bp['current_component'] . '/' . $bp['current_action']);143 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action ); 147 144 } 148 145 … … 259 256 case 'friendship_accepted': 260 257 if ( (int)$total_items > 1 ) { 261 return apply_filters( 'bp_friends_multiple_friendship_accepted_notification', '<a href="' . $bp ['loggedin_domain'] . $bp['friends']['slug']. '/my-friends/newest" title="' . __( 'My Friends', 'buddypress' ) . '">' . sprintf( __('%d friends accepted your friendship requests'), (int)$total_items ) . '</a>', (int)$total_items );258 return apply_filters( 'bp_friends_multiple_friendship_accepted_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/my-friends/newest" title="' . __( 'My Friends', 'buddypress' ) . '">' . sprintf( __('%d friends accepted your friendship requests'), (int)$total_items ) . '</a>', (int)$total_items ); 262 259 } else { 263 260 $user_fullname = bp_core_global_user_fullname( $item_id ); … … 269 266 case 'friendship_request': 270 267 if ( (int)$total_items > 1 ) { 271 return apply_filters( 'bp_friends_multiple_friendship_request_notification', '<a href="' . $bp ['loggedin_domain'] . $bp['friends']['slug']. '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have %d pending friendship requests'), (int)$total_items ) . '</a>', $total_items );268 return apply_filters( 'bp_friends_multiple_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have %d pending friendship requests'), (int)$total_items ) . '</a>', $total_items ); 272 269 } else { 273 270 $user_fullname = bp_core_global_user_fullname( $item_id ); 274 271 $user_url = bp_core_get_userurl( $item_id ); 275 return apply_filters( 'bp_friends_single_friendship_request_notification', '<a href="' . $bp ['loggedin_domain'] . $bp['friends']['slug']. '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have a friendship request from %s'), $user_fullname ) . '</a>', $user_fullname );272 return apply_filters( 'bp_friends_single_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have a friendship request from %s'), $user_fullname ) . '</a>', $user_fullname ); 276 273 } 277 274 break; … … 286 283 $friend_count = get_usermeta( $user_id, 'total_friend_count'); 287 284 288 if ( $friend_count == '')285 if ( empty( $friend_count ) ) 289 286 return false; 290 287 … … 406 403 407 404 if ( !$user_id ) 408 $user_id = $bp ['loggedin_userid'];405 $user_id = $bp->loggedin_user->id; 409 406 410 407 $friend_ids = friends_get_alphabetically( $user_id ); … … 520 517 521 518 // Remove the activity stream items 522 friends_delete_activity( array( 'item_id' => $friendship_id, 'component_name' => 'friends', 'component_action' => 'friendship_accepted', 'user_id' => $bp ['current_userid']) );519 friends_delete_activity( array( 'item_id' => $friendship_id, 'component_name' => 'friends', 'component_action' => 'friendship_accepted', 'user_id' => $bp->displayed_user->id ) ); 523 520 524 521 do_action( 'friends_friendship_deleted', $friendship_id, $initiator_userid, $friend_userid ); -
trunk/bp-friends/bp-friends-ajax.php
r608 r1021 13 13 global $bp; 14 14 15 if ( BP_Friends_Friendship::check_is_friend( $bp ['loggedin_userid'], $_POST['fid'] ) == 'is_friend' ) {16 if ( !friends_remove_friend( $bp ['loggedin_userid'], $_POST['fid'] ) ) {15 if ( BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $_POST['fid'] ) == 'is_friend' ) { 16 if ( !friends_remove_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) { 17 17 echo __("Friendship could not be canceled.", 'buddypress'); 18 18 } else { 19 echo '<a id="friend-' . $_POST['fid'] . '" class="add" rel="add" title="' . __( 'Add Friend', 'buddypress' ) . '" href="' . $bp ['loggedin_domain'] . $bp['friends']['slug']. '/add-friend/' . $_POST['fid'] . '">' . __( 'Add Friend', 'buddypress' ) . '</a>';19 echo '<a id="friend-' . $_POST['fid'] . '" class="add" rel="add" title="' . __( 'Add Friend', 'buddypress' ) . '" href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/add-friend/' . $_POST['fid'] . '">' . __( 'Add Friend', 'buddypress' ) . '</a>'; 20 20 } 21 } else if ( BP_Friends_Friendship::check_is_friend( $bp ['loggedin_userid'], $_POST['fid'] ) == 'not_friends' ) {22 if ( !friends_add_friend( $bp ['loggedin_userid'], $_POST['fid'] ) ) {21 } else if ( BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $_POST['fid'] ) == 'not_friends' ) { 22 if ( !friends_add_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) { 23 23 echo __("Friendship could not be requested.", 'buddypress'); 24 24 } else { 25 echo '<a href="' . $bp ['loggedin_domain'] . $bp['friends']['slug']. '" class="requested">' . __( 'Friendship Requested', 'buddypres' ) . '</a>';26 //echo '<a id="friend-' . $_POST['fid'] . '" class="remove" rel="remove" title="' . __( 'Remove Friend', 'buddypress' ) . '" href="' . $bp ['loggedin_domain'] . $bp['friends']['slug']. '/remove-friend/' . $_POST['fid'] . '">' . __( 'Remove Friend', 'buddypress' ) . '</a>';25 echo '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '" class="requested">' . __( 'Friendship Requested', 'buddypres' ) . '</a>'; 26 //echo '<a id="friend-' . $_POST['fid'] . '" class="remove" rel="remove" title="' . __( 'Remove Friend', 'buddypress' ) . '" href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/remove-friend/' . $_POST['fid'] . '">' . __( 'Remove Friend', 'buddypress' ) . '</a>'; 27 27 } 28 28 } else { -
trunk/bp-friends/bp-friends-classes.php
r813 r1021 27 27 global $wpdb, $bp, $creds; 28 28 29 if ( $friendship = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp['friends']['table_name'] . "WHERE id = %d", $this->id ) ) ) {29 if ( $friendship = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->friends->table_name} WHERE id = %d", $this->id ) ) ) { 30 30 $this->initiator_user_id = $friendship->initiator_user_id; 31 31 $this->friend_user_id = $friendship->friend_user_id; … … 36 36 37 37 // if running from ajax. 38 if ( !$bp ['current_userid'])39 $bp ['current_userid']= $creds['current_userid'];38 if ( !$bp->displayed_user->id ) 39 $bp->displayed_user->id = $creds['current_userid']; 40 40 41 41 if ( $this->populate_friend_details ) { 42 if ( $this->friend_user_id == $bp ['current_userid']) {42 if ( $this->friend_user_id == $bp->displayed_user->id ) { 43 43 $this->friend = new BP_Core_User( $this->initiator_user_id ); 44 44 } else { … … 53 53 if ( $this->id ) { 54 54 // Update 55 $result = $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['friends']['table_name'] . "SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = FROM_UNIXTIME(%d) ) WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) );55 $result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = FROM_UNIXTIME(%d) ) WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) ); 56 56 } else { 57 57 // Save 58 $result = $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['friends']['table_name'] . "( initiator_user_id, friend_user_id, is_confirmed, is_limited, date_created ) VALUES ( %d, %d, %d, %d, FROM_UNIXTIME(%d) )", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created ) );58 $result = $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->friends->table_name} ( initiator_user_id, friend_user_id, is_confirmed, is_limited, date_created ) VALUES ( %d, %d, %d, %d, FROM_UNIXTIME(%d) )", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created ) ); 59 59 $this->id = $wpdb->insert_id; 60 60 } … … 66 66 global $wpdb, $bp; 67 67 68 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['friends']['table_name'] . "WHERE id = %d", $this->id ) );68 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d", $this->id ) ); 69 69 } 70 70 … … 82 82 } 83 83 84 $friends = $wpdb->get_results( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM " . $bp['friends']['table_name'] . "$friend_sql $oc_sql ORDER BY date_created DESC" ) );84 $friends = $wpdb->get_results( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} $friend_sql $oc_sql ORDER BY date_created DESC" ) ); 85 85 86 86 for ( $i = 0; $i < count($friends); $i++ ) { … … 105 105 } 106 106 107 return $wpdb->get_col( $wpdb->prepare( "SELECT id FROM " . $bp['friends']['table_name'] . "$friend_sql $oc_sql" ) );107 return $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->friends->table_name} $friend_sql $oc_sql" ) ); 108 108 } 109 109 … … 111 111 global $wpdb, $bp; 112 112 113 return $wpdb->get_var( $wpdb->prepare( "SELECT id 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 ) AND is_confirmed = 1", $user_id, $friend_id, $friend_id, $user_id ) );113 return $wpdb->get_var( $wpdb->prepare( "SELECT id 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 ) AND is_confirmed = 1", $user_id, $friend_id, $friend_id, $user_id ) ); 114 114 } 115 115 … … 120 120 This function will recalculate, update and return. */ 121 121 122 $count = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['friends']['table_name'] . "WHERE (initiator_user_id = %d OR friend_user_id = %d) AND is_confirmed = 1", $user_id, $user_id ) );122 $count = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d OR friend_user_id = %d) AND is_confirmed = 1", $user_id, $user_id ) ); 123 123 124 124 if ( !$count ) … … 133 133 134 134 if ( !$user_id ) 135 $user_id = $bp ['loggedin_userid'];135 $user_id = $bp->loggedin_user->id; 136 136 137 137 like_escape($filter); … … 149 149 // filter the user_ids based on the search criteria. 150 150 if ( function_exists('xprofile_install') ) { 151 $sql = $wpdb->prepare( "SELECT DISTINCT user_id FROM " . $bp['profile']['table_name_data'] . "WHERE user_id IN ($fids) AND value LIKE '$filter%%'" );151 $sql = $wpdb->prepare( "SELECT DISTINCT user_id FROM {$bp->profile->table_name_data} WHERE user_id IN ($fids) AND value LIKE '$filter%%'" ); 152 152 } else { 153 153 $sql = $wpdb->prepare( "SELECT DISTINCT user_id FROM $usermeta_table WHERE user_id IN ($fids) AND meta_key = 'nickname' AND meta_value LIKE '$filter%%'" ); … … 160 160 161 161 // Get the total number of friendships 162 $total_friends = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['friends']['table_name'] . "WHERE (friend_user_id IN ($filtered_fids) AND initiator_user_id = %d) OR (initiator_user_id IN ($filtered_fids) AND friend_user_id = %d)", $user_id, $user_id ) );162 $total_friends = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->friends->table_name} WHERE (friend_user_id IN ($filtered_fids) AND initiator_user_id = %d) OR (initiator_user_id IN ($filtered_fids) AND friend_user_id = %d)", $user_id, $user_id ) ); 163 163 164 164 return array( 'friends' => $filtered_friends, 'total' => $total_friends ); … … 171 171 return false; 172 172 173 $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 ) );173 $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 ) ); 174 174 175 175 if ( $result ) { … … 193 193 global $wpdb, $bp; 194 194 195 return $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['friends']['table_name'] . " SET is_confirmed = 1, date_created = FROM_UNIXTIME(%d) WHERE id = %d AND friend_user_id = %d", time(), $friendship_id, $bp['loggedin_userid']) );195 return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET is_confirmed = 1, date_created = FROM_UNIXTIME(%d) WHERE id = %d AND friend_user_id = %d", time(), $friendship_id, $bp->loggedin_user->id ) ); 196 196 } 197 197 … … 199 199 global $wpdb, $bp; 200 200 201 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['friends']['table_name'] . " WHERE id = %d AND friend_user_id = %d", $friendship_id, $bp['loggedin_userid']) );201 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d AND friend_user_id = %d", $friendship_id, $bp->loggedin_user->id ) ); 202 202 } 203 203 … … 214 214 // filter the user_ids based on the search criteria. 215 215 if ( function_exists('xprofile_install') ) { 216 $sql = $wpdb->prepare( "SELECT DISTINCT d.user_id as id FROM " . $bp['profile']['table_name_data'] . "d, $users_table u WHERE d.user_id = u.id AND d.value LIKE '$filter%%' ORDER BY d.value DESC $pag_sql" );216 $sql = $wpdb->prepare( "SELECT DISTINCT d.user_id as id FROM {$bp->profile->table_name_data} d, $users_table u WHERE d.user_id = u.id AND d.value LIKE '$filter%%' ORDER BY d.value DESC $pag_sql" ); 217 217 } else { 218 218 $sql = $wpdb->prepare( "SELECT DISTINCT user_id as id FROM $usermeta_table WHERE meta_value LIKE '$filter%%' ORDER BY d.value DESC $pag_sql" ); … … 236 236 // filter the user_ids based on the search criteria. 237 237 if ( function_exists('xprofile_install') ) { 238 $sql = $wpdb->prepare( "SELECT DISTINCT count(d.user_id) FROM " . $bp['profile']['table_name_data'] . "d, $users_table u WHERE d.user_id = u.id AND d.value LIKE '$filter%%'" );238 $sql = $wpdb->prepare( "SELECT DISTINCT count(d.user_id) FROM {$bp->profile->table_name_data} d, $users_table u WHERE d.user_id = u.id AND d.value LIKE '$filter%%'" ); 239 239 } else { 240 240 $sql = $wpdb->prepare( "SELECT DISTINCT count(user_id) FROM $usermeta_table WHERE meta_value LIKE '$filter%%'" ); … … 255 255 return false; 256 256 257 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM " . $bp['profile']['table_name_data'] . " pd, " . $bp['profile']['table_name_fields'] . "pf WHERE pf.id = pd.field_id AND pf.name = %s AND pd.user_id IN ( {$user_ids} ) ORDER BY pd.value ASC", BP_XPROFILE_FULLNAME_FIELD_NAME ) );257 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$bp->profile->table_name_data} pd, {$bp->profile->table_name_fields} pf WHERE pf.id = pd.field_id AND pf.name = %s AND pd.user_id IN ( {$user_ids} ) ORDER BY pd.value ASC", BP_XPROFILE_FULLNAME_FIELD_NAME ) ); 258 258 } 259 259 … … 261 261 global $wpdb, $bp; 262 262 263 $sql = $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM " . $bp['friends']['table_name'] . "WHERE (friend_user_id = %d || initiator_user_id = %d) && is_confirmed = 1 ORDER BY rand() LIMIT %d", $user_id, $user_id, $total_friends );263 $sql = $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} WHERE (friend_user_id = %d || initiator_user_id = %d) && is_confirmed = 1 ORDER BY rand() LIMIT %d", $user_id, $user_id, $total_friends ); 264 264 $results = $wpdb->get_results($sql); 265 265 … … 298 298 global $wpdb, $bp; 299 299 300 return $wpdb->get_row( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM " . $bp['friends']['table_name'] . "WHERE id = %d", $friendship_id ) );300 return $wpdb->get_row( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} WHERE id = %d", $friendship_id ) ); 301 301 } 302 302 … … 304 304 global $wpdb, $bp; 305 305 306 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['friends']['table_name'] . "WHERE friend_user_id = %d OR initiator_user_id = %d", $user_id, $user_id ) );306 $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE friend_user_id = %d OR initiator_user_id = %d", $user_id, $user_id ) ); 307 307 308 308 // Delete friend request notifications for members who have a notification from this user. 309 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['core']['table_name_notifications'] . "WHERE component_name = 'friends' AND ( component_action = 'friendship_request' OR component_action = 'friendship_accepted' ) AND item_id = %d", $user_id ) );309 $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE component_name = 'friends' AND ( component_action = 'friendship_request' OR component_action = 'friendship_accepted' ) AND item_id = %d", $user_id ) ); 310 310 } 311 311 } -
trunk/bp-friends/bp-friends-cssjs.php
r884 r1021 9 9 global $bp; 10 10 11 if ( $bp ['current_component'] == $bp['friends']['slug'])11 if ( $bp->current_component == $bp->friends->slug ) 12 12 wp_enqueue_script( 'bp-friends-js', site_url( MUPLUGINDIR . '/bp-friends/js/general.js' ) ); 13 13 } -
trunk/bp-friends/bp-friends-templatetags.php
r884 r1021 20 20 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : 10; 21 21 22 if ( $bp ['current_action']== 'my-friends' && $_POST['friend-search-box'] != '' ) {22 if ( $bp->current_action == 'my-friends' && $_POST['friend-search-box'] != '' ) { 23 23 24 24 // Search results 25 $this->friendships = friends_search_friends( $_POST['friend-search-box'], $bp ['current_userid'], $this->pag_num, $this->pag_page );25 $this->friendships = friends_search_friends( $_POST['friend-search-box'], $bp->displayed_user->id, $this->pag_num, $this->pag_page ); 26 26 $this->total_friend_count = (int)$this->friendships['total']; 27 27 $this->friendships = $this->friendships['friends']; 28 28 29 } else if ( $bp ['current_action']== 'requests' ) {29 } else if ( $bp->current_action == 'requests' ) { 30 30 31 31 // Friendship Requests 32 $this->friendships = friends_get_friendship_requests( $bp ['current_userid']);32 $this->friendships = friends_get_friendship_requests( $bp->displayed_user->id ); 33 33 $this->total_friend_count = $this->friendships['total']; 34 34 $this->friendships = $this->friendships['requests']; 35 35 36 36 } else { 37 $order = $bp ['action_variables'][0];37 $order = $bp->action_variables[0]; 38 38 39 39 if ( $order == 'newest' ) { 40 $this->friendships = friends_get_newest( $bp ['current_userid'], $this->pag_num, $this->pag_page );40 $this->friendships = friends_get_newest( $bp->displayed_user->id, $this->pag_num, $this->pag_page ); 41 41 } else if ( $order == 'alphabetically' ) { 42 $this->friendships = friends_get_alphabetically( $bp ['current_userid'], $this->pag_num, $this->pag_page );42 $this->friendships = friends_get_alphabetically( $bp->displayed_user->id, $this->pag_num, $this->pag_page ); 43 43 } else { 44 $this->friendships = friends_get_recently_active( $bp ['current_userid'], $this->pag_num, $this->pag_page );44 $this->friendships = friends_get_recently_active( $bp->displayed_user->id, $this->pag_num, $this->pag_page ); 45 45 } 46 46 … … 102 102 $this->friendship = $this->next_friendship(); 103 103 104 if ( $bp ['current_action']== 'requests' ) {104 if ( $bp->current_action == 'requests' ) { 105 105 $this->friendship = new BP_Friends_Friendship( $this->friendship ); 106 106 } else { … … 117 117 global $bp, $friends_template; 118 118 119 $friends_template = new BP_Friendship_Template( $bp ['current_userid']);119 $friends_template = new BP_Friendship_Template( $bp->displayed_user->id ); 120 120 121 121 return $friends_template->has_friendships(); … … 248 248 global $friends_template, $bp; 249 249 250 echo apply_filters( 'bp_friend_accept_request_link', $bp ['loggedin_domain'] . $bp['friends']['slug']. '/requests/accept/' . $friends_template->friendship->id );250 echo apply_filters( 'bp_friend_accept_request_link', $bp->loggedin_user->domain . $bp->friends->slug . '/requests/accept/' . $friends_template->friendship->id ); 251 251 } 252 252 … … 254 254 global $friends_template, $bp; 255 255 256 echo apply_filters( 'bp_friend_reject_request_link', $bp ['loggedin_domain'] . $bp['friends']['slug']. '/requests/reject/' . $friends_template->friendship->id );256 echo apply_filters( 'bp_friend_reject_request_link', $bp->loggedin_user->domain . $bp->friends->slug . '/requests/reject/' . $friends_template->friendship->id ); 257 257 } 258 258 … … 265 265 global $friends_template, $bp; 266 266 267 $action = $bp ['current_domain'] . $bp['friends']['slug']. '/my-friends/search/';267 $action = $bp->displayed_user->domain . $bp->friends->slug . '/my-friends/search/'; 268 268 $label = __( 'Filter Friends', 'buddypress' ); 269 269 ?> 270 270 <form action="<?php echo $action ?>" id="friend-search-form" method="post"> 271 <label for="friend-search-box" id="friend-search-label"><?php echo $label ?> <img id="ajax-loader" src="<?php echo $bp ['friends']['image_base']?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></label>271 <label for="friend-search-box" id="friend-search-label"><?php echo $label ?> <img id="ajax-loader" src="<?php echo $bp->friends->image_base ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></label> 272 272 <input type="search" name="friend-search-box" id="friend-search-box" value="<?php echo $value ?>"<?php echo $disabled ?> /> 273 273 <?php if ( function_exists('wp_nonce_field') ) 274 274 wp_nonce_field('friend_search' ); 275 275 ?> 276 <input type="hidden" name="initiator" id="initiator" value="<?php echo $bp ['current_userid']?>" />276 <input type="hidden" name="initiator" id="initiator" value="<?php echo $bp->displayed_user->id ?>" /> 277 277 </form> 278 278 <?php … … 281 281 function bp_friend_all_friends_link() { 282 282 global $bp; 283 echo apply_filters( 'bp_friend_all_friends_link', $bp ['current_domain']. 'my-friends/all-friends' );283 echo apply_filters( 'bp_friend_all_friends_link', $bp->displayed_user->domain . 'my-friends/all-friends' ); 284 284 } 285 285 286 286 function bp_friend_latest_update_link() { 287 287 global $bp; 288 echo apply_filters( 'bp_friend_latest_update_link', $bp ['current_domain']. 'my-friends/last-updated' );288 echo apply_filters( 'bp_friend_latest_update_link', $bp->displayed_user->domain . 'my-friends/last-updated' ); 289 289 } 290 290 291 291 function bp_friend_recent_activity_link() { 292 292 global $bp; 293 echo apply_filters( 'bp_friend_recent_activity_link', $bp ['current_domain']. 'my-friends/recently-active' );293 echo apply_filters( 'bp_friend_recent_activity_link', $bp->displayed_user->domain . 'my-friends/recently-active' ); 294 294 } 295 295 296 296 function bp_friend_recent_status_link() { 297 297 global $bp; 298 echo apply_filters( 'bp_friend_recent_status_link', $bp ['current_domain']. 'my-friends/status-updates' );298 echo apply_filters( 'bp_friend_recent_status_link', $bp->displayed_user->domain . 'my-friends/status-updates' ); 299 299 } 300 300 … … 307 307 $potential_friend_id = $friends_template->friendship->friend->id; 308 308 else if ( !$potential_friend_id && !$friends_template->friendship->friend ) 309 $potential_friend_id = $bp ['current_userid'];310 311 if ( $bp ['loggedin_userid']== $potential_friend_id )309 $potential_friend_id = $bp->displayed_user->id; 310 311 if ( $bp->loggedin_user->id == $potential_friend_id ) 312 312 return false; 313 313 314 $friend_status = BP_Friends_Friendship::check_is_friend( $bp ['loggedin_userid'], $potential_friend_id );314 $friend_status = BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $potential_friend_id ); 315 315 316 316 echo '<div class="friendship-button ' . $friend_status . '" id="friendship-button-' . $potential_friend_id . '">'; 317 317 if ( $friend_status == 'pending' ) { 318 echo '<a class="requested" href="' . $bp ['loggedin_domain'] . $bp['friends']['slug']. '">' . __( 'Friendship Requested', 'buddypress' ) . '</a>';318 echo '<a class="requested" href="' . $bp->loggedin_user->domain . $bp->friends->slug . '">' . __( 'Friendship Requested', 'buddypress' ) . '</a>'; 319 319 } else if ( $friend_status == 'is_friend') { 320 echo '<a href="' . $bp ['loggedin_domain'] . $bp['friends']['slug']. '/remove-friend/' . $potential_friend_id . '" title="' . __('Cancel Friendship', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="remove" class="remove">' . __('Cancel Friendship', 'buddypress') . '</a>';320 echo '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/remove-friend/' . $potential_friend_id . '" title="' . __('Cancel Friendship', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="remove" class="remove">' . __('Cancel Friendship', 'buddypress') . '</a>'; 321 321 } else { 322 echo '<a href="' . $bp ['loggedin_domain'] . $bp['friends']['slug']. '/add-friend/' . $potential_friend_id . '" title="' . __('Add Friend', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="add" class="add">' . __('Add Friend', 'buddypress') . '</a>';322 echo '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/add-friend/' . $potential_friend_id . '" title="' . __('Add Friend', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="add" class="add">' . __('Add Friend', 'buddypress') . '</a>'; 323 323 } 324 324 echo '</div>'; … … 333 333 global $bp, $create_group_step, $completed_to_step; 334 334 ?> 335 <li<?php if ( !isset($bp ['action_variables'][0]) || $bp['action_variables'][0] == 'recently-active' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['friends']['slug']?>/my-friends/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li>336 <li<?php if ( $bp ['action_variables'][0] == 'newest' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['friends']['slug']?>/my-friends/newest"><?php _e( 'Newest', 'buddypress' ) ?></a></li>337 <li<?php if ( $bp ['action_variables'][0] == 'alphabetically' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['friends']['slug']?>/my-friends/alphabetically""><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li>335 <li<?php if ( !isset($bp->action_variables[0]) || $bp->action_variables[0] == 'recently-active' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>/my-friends/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li> 336 <li<?php if ( $bp->action_variables[0] == 'newest' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>/my-friends/newest"><?php _e( 'Newest', 'buddypress' ) ?></a></li> 337 <li<?php if ( $bp->action_variables[0] == 'alphabetically' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>/my-friends/alphabetically""><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li> 338 338 <?php 339 339 do_action( 'friends_header_tabs' ); … … 343 343 global $bp; 344 344 345 $current_filter = $bp ['action_variables'][0];345 $current_filter = $bp->action_variables[0]; 346 346 347 347 switch ( $current_filter ) { … … 361 361 global $bp; 362 362 363 $friend_ids = BP_Friends_Friendship::get_random_friends( $bp ['current_userid']);363 $friend_ids = BP_Friends_Friendship::get_random_friends( $bp->displayed_user->id ); 364 364 ?> 365 365 <div class="info-group"> 366 <h4><?php bp_word_or_name( __( "My Friends", 'buddypress' ), __( "%s's Friends", 'buddypress' ) ) ?> (<?php echo BP_Friends_Friendship::total_friend_count( $bp ['current_userid'] ) ?>) <a href="<?php echo $bp['current_domain'] . $bp['friends']['slug']?>"><?php _e('See All', 'buddypress') ?> »</a></h4>366 <h4><?php bp_word_or_name( __( "My Friends", 'buddypress' ), __( "%s's Friends", 'buddypress' ) ) ?> (<?php echo BP_Friends_Friendship::total_friend_count( $bp->displayed_user->id ) ?>) <a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>"><?php _e('See All', 'buddypress') ?> »</a></h4> 367 367 368 368 <?php if ( $friend_ids ) { ?> -
trunk/bp-groups.php
r1017 r1021 30 30 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 31 31 32 $sql[] = "CREATE TABLE ". $bp['groups']['table_name'] ."(32 $sql[] = "CREATE TABLE {$bp->groups->table_name} ( 33 33 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 34 34 creator_id int(11) NOT NULL, … … 51 51 ) {$charset_collate};"; 52 52 53 $sql[] = "CREATE TABLE ". $bp['groups']['table_name_members'] ."(53 $sql[] = "CREATE TABLE {$bp->groups->table_name_members} ( 54 54 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 55 55 group_id int(11) NOT NULL, … … 72 72 ) {$charset_collate};"; 73 73 74 $sql[] = "CREATE TABLE ". $bp['groups']['table_name_groupmeta'] ."(74 $sql[] = "CREATE TABLE {$bp->groups->table_name_groupmeta} ( 75 75 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 76 76 group_id int(11) NOT NULL, … … 93 93 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 94 94 95 $sql[] = "CREATE TABLE ". $bp['groups']['table_name_wire'] ."(95 $sql[] = "CREATE TABLE {$bp->groups->table_name_wire} ( 96 96 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 97 97 item_id int(11) NOT NULL, … … 121 121 global $bp; 122 122 123 $bp['groups'] = array( 124 'table_name' => $wpdb->base_prefix . 'bp_groups', 125 'table_name_members' => $wpdb->base_prefix . 'bp_groups_members', 126 'table_name_groupmeta' => $wpdb->base_prefix . 'bp_groups_groupmeta', 127 'image_base' => site_url( MUPLUGINDIR . '/bp-groups/images' ), 128 'format_activity_function' => 'groups_format_activity', 129 'slug' => BP_GROUPS_SLUG 130 ); 131 123 $bp->groups->table_name = $wpdb->base_prefix . 'bp_groups'; 124 $bp->groups->table_name_members = $wpdb->base_prefix . 'bp_groups_members'; 125 $bp->groups->table_name_groupmeta = $wpdb->base_prefix . 'bp_groups_groupmeta'; 126 $bp->groups->image_base = site_url( MUPLUGINDIR . '/bp-groups/images' ); 127 $bp->groups->format_activity_function = 'groups_format_activity'; 128 $bp->groups->slug = BP_GROUPS_SLUG; 129 132 130 if ( function_exists('bp_wire_install') ) 133 $bp ['groups']['table_name_wire']= $wpdb->base_prefix . 'bp_groups_wire';134 135 $bp ['groups']['forbidden_names']= array( 'my-groups', 'group-finder', 'create', 'invites', 'delete', 'add', 'admin', 'request-membership' );136 $bp ['version_numbers'][$bp['groups']['slug']]= BP_GROUPS_VERSION;137 131 $bp->groups->table_name_wire = $wpdb->base_prefix . 'bp_groups_wire'; 132 133 $bp->groups->forbidden_names = array( 'my-groups', 'group-finder', 'create', 'invites', 'delete', 'add', 'admin', 'request-membership' ); 134 $bp->version_numbers->groups = BP_GROUPS_VERSION; 135 138 136 return $bp; 139 137 } … … 152 150 if ( is_site_admin() ) { 153 151 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 154 if ( ( $wpdb->get_var("SHOW TABLES LIKE '%" . $bp ['groups']['table_name']. "%'") == false ) || ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION ) )152 if ( ( $wpdb->get_var("SHOW TABLES LIKE '%" . $bp->groups->table_name . "%'") == false ) || ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION ) ) 155 153 groups_install(); 156 154 157 if ( ( function_exists('bp_wire_install') && $wpdb->get_var("SHOW TABLES LIKE '%" . $bp ['groups']['table_name_wire']. "%'") == false ) || ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION ) )155 if ( ( function_exists('bp_wire_install') && $wpdb->get_var("SHOW TABLES LIKE '%" . $bp->groups->table_name_wire . "%'") == false ) || ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION ) ) 158 156 groups_wire_install(); 159 157 } … … 182 180 global $group_obj, $is_single_group; 183 181 184 if ( $group_id = BP_Groups_Group::group_exists($bp ['current_action']) ) {182 if ( $group_id = BP_Groups_Group::group_exists($bp->current_action) ) { 185 183 /* This is a single group page. */ 186 184 $is_single_group = true; … … 189 187 /* Using "item" not "group" for generic support in other components. */ 190 188 if ( is_site_admin() ) 191 $bp ['is_item_admin']= 1;189 $bp->is_item_admin = 1; 192 190 else 193 $bp ['is_item_admin'] = groups_is_user_admin( $bp['loggedin_userid'], $group_obj->id );191 $bp->is_item_admin = groups_is_user_admin( $bp->loggedin_user->id, $group_obj->id ); 194 192 195 193 /* If the user is not an admin, check if they are a moderator */ 196 if ( !$bp ['is_item_admin'])197 $bp ['is_item_mod'] = groups_is_user_mod( $bp['loggedin_userid'], $group_obj->id );194 if ( !$bp->is_item_admin ) 195 $bp->is_item_mod = groups_is_user_mod( $bp->loggedin_user->id, $group_obj->id ); 198 196 199 197 /* Is the logged in user a member of the group? */ 200 $is_member = ( groups_is_user_member( $bp ['loggedin_userid'], $group_obj->id ) ) ? true : false;198 $is_member = ( groups_is_user_member( $bp->loggedin_user->id, $group_obj->id ) ) ? true : false; 201 199 202 200 /* Should this group be visible to the logged in user? */ … … 205 203 206 204 /* Add 'Groups' to the main navigation */ 207 bp_core_add_nav_item( __('Groups', 'buddypress'), $bp ['groups']['slug']);208 209 if ( $bp ['current_userid'])210 bp_core_add_nav_default( $bp ['groups']['slug'], 'groups_screen_my_groups', 'my-groups' );211 212 $groups_link = $bp ['loggedin_domain'] . $bp['groups']['slug']. '/';205 bp_core_add_nav_item( __('Groups', 'buddypress'), $bp->groups->slug ); 206 207 if ( $bp->displayed_user->id ) 208 bp_core_add_nav_default( $bp->groups->slug, 'groups_screen_my_groups', 'my-groups' ); 209 210 $groups_link = $bp->loggedin_user->domain . $bp->groups->slug . '/'; 213 211 214 212 /* Add the subnav items to the groups nav item */ 215 bp_core_add_subnav_item( $bp ['groups']['slug'], 'my-groups', __('My Groups', 'buddypress'), $groups_link, 'groups_screen_my_groups', 'my-groups-list' );216 bp_core_add_subnav_item( $bp ['groups']['slug'], 'create', __('Create a Group', 'buddypress'), $groups_link, 'groups_screen_create_group', false, bp_is_home() );217 bp_core_add_subnav_item( $bp ['groups']['slug'], 'invites', __('Invites', 'buddypress'), $groups_link, 'groups_screen_group_invites', false, bp_is_home() );218 219 if ( $bp ['current_component'] == $bp['groups']['slug']) {213 bp_core_add_subnav_item( $bp->groups->slug, 'my-groups', __('My Groups', 'buddypress'), $groups_link, 'groups_screen_my_groups', 'my-groups-list' ); 214 bp_core_add_subnav_item( $bp->groups->slug, 'create', __('Create a Group', 'buddypress'), $groups_link, 'groups_screen_create_group', false, bp_is_home() ); 215 bp_core_add_subnav_item( $bp->groups->slug, 'invites', __('Invites', 'buddypress'), $groups_link, 'groups_screen_group_invites', false, bp_is_home() ); 216 217 if ( $bp->current_component == $bp->groups->slug ) { 220 218 221 219 if ( bp_is_home() && !$is_single_group ) { 222 220 223 $bp ['bp_options_title']= __('My Groups', 'buddypress');221 $bp->bp_options_title = __('My Groups', 'buddypress'); 224 222 225 223 } else if ( !bp_is_home() && !$is_single_group ) { 226 224 227 $bp ['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 );228 $bp ['bp_options_title'] = $bp['current_fullname'];225 $bp->bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 ); 226 $bp->bp_options_title = $bp->displayed_user->fullname; 229 227 230 228 } else if ( $is_single_group ) { … … 234 232 /* When in a single group, the first action is bumped down one because of the 235 233 group name, so we need to adjust this and set the group name to current_item. */ 236 $bp ['current_item'] = $bp['current_action'];237 $bp ['current_action'] = $bp['action_variables'][0];238 array_shift($bp ['action_variables']);234 $bp->current_item = $bp->current_action; 235 $bp->current_action = $bp->action_variables[0]; 236 array_shift($bp->action_variables); 239 237 240 $bp ['bp_options_title']= bp_create_excerpt( $group_obj->name, 1 );241 $bp ['bp_options_avatar']= '<img src="' . $group_obj->avatar_thumb . '" alt="Group Avatar Thumbnail" />';242 243 $group_link = $bp ['root_domain'] . '/' . $bp['groups']['slug']. '/' . $group_obj->slug . '/';238 $bp->bp_options_title = bp_create_excerpt( $group_obj->name, 1 ); 239 $bp->bp_options_avatar = '<img src="' . $group_obj->avatar_thumb . '" alt="Group Avatar Thumbnail" />'; 240 241 $group_link = $bp->root_domain . '/' . $bp->groups->slug . '/' . $group_obj->slug . '/'; 244 242 245 243 // If this is a private or hidden group, does the user have access? 246 244 if ( $group_obj->status == 'private' || $group_obj->status == 'hidden' ) { 247 if ( groups_is_user_member( $bp ['loggedin_userid'], $group_obj->id ) && is_user_logged_in() )245 if ( groups_is_user_member( $bp->loggedin_user->id, $group_obj->id ) && is_user_logged_in() ) 248 246 $has_access = true; 249 247 else … … 254 252 255 253 // Reset the existing subnav items 256 bp_core_reset_subnav_items($bp ['groups']['slug']);257 258 bp_core_add_nav_default( $bp ['groups']['slug'], 'groups_screen_group_home', 'home' );259 bp_core_add_subnav_item( $bp ['groups']['slug'], 'home', __('Home', 'buddypress'), $group_link, 'groups_screen_group_home', 'group-home' );254 bp_core_reset_subnav_items($bp->groups->slug); 255 256 bp_core_add_nav_default( $bp->groups->slug, 'groups_screen_group_home', 'home' ); 257 bp_core_add_subnav_item( $bp->groups->slug, 'home', __('Home', 'buddypress'), $group_link, 'groups_screen_group_home', 'group-home' ); 260 258 261 259 // If the user is a group mod or more, then show the group admin nav item */ 262 if ( $bp ['is_item_mod'] || $bp['is_item_admin'])263 bp_core_add_subnav_item( $bp ['groups']['slug'], 'admin', __('Admin', 'buddypress'), $group_link , 'groups_screen_group_admin', 'group-admin', ( $bp['is_item_admin'] + (int)$bp['is_item_mod']) );260 if ( $bp->is_item_mod || $bp->is_item_admin ) 261 bp_core_add_subnav_item( $bp->groups->slug, 'admin', __('Admin', 'buddypress'), $group_link , 'groups_screen_group_admin', 'group-admin', ( $bp->is_item_admin + (int)$bp->is_item_mod ) ); 264 262 265 263 // If this is a private group, and the user is not a member, show a "Request Membership" nav item. 266 if ( !$has_access && !groups_check_for_membership_request( $bp ['loggedin_userid'], $group_obj->id ) )267 bp_core_add_subnav_item( $bp ['groups']['slug'], 'request-membership', __('Request Membership', 'buddypress'), $group_link , 'groups_screen_group_request_membership', 'request-membership' );264 if ( !$has_access && !groups_check_for_membership_request( $bp->loggedin_user->id, $group_obj->id ) ) 265 bp_core_add_subnav_item( $bp->groups->slug, 'request-membership', __('Request Membership', 'buddypress'), $group_link , 'groups_screen_group_request_membership', 'request-membership' ); 268 266 269 267 if ( $has_access && $group_obj->enable_forum && function_exists('bp_forums_setup') ) 270 bp_core_add_subnav_item( $bp ['groups']['slug'], 'forum', __('Forum', 'buddypress'), $group_link , 'groups_screen_group_forum', 'group-forum', $is_visible);268 bp_core_add_subnav_item( $bp->groups->slug, 'forum', __('Forum', 'buddypress'), $group_link , 'groups_screen_group_forum', 'group-forum', $is_visible); 271 269 272 270 if ( $has_access && $group_obj->enable_wire && function_exists('bp_wire_install') ) 273 bp_core_add_subnav_item( $bp ['groups']['slug'], 'wire', __('Wire', 'buddypress'), $group_link, 'groups_screen_group_wire', 'group-wire', $is_visible );271 bp_core_add_subnav_item( $bp->groups->slug, 'wire', __('Wire', 'buddypress'), $group_link, 'groups_screen_group_wire', 'group-wire', $is_visible ); 274 272 275 273 if ( $has_access && $group_obj->enable_photos && function_exists('bp_gallery_install') ) 276 bp_core_add_subnav_item( $bp ['groups']['slug'], 'photos', __('Photos', 'buddypress'), $group_link, 'groups_screen_group_photos', 'group-photos', $is_visible );274 bp_core_add_subnav_item( $bp->groups->slug, 'photos', __('Photos', 'buddypress'), $group_link, 'groups_screen_group_photos', 'group-photos', $is_visible ); 277 275 278 276 if ( $has_access ) 279 bp_core_add_subnav_item( $bp ['groups']['slug'], 'members', __('Members', 'buddypress'), $group_link, 'groups_screen_group_members', 'group-members', $is_visible );280 281 if ( is_user_logged_in() && groups_is_user_member( $bp ['loggedin_userid'], $group_obj->id ) ) {277 bp_core_add_subnav_item( $bp->groups->slug, 'members', __('Members', 'buddypress'), $group_link, 'groups_screen_group_members', 'group-members', $is_visible ); 278 279 if ( is_user_logged_in() && groups_is_user_member( $bp->loggedin_user->id, $group_obj->id ) ) { 282 280 if ( function_exists('friends_install') ) 283 bp_core_add_subnav_item( $bp ['groups']['slug'], 'send-invites', __('Send Invites', 'buddypress'), $group_link, 'groups_screen_group_invite', 'group-invite', $is_member );281 bp_core_add_subnav_item( $bp->groups->slug, 'send-invites', __('Send Invites', 'buddypress'), $group_link, 'groups_screen_group_invite', 'group-invite', $is_member ); 284 282 285 bp_core_add_subnav_item( $bp ['groups']['slug'], 'leave-group', __('Leave Group', 'buddypress'), $group_link, 'groups_screen_group_leave', 'group-leave', $is_member );283 bp_core_add_subnav_item( $bp->groups->slug, 'leave-group', __('Leave Group', 'buddypress'), $group_link, 'groups_screen_group_leave', 'group-leave', $is_member ); 286 284 } 287 285 } … … 297 295 global $bp; 298 296 299 bp_core_delete_notifications_for_user_by_type( $bp ['loggedin_userid'], 'groups', 'member_promoted_to_mod' );300 bp_core_delete_notifications_for_user_by_type( $bp ['loggedin_userid'], 'groups', 'member_promoted_to_admin' );297 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'member_promoted_to_mod' ); 298 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'member_promoted_to_admin' ); 301 299 302 300 do_action( 'groups_screen_my_groups' ); … … 308 306 global $bp; 309 307 310 $group_id = $bp ['action_variables'][1];311 312 if ( isset($bp ['action_variables']) && in_array( 'accept', $bp['action_variables']) && is_numeric($group_id) ) {313 314 if ( !groups_accept_invite( $bp ['loggedin_userid'], $group_id ) ) {308 $group_id = $bp->action_variables[1]; 309 310 if ( isset($bp->action_variables) && in_array( 'accept', $bp->action_variables ) && is_numeric($group_id) ) { 311 312 if ( !groups_accept_invite( $bp->loggedin_user->id, $group_id ) ) { 315 313 bp_core_add_message( __('Group invite could not be accepted', 'buddypress'), 'error' ); 316 314 } else { … … 321 319 } 322 320 323 bp_core_redirect( $bp ['loggedin_domain'] . $bp['current_component'] . '/' . $bp['current_action']);324 325 } else if ( isset($bp ['action_variables']) && in_array( 'reject', $bp['action_variables']) && is_numeric($group_id) ) {326 327 if ( !groups_reject_invite( $group_id, $bp ['loggedin_userid']) ) {321 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action ); 322 323 } else if ( isset($bp->action_variables) && in_array( 'reject', $bp->action_variables ) && is_numeric($group_id) ) { 324 325 if ( !groups_reject_invite( $group_id, $bp->loggedin_user->id ) ) { 328 326 bp_core_add_message( __('Group invite could not be rejected', 'buddypress'), 'error' ); 329 327 } else { … … 331 329 } 332 330 333 bp_core_redirect( $bp ['loggedin_domain'] . $bp['current_component'] . '/' . $bp['current_action']);331 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action ); 334 332 } 335 333 336 334 // Remove notifications 337 bp_core_delete_notifications_for_user_by_type( $bp ['loggedin_userid'], 'groups', 'group_invite' );335 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'group_invite' ); 338 336 339 337 do_action( 'groups_screen_group_invites', $group_id ); … … 349 347 $reset_steps = false; 350 348 351 if ( !$create_group_step = $bp ['action_variables'][1] ) {349 if ( !$create_group_step = $bp->action_variables[1] ) { 352 350 $create_group_step = '1'; 353 351 $completed_to_step = 0; … … 380 378 if ( !$group_id = groups_create_group( $create_group_step, $_SESSION['group_obj_id'] ) ) { 381 379 bp_core_add_message( __('There was an error saving group details. Please try again.', 'buddypress'), 'error' ); 382 bp_core_redirect( $bp ['loggedin_domain'] . $bp['groups']['slug']. '/create/step/' . $create_group_step );380 bp_core_redirect( $bp->loggedin_user->domain . $bp->groups->slug . '/create/step/' . $create_group_step ); 383 381 } else { 384 382 $create_group_step++; … … 403 401 if ( isset($_GET['new']) ) { 404 402 // Delete group request notifications for the user 405 bp_core_delete_notifications_for_user_by_type( $bp ['loggedin_userid'], 'groups', 'membership_request_accepted' );406 bp_core_delete_notifications_for_user_by_type( $bp ['loggedin_userid'], 'groups', 'membership_request_rejected' );407 bp_core_delete_notifications_for_user_by_type( $bp ['loggedin_userid'], 'groups', 'member_promoted_to_mod' );408 bp_core_delete_notifications_for_user_by_type( $bp ['loggedin_userid'], 'groups', 'member_promoted_to_admin' );403 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'membership_request_accepted' ); 404 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'membership_request_rejected' ); 405 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'member_promoted_to_mod' ); 406 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'member_promoted_to_admin' ); 409 407 } 410 408 … … 419 417 420 418 if ( $is_single_group ) { 421 $topic_id = $bp ['action_variables'][1];419 $topic_id = $bp->action_variables[1]; 422 420 $forum_id = groups_get_groupmeta( $group_obj->id, 'forum_id' ); 423 421 … … 454 452 global $is_single_group, $group_obj; 455 453 456 $wire_action = $bp ['action_variables'][0];454 $wire_action = $bp->action_variables[0]; 457 455 458 456 if ( $is_single_group ) { 459 if ( $wire_action == 'post' && BP_Groups_Member::check_is_member( $bp ['loggedin_userid'], $group_obj->id ) ) {457 if ( $wire_action == 'post' && BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group_obj->id ) ) { 460 458 461 459 if ( !groups_new_wire_post( $group_obj->id, $_POST['wire-post-textarea'] ) ) { … … 465 463 } 466 464 467 if ( !strpos( $_SERVER['HTTP_REFERER'], $bp ['wire']['slug']) ) {465 if ( !strpos( $_SERVER['HTTP_REFERER'], $bp->wire->slug ) ) { 468 466 bp_core_redirect( bp_group_permalink( $group_obj, false ) ); 469 467 } else { 470 bp_core_redirect( bp_group_permalink( $group_obj, false ) . '/' . $bp ['wire']['slug']);471 } 472 473 } else if ( $wire_action == 'delete' && BP_Groups_Member::check_is_member( $bp ['loggedin_userid'], $group_obj->id ) ) {474 $wire_message_id = $bp ['action_variables'][1];475 476 if ( !groups_delete_wire_post( $wire_message_id, $bp ['groups']['table_name_wire']) ) {468 bp_core_redirect( bp_group_permalink( $group_obj, false ) . '/' . $bp->wire->slug ); 469 } 470 471 } else if ( $wire_action == 'delete' && BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group_obj->id ) ) { 472 $wire_message_id = $bp->action_variables[1]; 473 474 if ( !groups_delete_wire_post( $wire_message_id, $bp->groups->table_name_wire ) ) { 477 475 bp_core_add_message( __('There was an error deleting the wire message.', 'buddypress'), 'error' ); 478 476 } else { … … 480 478 } 481 479 482 if ( !strpos( $_SERVER['HTTP_REFERER'], $bp ['wire']['slug']) ) {480 if ( !strpos( $_SERVER['HTTP_REFERER'], $bp->wire->slug ) ) { 483 481 bp_core_redirect( bp_group_permalink( $group_obj, false ) ); 484 482 } else { 485 bp_core_redirect( bp_group_permalink( $group_obj, false ) . '/' . $bp ['wire']['slug']);486 } 487 488 } else if ( ( !$wire_action || $bp ['action_variables'][1] == 'latest' ) ) {483 bp_core_redirect( bp_group_permalink( $group_obj, false ) . '/' . $bp->wire->slug ); 484 } 485 486 } else if ( ( !$wire_action || $bp->action_variables[1] == 'latest' ) ) { 489 487 bp_core_load_template( 'groups/wire' ); 490 488 } else { … … 520 518 521 519 if ( $is_single_group ) { 522 if ( isset($bp ['action_variables']) && $bp['action_variables'][0] == 'send' ) {520 if ( isset($bp->action_variables) && $bp->action_variables[0] == 'send' ) { 523 521 // Send the invites. 524 522 groups_send_invites($group_obj); … … 540 538 541 539 if ( $is_single_group ) { 542 if ( isset($bp ['action_variables']) && $bp['action_variables'][0] == 'yes' ) {540 if ( isset($bp->action_variables) && $bp->action_variables[0] == 'yes' ) { 543 541 544 542 // Check if the user is the group admin first. 545 if ( groups_is_group_admin( $bp ['loggedin_userid'], $group_obj->id ) ) {543 if ( groups_is_group_admin( $bp->loggedin_user->id, $group_obj->id ) ) { 546 544 bp_core_add_message( __('As the only group administrator, you cannot leave this group.', 'buddypress'), 'error' ); 547 545 bp_core_redirect( bp_group_permalink( $group_obj, false) ); … … 554 552 } else { 555 553 bp_core_add_message( __('You left the group successfully.', 'buddypress') ); 556 bp_core_redirect( $bp ['loggedin_domain'] . $bp['groups']['slug']);557 } 558 559 } else if ( isset($bp ['action_variables']) && $bp['action_variables'][0] == 'no' ) {554 bp_core_redirect( $bp->loggedin_user->domain . $bp->groups->slug ); 555 } 556 557 } else if ( isset($bp->action_variables) && $bp->action_variables[0] == 'no' ) { 560 558 561 559 bp_core_redirect( bp_group_permalink( $group_obj, false) ); … … 581 579 // If the user has submitted a request, send it. 582 580 if ( isset( $_POST['group-request-send']) ) { 583 if ( !groups_send_membership_request( $bp ['loggedin_userid'], $group_obj->id ) ) {581 if ( !groups_send_membership_request( $bp->loggedin_user->id, $group_obj->id ) ) { 584 582 bp_core_add_message( __( 'There was an error sending your group membership request, please try again.', 'buddypress' ), 'error' ); 585 583 } else { … … 598 596 global $bp, $group_obj; 599 597 600 if ( $bp ['current_component'] == $bp['groups']['slug'] && !$bp['action_variables']) {598 if ( $bp->current_component == $bp->groups->slug && !$bp->action_variables ) { 601 599 602 600 do_action( 'groups_screen_group_admin', $group_obj->id ); … … 610 608 global $bp, $group_obj; 611 609 612 if ( $bp ['current_component'] == $bp['groups']['slug'] && $bp['action_variables'][0] == 'edit-details' ) {613 614 if ( $bp ['is_item_admin'] || $bp['is_item_mod']) {610 if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'edit-details' ) { 611 612 if ( $bp->is_item_admin || $bp->is_item_mod ) { 615 613 616 614 // If the edit form has been submitted, save the edited details … … 624 622 do_action( 'groups_group_details_edited', $group_obj->id ); 625 623 626 bp_core_redirect( site_url() . '/' . $bp ['current_component'] . '/' . $bp['current_item']. '/admin/edit-details' );624 bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/edit-details' ); 627 625 } 628 626 … … 640 638 global $bp, $group_obj; 641 639 642 if ( $bp ['current_component'] == $bp['groups']['slug'] && $bp['action_variables'][0] == 'group-settings' ) {643 644 if ( !$bp ['is_item_admin'])640 if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'group-settings' ) { 641 642 if ( !$bp->is_item_admin ) 645 643 return false; 646 644 … … 661 659 do_action( 'groups_group_settings_edited', $group_obj->id ); 662 660 663 bp_core_redirect( site_url() . '/' . $bp ['current_component'] . '/' . $bp['current_item']. '/admin/group-settings' );661 bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/group-settings' ); 664 662 } 665 663 … … 674 672 global $bp, $group_obj; 675 673 676 if ( $bp ['current_component'] == $bp['groups']['slug'] && $bp['action_variables'][0] == 'group-avatar' ) {677 678 if ( !$bp ['is_item_admin'])674 if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'group-avatar' ) { 675 676 if ( !$bp->is_item_admin ) 679 677 return false; 680 678 … … 706 704 do_action( 'groups_group_avatar_edited', $group_obj->id ); 707 705 708 bp_core_redirect( site_url() . '/' . $bp ['current_component'] . '/' . $bp['current_item']. '/admin/group-avatar' );706 bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/group-avatar' ); 709 707 } 710 708 … … 719 717 global $bp, $group_obj; 720 718 721 if ( $bp ['current_component'] == $bp['groups']['slug'] && $bp['action_variables'][0] == 'manage-members' ) {722 723 if ( !$bp ['is_item_admin'])719 if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'manage-members' ) { 720 721 if ( !$bp->is_item_admin ) 724 722 return false; 725 723 726 if ( $bp ['action_variables'][1] == 'promote' && is_numeric( $bp['action_variables'][2] ) ) {727 $user_id = $bp ['action_variables'][2];724 if ( $bp->action_variables[1] == 'promote' && is_numeric( $bp->action_variables[2] ) ) { 725 $user_id = $bp->action_variables[2]; 728 726 729 727 // Promote a user. … … 736 734 do_action( 'groups_promoted_member', $user_id, $group_obj->id ); 737 735 738 bp_core_redirect( site_url() . '/' . $bp ['current_component'] . '/' . $bp['current_item']. '/admin/manage-members' );739 } 740 741 if ( $bp ['action_variables'][1] == 'demote' && is_numeric( $bp['action_variables'][2] ) ) {742 $user_id = $bp ['action_variables'][2];736 bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/manage-members' ); 737 } 738 739 if ( $bp->action_variables[1] == 'demote' && is_numeric( $bp->action_variables[2] ) ) { 740 $user_id = $bp->action_variables[2]; 743 741 744 742 // Demote a user. … … 751 749 do_action( 'groups_demoted_member', $user_id, $group_obj->id ); 752 750 753 bp_core_redirect( site_url() . '/' . $bp ['current_component'] . '/' . $bp['current_item']. '/admin/manage-members' );754 } 755 756 if ( $bp ['action_variables'][1] == 'ban' && is_numeric( $bp['action_variables'][2] ) ) {757 $user_id = $bp ['action_variables'][2];751 bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/manage-members' ); 752 } 753 754 if ( $bp->action_variables[1] == 'ban' && is_numeric( $bp->action_variables[2] ) ) { 755 $user_id = $bp->action_variables[2]; 758 756 759 757 // Ban a user. … … 766 764 do_action( 'groups_banned_member', $user_id, $group_obj->id ); 767 765 768 bp_core_redirect( site_url() . '/' . $bp ['current_component'] . '/' . $bp['current_item']. '/admin/manage-members' );769 } 770 771 if ( $bp ['action_variables'][1] == 'unban' && is_numeric( $bp['action_variables'][2] ) ) {772 $user_id = $bp ['action_variables'][2];766 bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/manage-members' ); 767 } 768 769 if ( $bp->action_variables[1] == 'unban' && is_numeric( $bp->action_variables[2] ) ) { 770 $user_id = $bp->action_variables[2]; 773 771 774 772 // Remove a ban for user. … … 781 779 do_action( 'groups_unbanned_member', $user_id, $group_obj->id ); 782 780 783 bp_core_redirect( site_url() . '/' . $bp ['current_component'] . '/' . $bp['current_item']. '/admin/manage-members' );781 bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/manage-members' ); 784 782 } 785 783 … … 795 793 global $bp, $group_obj; 796 794 797 if ( $bp ['current_component'] == $bp['groups']['slug'] && $bp['action_variables'][0] == 'membership-requests' ) {798 799 if ( !$bp ['is_item_admin']|| $group_obj->status == 'public' )795 if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'membership-requests' ) { 796 797 if ( !$bp->is_item_admin || $group_obj->status == 'public' ) 800 798 return false; 801 799 802 800 // Remove any screen notifications 803 bp_core_delete_notifications_for_user_by_type( $bp ['loggedin_userid'], 'groups', 'new_membership_request' );804 805 $request_action = $bp ['action_variables'][1];806 $membership_id = $bp ['action_variables'][2];801 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'groups', 'new_membership_request' ); 802 803 $request_action = $bp->action_variables[1]; 804 $membership_id = $bp->action_variables[2]; 807 805 808 806 if ( isset($request_action) && isset($membership_id) ) { … … 829 827 do_action( 'groups_group_request_managed', $group_obj->id, $request_action, $membership_id ); 830 828 831 bp_core_redirect( site_url() . '/' . $bp ['current_component'] . '/' . $bp['current_item']. '/admin/membership-requests' );829 bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/membership-requests' ); 832 830 } 833 831 … … 842 840 global $bp, $group_obj; 843 841 844 if ( $bp ['current_component'] == $bp['groups']['slug'] && $bp['action_variables'][0] == 'delete-group' ) {845 846 if ( !$bp ['is_item_admin'])842 if ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'delete-group' ) { 843 844 if ( !$bp->is_item_admin ) 847 845 return false; 848 846 … … 853 851 } else { 854 852 bp_core_add_message( __( 'The group was deleted successfully', 'buddypress' ) ); 855 bp_core_redirect( site_url() . '/' . $bp ['groups']['slug']. '/' );853 bp_core_redirect( site_url() . '/' . $bp->groups->slug . '/' ); 856 854 } 857 855 858 856 do_action( 'groups_group_deleted', $_POST['group-id'] ); 859 857 860 bp_core_redirect( $bp ['loggedin_domain'] . $bp['current_component']);858 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component ); 861 859 } else { 862 860 do_action( 'groups_screen_group_admin_delete_group', $group_obj->id ); … … 923 921 global $is_single_group, $group_obj; 924 922 925 if ( !$is_single_group || $bp ['current_component'] != $bp['groups']['slug'] || $bp['current_action']!= 'join' )923 if ( !$is_single_group || $bp->current_component != $bp->groups->slug || $bp->current_action != 'join' ) 926 924 return false; 927 925 928 926 // user wants to join a group 929 if ( !groups_is_user_member( $bp ['loggedin_userid'], $group_obj->id ) && !groups_is_user_banned( $bp['loggedin_userid'], $group_obj->id ) ) {927 if ( !groups_is_user_member( $bp->loggedin_user->id, $group_obj->id ) && !groups_is_user_banned( $bp->loggedin_user->id, $group_obj->id ) ) { 930 928 if ( !groups_join_group($group_obj->id) ) { 931 929 bp_core_add_message( __('There was an error joining the group.', 'buddypress'), 'error' ); … … 1008 1006 break; 1009 1007 case 'new_wire_post': 1010 $wire_post = new BP_Wire_Post( $bp ['groups']['table_name_wire'], $item_id );1008 $wire_post = new BP_Wire_Post( $bp->groups->table_name_wire, $item_id ); 1011 1009 $group = new BP_Groups_Group( $wire_post->item_id ); 1012 1010 … … 1112 1110 1113 1111 if ( (int)$total_items > 1 ) { 1114 return apply_filters( 'bp_groups_multiple_membership_request_accepted_notification', '<a href="' . $bp ['loggedin_domain'] . $bp['groups']['slug']. '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('%d accepted group membership requests'), (int)$total_items, $group->name ) . '</a>', $total_items, $group_name );1112 return apply_filters( 'bp_groups_multiple_membership_request_accepted_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('%d accepted group membership requests'), (int)$total_items, $group->name ) . '</a>', $total_items, $group_name ); 1115 1113 } else { 1116 1114 return apply_filters( 'bp_groups_single_membership_request_accepted_notification', '<a href="' . $group_link . '">' . sprintf( __('Membership for group "%s" accepted'), $group->name ) . '</a>', $group_link, $group->name ); … … 1125 1123 1126 1124 if ( (int)$total_items > 1 ) { 1127 return apply_filters( 'bp_groups_multiple_membership_request_rejected_notification', '<a href="' . site_url() . '/' . MEMBERS_SLUG . '/' . $bp ['groups']['slug']. '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('%d rejected group membership requests'), (int)$total_items, $group->name ) . '</a>', $total_items, $group->name );1125 return apply_filters( 'bp_groups_multiple_membership_request_rejected_notification', '<a href="' . site_url() . '/' . MEMBERS_SLUG . '/' . $bp->groups->slug . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('%d rejected group membership requests'), (int)$total_items, $group->name ) . '</a>', $total_items, $group->name ); 1128 1126 } else { 1129 1127 return apply_filters( 'bp_groups_single_membership_request_rejected_notification', '<a href="' . $group_link . '">' . sprintf( __('Membership for group "%s" rejected'), $group->name ) . '</a>', $group_link, $group->name ); … … 1139 1137 1140 1138 if ( (int)$total_items > 1 ) { 1141 return apply_filters( 'bp_groups_multiple_member_promoted_to_admin_notification', '<a href="' . $bp ['loggedin_domain'] . $bp['groups']['slug']. '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('You were promoted to an admin in %d groups'), (int)$total_items ) . '</a>', $total_items );1139 return apply_filters( 'bp_groups_multiple_member_promoted_to_admin_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('You were promoted to an admin in %d groups'), (int)$total_items ) . '</a>', $total_items ); 1142 1140 } else { 1143 1141 return apply_filters( 'bp_groups_single_member_promoted_to_admin_notification', '<a href="' . $group_link . '">' . sprintf( __('You were promoted to an admin in the group %s'), $group->name ) . '</a>', $group_link, $group->name ); … … 1152 1150 1153 1151 if ( (int)$total_items > 1 ) { 1154 return apply_filters( 'bp_groups_multiple_member_promoted_to_mod_notification', '<a href="' . $bp ['loggedin_domain'] . $bp['groups']['slug']. '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('You were promoted to a mod in %d groups'), (int)$total_items ) . '</a>', $total_items );1152 return apply_filters( 'bp_groups_multiple_member_promoted_to_mod_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('You were promoted to a mod in %d groups'), (int)$total_items ) . '</a>', $total_items ); 1155 1153 } else { 1156 1154 return apply_filters( 'bp_groups_single_member_promoted_to_mod_notification', '<a href="' . $group_link . '">' . sprintf( __('You were promoted to a mod in the group %s'), $group->name ) . '</a>', $group_link, $group->name ); … … 1165 1163 1166 1164 if ( (int)$total_items > 1 ) { 1167 return apply_filters( 'bp_groups_multiple_group_invite_notification', '<a href="' . $bp ['loggedin_domain'] . $bp['groups']['slug']. '/invites" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __('You have %d new group invitations'), (int)$total_items ) . '</a>', $total_items );1165 return apply_filters( 'bp_groups_multiple_group_invite_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/invites" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __('You have %d new group invitations'), (int)$total_items ) . '</a>', $total_items ); 1168 1166 } else { 1169 return apply_filters( 'bp_groups_single_group_invite_notification', '<a href="' . $bp ['loggedin_domain'] . $bp['groups']['slug']. '/invites" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __('You have an invitation to the group: %s'), $group->name ) . '</a>', $group->name );1167 return apply_filters( 'bp_groups_single_group_invite_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/invites" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __('You have an invitation to the group: %s'), $group->name ) . '</a>', $group->name ); 1170 1168 } 1171 1169 break; … … 1207 1205 global $bp; 1208 1206 1209 $groups = BP_Groups_Member::get_group_ids( $bp ['current_userid'], $pag_num, $pag_page );1207 $groups = BP_Groups_Member::get_group_ids( $bp->displayed_user->id, $pag_num, $pag_page ); 1210 1208 1211 1209 return array( 'groups' => $groups['ids'], 'total' => $groups['total'] ); … … 1292 1290 bp_core_render_avatar_upload_form( '', true ); 1293 1291 } else { 1294 bp_core_render_avatar_cropper( $original, $canvas, null, null, false, $bp ['loggedin_domain']);1292 bp_core_render_avatar_cropper( $original, $canvas, null, null, false, $bp->loggedin_user->domain ); 1295 1293 } 1296 1294 } … … 1306 1304 global $bp; 1307 1305 1308 $src = $bp ['root_domain']. '/';1306 $src = $bp->root_domain . '/'; 1309 1307 1310 1308 $thumb_href = str_replace( ABSPATH, $src, stripslashes( $avatars['v1_out'] ) ); … … 1317 1315 global $bp; 1318 1316 1319 $src = $bp ['root_domain']. '/';1317 $src = $bp->root_domain . '/'; 1320 1318 1321 1319 $path = str_replace( $src, ABSPATH, stripslashes( $avatar ) ); … … 1348 1346 case '1': 1349 1347 if ( $_POST['group-name'] != '' && $_POST['group-desc'] != '' ) { 1350 $group_obj->creator_id = $bp ['loggedin_userid'];1348 $group_obj->creator_id = $bp->loggedin_user->id; 1351 1349 $group_obj->name = stripslashes($_POST['group-name']); 1352 1350 $group_obj->description = stripslashes($_POST['group-desc']); … … 1368 1366 1369 1367 // Save the creator as the group administrator 1370 $admin = new BP_Groups_Member( $bp ['loggedin_userid'], $group_obj->id );1368 $admin = new BP_Groups_Member( $bp->loggedin_user->id, $group_obj->id ); 1371 1369 $admin->is_admin = 1; 1372 1370 $admin->user_title = __('Group Admin', 'buddypress'); … … 1410 1408 } else { 1411 1409 /* Create the forum if enable_forum = 1 */ 1412 if ( function_exists( 'bp_forums_setup' ) && groups_get_groupmeta( $group_obj->id, 'forum_id' ) == '') {1410 if ( function_exists( 'bp_forums_setup' ) && '' == groups_get_groupmeta( $group_obj->id, 'forum_id' ) ) { 1413 1411 groups_new_group_forum(); 1414 1412 } … … 1471 1469 global $bp; 1472 1470 1473 if ( in_array( $slug, $bp ['groups']['forbidden_names']) ) {1471 if ( in_array( $slug, $bp->groups->forbidden_names ) ) { 1474 1472 $slug = $slug . '-' . rand(); 1475 1473 } … … 1574 1572 $invite->user_id = $user_id; 1575 1573 $invite->date_modified = time(); 1576 $invite->inviter_id = $bp ['loggedin_userid'];1574 $invite->inviter_id = $bp->loggedin_user->id; 1577 1575 $invite->is_confirmed = 0; 1578 1576 … … 1635 1633 1636 1634 if ( !$user_id ) 1637 $user_id = $bp ['loggedin_userid'];1635 $user_id = $bp->loggedin_user->id; 1638 1636 1639 1637 return BP_Groups_Member::get_invites( $user_id ); … … 1644 1642 1645 1643 // Send friend invites. 1646 $invited_users = groups_get_invites_for_group( $bp ['loggedin_userid'], $group_obj->id );1644 $invited_users = groups_get_invites_for_group( $bp->loggedin_user->id, $group_obj->id ); 1647 1645 1648 1646 for ( $i = 0; $i < count( $invited_users ); $i++ ) { … … 1652 1650 } 1653 1651 1654 groups_notification_group_invites( $group_obj->id, $invited_users, $bp ['loggedin_userid']);1652 groups_notification_group_invites( $group_obj->id, $invited_users, $bp->loggedin_user->id ); 1655 1653 1656 1654 do_action( 'groups_send_invites', $group_obj->id, $invited_users ); … … 1665 1663 1666 1664 if ( !$user_id ) 1667 $user_id = $bp ['loggedin_userid'];1665 $user_id = $bp->loggedin_user->id; 1668 1666 1669 1667 // Admins cannot leave a group, that is until promotion to admin support is implemented. … … 1675 1673 return false; 1676 1674 1677 do_action( 'groups_leave_group', $group_id, $bp ['loggedin_userid']);1675 do_action( 'groups_leave_group', $group_id, $bp->loggedin_user->id ); 1678 1676 1679 1677 /* Modify group member count */ … … 1687 1685 1688 1686 if ( !$user_id ) 1689 $user_id = $bp ['loggedin_userid'];1687 $user_id = $bp->loggedin_user->id; 1690 1688 1691 1689 $new_member = new BP_Groups_Member; … … 1708 1706 groups_update_groupmeta( $group_id, 'last_activity', time() ); 1709 1707 1710 do_action( 'groups_join_group', $group_id, $bp ['loggedin_userid']);1708 do_action( 'groups_join_group', $group_id, $bp->loggedin_user->id ); 1711 1709 1712 1710 return true; … … 1763 1761 global $bp; 1764 1762 1765 if ( $group_name == '' || $group_desc == '')1763 if ( empty( $group_name ) || empty( $group_desc ) ) 1766 1764 return false; 1767 1765 … … 1797 1795 /* If forums have been enabled, and a forum does not yet exist, we need to create one. */ 1798 1796 if ( $group->enable_forum ) { 1799 if ( function_exists( 'bp_forums_setup' ) && groups_get_groupmeta( $group->id, 'forum_id' ) == '') {1797 if ( function_exists( 'bp_forums_setup' ) && '' == groups_get_groupmeta( $group->id, 'forum_id' ) ) { 1800 1798 groups_new_group_forum( $group->id, $group->name, $group->description ); 1801 1799 } … … 1810 1808 global $bp; 1811 1809 1812 if ( !$bp ['is_item_admin'])1810 if ( !$bp->is_item_admin ) 1813 1811 return false; 1814 1812 … … 1823 1821 global $bp; 1824 1822 1825 if ( !$bp ['is_item_admin'])1823 if ( !$bp->is_item_admin ) 1826 1824 return false; 1827 1825 … … 1836 1834 global $bp; 1837 1835 1838 if ( !$bp ['is_item_admin'])1836 if ( !$bp->is_item_admin ) 1839 1837 return false; 1840 1838 … … 1849 1847 global $bp; 1850 1848 1851 if ( !$bp ['is_item_admin'])1849 if ( !$bp->is_item_admin ) 1852 1850 return false; 1853 1851 … … 1926 1924 global $bp, $wpdb; 1927 1925 1928 if ( $bp ['current_component'] == $bp['groups']['slug']&& isset( $_GET['random'] ) ) {1926 if ( $bp->current_component == $bp->groups->slug && isset( $_GET['random'] ) ) { 1929 1927 $group = groups_get_random_group(); 1930 1928 1931 bp_core_redirect( $bp ['root_domain'] . '/' . $bp['groups']['slug']. '/' . $group['groups'][0]->slug );1929 bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/' . $group['groups'][0]->slug ); 1932 1930 } 1933 1931 } … … 1938 1936 1939 1937 // Check the user is the group admin. 1940 if ( !$bp ['is_item_admin'])1938 if ( !$bp->is_item_admin ) 1941 1939 return false; 1942 1940 … … 1948 1946 1949 1947 // Remove the activity stream item 1950 groups_delete_activity( array( 'item_id' => $group_id, 'component_name' => 'groups', 'component_action' => 'created_group', 'user_id' => $bp ['loggedin_userid']) );1948 groups_delete_activity( array( 'item_id' => $group_id, 'component_name' => 'groups', 'component_action' => 'created_group', 'user_id' => $bp->loggedin_user->id ) ); 1951 1949 1952 1950 do_action( 'groups_delete_group', $group_id ); … … 1997 1995 1998 1996 if ( !$meta_key ) { 1999 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp ['groups']['table_name_groupmeta']. " WHERE group_id = %d", $group_id ) );1997 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d", $group_id ) ); 2000 1998 } else if ( !$meta_value ) { 2001 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp ['groups']['table_name_groupmeta']. " WHERE group_id = %d AND meta_key = %s AND meta_value = %s", $group_id, $meta_key, $meta_value ) );1999 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d AND meta_key = %s AND meta_value = %s", $group_id, $meta_key, $meta_value ) ); 2002 2000 } else { 2003 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp ['groups']['table_name_groupmeta']. " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key ) );2001 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key ) ); 2004 2002 } 2005 2003 … … 2028 2026 // $metas = array($user->$meta_key); 2029 2027 //else 2030 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM " . $bp ['groups']['table_name_groupmeta']. " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key) );2028 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key) ); 2031 2029 } else { 2032 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM " . $bp ['groups']['table_name_groupmeta']. " WHERE group_id = %d", $group_id) );2030 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d", $group_id) ); 2033 2031 } 2034 2032 … … 2066 2064 } 2067 2065 2068 $cur = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp ['groups']['table_name_groupmeta']. " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key ) );2066 $cur = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key ) ); 2069 2067 2070 2068 if ( !$cur ) { 2071 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp ['groups']['table_name_groupmeta']. " ( group_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", $group_id, $meta_key, $meta_value ) );2069 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp->groups->table_name_groupmeta . " ( group_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", $group_id, $meta_key, $meta_value ) ); 2072 2070 } else if ( $cur->meta_value != $meta_value ) { 2073 $wpdb->query( $wpdb->prepare( "UPDATE " . $bp ['groups']['table_name_groupmeta']. " SET meta_value = %s WHERE group_id = %d AND meta_key = %s", $meta_value, $group_id, $meta_key ) );2071 $wpdb->query( $wpdb->prepare( "UPDATE " . $bp->groups->table_name_groupmeta . " SET meta_value = %s WHERE group_id = %d AND meta_key = %s", $meta_value, $group_id, $meta_key ) ); 2074 2072 } else { 2075 2073 return false; … … 2088 2086 function groups_force_buddypress_theme( $template ) { 2089 2087 global $current_component, $current_action; 2090 global $is_member_page ;2091 2088 global $is_member_page, $bp; 2089 2092 2090 $groups_bp = groups_setup_globals(true); 2093 2091 2094 if ( $current_component != $groups_bp ['groups']['slug'])2092 if ( $current_component != $groups_bp->groups->slug ) 2095 2093 return $template; 2096 2094 2097 2095 $member_theme = get_site_option('active-member-theme'); 2098 2096 2099 if ( $member_theme == '')2097 if ( empty($member_theme) ) 2100 2098 $member_theme = 'buddypress-member'; 2101 2099 … … 2104 2102 bp_core_set_uri_globals(); 2105 2103 2106 if ( $current_component == $groups_bp ['groups']['slug'])2107 $is_single_group = BP_Groups_Group::group_exists( $current_action, $groups_bp ['groups']['table_name']);2104 if ( $current_component == $groups_bp->groups->slug ) 2105 $is_single_group = BP_Groups_Group::group_exists( $current_action, $groups_bp->groups->table_name ); 2108 2106 2109 2107 if ( $is_single_group ) { … … 2123 2121 global $bp, $is_single_group, $is_member_page, $current_component; 2124 2122 2125 if ( $current_component != $bp ['groups']['slug'])2123 if ( $current_component != $bp->groups->slug ) 2126 2124 return $stylesheet; 2127 2125 2128 2126 $member_theme = get_site_option('active-member-theme'); 2129 2127 2130 if ( $member_theme == '')2128 if ( empty( $member_theme ) ) 2131 2129 $member_theme = 'buddypress-member'; 2132 2130 -
trunk/bp-groups/bp-groups-ajax.php
r802 r1021 8 8 return false; 9 9 10 if ( !groups_is_user_admin( $bp ['loggedin_userid'], $_POST['group_id'] ) )11 return false; 12 13 if ( !friends_check_friendship( $bp ['loggedin_userid'], $_POST['friend_id'] ) )10 if ( !groups_is_user_admin( $bp->loggedin_user->id, $_POST['group_id'] ) ) 11 return false; 12 13 if ( !friends_check_friendship( $bp->loggedin_user->id, $_POST['friend_id'] ) ) 14 14 return false; 15 15 … … 25 25 echo '<span class="activity">' . sprintf( __( 'active %s ago', 'buddypress' ), $user->last_active ) . '</span>'; 26 26 echo '<div class="action"> 27 <a class="remove" href="' . $bp ['loggedin_domain'] . $bp['groups']['slug']. '/' . $_POST['group_id'] . '/invites/remove/' . $user->id . '" id="uid-' . $user->id . '">' . __( 'Remove Invite', 'buddypress' ) . '</a>27 <a class="remove" href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/' . $_POST['group_id'] . '/invites/remove/' . $user->id . '" id="uid-' . $user->id . '">' . __( 'Remove Invite', 'buddypress' ) . '</a> 28 28 </div>'; 29 29 echo '</li>'; … … 230 230 <div id="group-dir-count" class="pag-count"> 231 231 <?php echo sprintf( __( 'Viewing group %d to %d (%d total active groups)', 'buddypress' ), $from_num, $to_num, $groups['total'] ); ?> 232 <img id="ajax-loader-groups" src="<?php echo $bp ['core']['image_base']?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />232 <img id="ajax-loader-groups" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" /> 233 233 </div> 234 234 … … 287 287 global $bp; 288 288 289 if ( groups_is_user_banned( $bp ['loggedin_userid'], $_POST['gid'] ) )289 if ( groups_is_user_banned( $bp->loggedin_user->id, $_POST['gid'] ) ) 290 290 return false; 291 291 … … 296 296 return false; 297 297 298 if ( !groups_is_user_member( $bp ['loggedin_userid'], $group->id ) ) {298 if ( !groups_is_user_member( $bp->loggedin_user->id, $group->id ) ) { 299 299 300 300 if ( $group->status == 'public' ) { … … 305 305 } 306 306 } else if ( $group->status == 'private' ) { 307 if ( !groups_send_membership_request( $bp ['loggedin_userid'], $group->id ) ) {307 if ( !groups_send_membership_request( $bp->loggedin_user->id, $group->id ) ) { 308 308 _e( 'Error requesting membership', 'buddypress' ); 309 309 } else { -
trunk/bp-groups/bp-groups-classes.php
r917 r1021 41 41 global $wpdb, $bp; 42 42 43 $sql = $wpdb->prepare( "SELECT * FROM " . $bp['groups']['table_name'] . "WHERE id = %d", $this->id );43 $sql = $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name} WHERE id = %d", $this->id ); 44 44 $group = $wpdb->get_row($sql); 45 45 … … 93 93 if ( $this->id ) { 94 94 $sql = $wpdb->prepare( 95 "UPDATE " . $bp['groups']['table_name'] . "SET95 "UPDATE {$bp->groups->table_name} SET 96 96 creator_id = %d, 97 97 name = %s, … … 129 129 } else { 130 130 $sql = $wpdb->prepare( 131 "INSERT INTO " . $bp['groups']['table_name'] . "(131 "INSERT INTO {$bp->groups->table_name} ( 132 132 creator_id, 133 133 name, … … 185 185 global $wpdb, $bp; 186 186 187 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, is_admin, inviter_id, user_title, is_mod FROM " . $bp['groups']['table_name_members'] . "WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0 ORDER BY rand()", $this->id ) );187 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, is_admin, inviter_id, user_title, is_mod FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0 ORDER BY rand()", $this->id ) ); 188 188 } 189 189 … … 217 217 218 218 for ( $i = 0; $i < count($this->user_dataset); $i++ ) { 219 if ( $this->user_dataset[$i]->user_id == $bp ['loggedin_userid']) {219 if ( $this->user_dataset[$i]->user_id == $bp->loggedin_user->id ) { 220 220 return true; 221 221 } … … 247 247 // Delete the wire posts for this group if the wire is installed 248 248 if ( function_exists('bp_wire_install') ) { 249 BP_Wire_Post::delete_all_for_item( $this->id, $bp ['groups']['table_name_wire']);249 BP_Wire_Post::delete_all_for_item( $this->id, $bp->groups->table_name_wire ); 250 250 } 251 251 252 252 // Finally remove the group entry from the DB 253 if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['groups']['table_name'] . "WHERE id = %d", $this->id ) ) )253 if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name} WHERE id = %d", $this->id ) ) ) 254 254 return false; 255 255 … … 264 264 265 265 if ( !$table_name ) 266 $table_name = $bp ['groups']['table_name'];266 $table_name = $bp->groups->table_name; 267 267 268 268 if ( !$slug ) 269 269 return false; 270 270 271 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $table_nameWHERE slug = %s", $slug ) );271 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$table_name} WHERE slug = %s", $slug ) ); 272 272 } 273 273 … … 278 278 function get_invites( $user_id, $group_id ) { 279 279 global $wpdb, $bp; 280 return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM " . $bp['groups']['table_name_members'] . "WHERE group_id = %d and is_confirmed = 0 AND inviter_id = %d", $group_id, $user_id ) );280 return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d and is_confirmed = 0 AND inviter_id = %d", $group_id, $user_id ) ); 281 281 } 282 282 … … 290 290 291 291 // Get all the group ids for the current user's groups. 292 $gids = BP_Groups_Member::get_group_ids( $bp ['current_userid'], false, false, false, true );292 $gids = BP_Groups_Member::get_group_ids( $bp->displayed_user->id, false, false, false, true ); 293 293 294 294 if ( !$gids['groups'] ) … … 297 297 $gids = implode( ',', $gids['groups'] ); 298 298 299 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM " . $bp['groups']['table_name'] . "WHERE ( name LIKE '{$filter}%%' OR description LIKE '{$filter}%%' ) AND id IN ({$gids}) {$pag_sql}" ) );300 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['groups']['table_name'] . "WHERE ( name LIKE '{$filter}%%' OR description LIKE '{$filter}%%' ) AND id IN ({$gids})" ) );299 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM {$bp->groups->table_name} WHERE ( name LIKE '{$filter}%%' OR description LIKE '{$filter}%%' ) AND id IN ({$gids}) {$pag_sql}" ) ); 300 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->groups->table_name} WHERE ( name LIKE '{$filter}%%' OR description LIKE '{$filter}%%' ) AND id IN ({$gids})" ) ); 301 301 302 302 return array( 'groups' => $paged_groups, 'total' => $total_groups ); … … 317 317 } 318 318 319 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM " . $bp['groups']['table_name'] . "WHERE status != 'hidden' AND name LIKE '%%$filter%%' OR description LIKE '%%$filter%%' {$order_sql} {$pag_sql}" ) );320 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['groups']['table_name'] . "WHERE status != 'hidden' AND name LIKE '%%$filter%%' OR description LIKE '%%$filter%%'" ) );319 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM {$bp->groups->table_name} WHERE status != 'hidden' AND name LIKE '%%$filter%%' OR description LIKE '%%$filter%%' {$order_sql} {$pag_sql}" ) ); 320 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->groups->table_name} WHERE status != 'hidden' AND name LIKE '%%$filter%%' OR description LIKE '%%$filter%%'" ) ); 321 321 322 322 return array( 'groups' => $paged_groups, 'total' => $total_groups ); … … 326 326 global $wpdb, $bp; 327 327 328 return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM " . $bp['groups']['table_name'] . "WHERE slug = %s", $slug ) );328 return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM {$bp->groups->table_name} WHERE slug = %s", $slug ) ); 329 329 } 330 330 … … 332 332 global $wpdb, $bp; 333 333 334 return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM " . $bp['groups']['table_name'] . "WHERE id = %d", $group_id ) );334 return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM {$bp->groups->table_name} WHERE id = %d", $group_id ) ); 335 335 } 336 336 … … 338 338 global $wpdb, $bp; 339 339 340 $members = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['groups']['table_name_members'] . "WHERE group_id = %d", $group_id ) );340 $members = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d", $group_id ) ); 341 341 342 342 if ( !$members ) … … 349 349 global $wpdb, $bp; 350 350 351 return $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['groups']['table_name_members'] . "WHERE group_id = %d AND is_confirmed = 0", $group_id ) );351 return $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0", $group_id ) ); 352 352 } 353 353 … … 357 357 if ( $limit && $page ) { 358 358 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 359 $total_requests = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['groups']['table_name_members'] . "WHERE group_id = %d AND is_confirmed = 0 AND inviter_id = 0", $group_id ) );360 } 361 362 $paged_requests = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp['groups']['table_name_members'] . "WHERE group_id = %d AND is_confirmed = 0 AND inviter_id = 0{$pag_sql}", $group_id ) );359 $total_requests = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0 AND inviter_id = 0", $group_id ) ); 360 } 361 362 $paged_requests = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0 AND inviter_id = 0{$pag_sql}", $group_id ) ); 363 363 364 364 return array( 'requests' => $paged_requests, 'total' => $total_requests ); … … 370 370 if ( $limit && $page ) { 371 371 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 372 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp['groups']['table_name'] . "WHERE status != 'hidden' ORDER BY date_created DESC", $limit ) );373 } 374 375 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM " . $bp['groups']['table_name'] . "WHERE status != 'hidden' ORDER BY date_created DESC {$pag_sql}" ) );372 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->groups->table_name} WHERE status != 'hidden' ORDER BY date_created DESC", $limit ) ); 373 } 374 375 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM {$bp->groups->table_name} WHERE status != 'hidden' ORDER BY date_created DESC {$pag_sql}" ) ); 376 376 377 377 return array( 'groups' => $paged_groups, 'total' => $total_groups ); … … 383 383 if ( $limit && $page ) { 384 384 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 385 $total_groups = count( $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM " . $bp['groups']['table_name_groupmeta'] . " gm, " . $bp['groups']['table_name'] . "g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'last_activity' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC", $limit ) ) );386 } 387 388 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM " . $bp['groups']['table_name_groupmeta'] . " gm, " . $bp['groups']['table_name'] . "g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'last_activity' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC {$pag_sql}", $limit ) );385 $total_groups = count( $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name} g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'last_activity' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC", $limit ) ) ); 386 } 387 388 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name} g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'last_activity' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC {$pag_sql}", $limit ) ); 389 389 390 390 return array( 'groups' => $paged_groups, 'total' => $total_groups ); … … 396 396 if ( $limit && $page ) { 397 397 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 398 $total_groups = count( $wpdb->get_results( $wpdb->prepare( "SELECT gm.group_id FROM " . $bp['groups']['table_name_groupmeta'] . " gm, " . $bp['groups']['table_name'] . "g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'total_member_count' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC", $limit ) ) );399 } 400 401 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT gm.group_id FROM " . $bp['groups']['table_name_groupmeta'] . " gm, " . $bp['groups']['table_name'] . "g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'total_member_count' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC {$pag_sql}", $limit ) );398 $total_groups = count( $wpdb->get_results( $wpdb->prepare( "SELECT gm.group_id FROM {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name} g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'total_member_count' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC", $limit ) ) ); 399 } 400 401 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT gm.group_id FROM {$bp->groups->table_name_groupmeta} gm, {$bp->groups->table_name} g WHERE g.id = gm.group_id AND g.status != 'hidden' AND gm.meta_key = 'total_member_count' ORDER BY CONVERT(gm.meta_value, SIGNED) DESC {$pag_sql}", $limit ) ); 402 402 403 403 return array( 'groups' => $paged_groups, 'total' => $total_groups ); … … 423 423 switch ( $sort_by ) { 424 424 default: 425 $sql = $wpdb->prepare( "SELECT g.id as g.group_id, g.slug FROM " . $bp['groups']['table_name'] . "{$public_sql} {$hidden_sql} {$order_sql} {$pag_sql}" );425 $sql = $wpdb->prepare( "SELECT g.id as g.group_id, g.slug FROM {$bp->groups->table_name} {$public_sql} {$hidden_sql} {$order_sql} {$pag_sql}" ); 426 426 break; 427 427 case 'members': 428 $sql = $wpdb->prepare( "SELECT g.id as group_id, g.slug FROM " . $bp['groups']['table_name'] . " g, " . $bp['groups']['table_name_groupmeta'] . "gm WHERE g.id = gm.group_id AND gm.meta_key = 'total_member_count' {$hidden_sql} {$public_sql} ORDER BY CONVERT(gm.meta_value, SIGNED) {$order} {$pag_sql}" );428 $sql = $wpdb->prepare( "SELECT g.id as group_id, g.slug FROM {$bp->groups->table_name} g, {$bp->groups->table_name_groupmeta} gm WHERE g.id = gm.group_id AND gm.meta_key = 'total_member_count' {$hidden_sql} {$public_sql} ORDER BY CONVERT(gm.meta_value, SIGNED) {$order} {$pag_sql}" ); 429 429 break; 430 430 case 'last_active': 431 $sql = $wpdb->prepare( "SELECT g.id as group_id, g.slug FROM " . $bp['groups']['table_name'] . " g, " . $bp['groups']['table_name_groupmeta'] . "gm WHERE g.id = gm.group_id AND gm.meta_key = 'last_activity' {$hidden_sql} {$public_sql} ORDER BY CONVERT(gm.meta_value, SIGNED) {$order} {$pag_sql}" );431 $sql = $wpdb->prepare( "SELECT g.id as group_id, g.slug FROM {$bp->groups->table_name} g, {$bp->groups->table_name_groupmeta} gm WHERE g.id = gm.group_id AND gm.meta_key = 'last_activity' {$hidden_sql} {$public_sql} ORDER BY CONVERT(gm.meta_value, SIGNED) {$order} {$pag_sql}" ); 432 432 break; 433 433 } 434 434 } else { 435 $sql = $wpdb->prepare( "SELECT id as group_id, slug FROM " . $bp['groups']['table_name'] . "{$public_sql} {$hidden_sql} {$order_sql} {$pag_sql}" );435 $sql = $wpdb->prepare( "SELECT id as group_id, slug FROM {$bp->groups->table_name} {$public_sql} {$hidden_sql} {$order_sql} {$pag_sql}" ); 436 436 } 437 437 … … 452 452 if ( $limit && $page ) { 453 453 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 454 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp ['groups']['table_name']} WHERE name LIKE '$letter%%' {$hidden_sql} ORDER BY name ASC" ) );454 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->groups->table_name} WHERE name LIKE '$letter%%' {$hidden_sql} ORDER BY name ASC" ) ); 455 455 } 456 456 457 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM {$bp ['groups']['table_name']} WHERE name LIKE '$letter%%' {$hidden_sql} ORDER BY name ASC {$pag_sql}" ) );457 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM {$bp->groups->table_name} WHERE name LIKE '$letter%%' {$hidden_sql} ORDER BY name ASC {$pag_sql}" ) ); 458 458 459 459 return array( 'groups' => $paged_groups, 'total' => $total_groups ); … … 469 469 if ( $limit && $page ) { 470 470 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 471 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT id as group_id, slug FROM " . $bp['groups']['table_name'] . "WHERE status = 'public' {$hidden_sql} ORDER BY rand()" ) );472 } 473 474 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id, slug FROM " . $bp['groups']['table_name'] . "WHERE status = 'public' {$hidden_sql} ORDER BY rand() {$pag_sql}" ) );471 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT id as group_id, slug FROM {$bp->groups->table_name} WHERE status = 'public' {$hidden_sql} ORDER BY rand()" ) ); 472 } 473 474 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id, slug FROM {$bp->groups->table_name} WHERE status = 'public' {$hidden_sql} ORDER BY rand() {$pag_sql}" ) ); 475 475 476 476 return array( 'groups' => $paged_groups, 'total' => $total_groups ); … … 515 515 516 516 if ( $this->user_id && $this->group_id && !$this->id ) 517 $sql = $wpdb->prepare( "SELECT * FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND group_id = %d", $this->user_id, $this->group_id );517 $sql = $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $this->user_id, $this->group_id ); 518 518 519 519 if ( $this->id ) 520 $sql = $wpdb->prepare( "SELECT * FROM " . $bp['groups']['table_name_members'] . "WHERE id = %d", $this->id );520 $sql = $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name_members} WHERE id = %d", $this->id ); 521 521 522 522 $member = $wpdb->get_row($sql); … … 544 544 545 545 if ( $this->id ) { 546 $sql = $wpdb->prepare( "UPDATE " . $bp['groups']['table_name_members'] . "SET inviter_id = %d, is_admin = %d, is_mod = %d, is_banned = %d, user_title = %s, date_modified = FROM_UNIXTIME(%d), is_confirmed = %d, comments = %s, invite_sent = %d WHERE id = %d", $this->inviter_id, $this->is_admin, $this->is_mod, $this->is_banned, $this->user_title, $this->date_modified, $this->is_confirmed, $this->comments, $this->invite_sent, $this->id );547 } else { 548 $sql = $wpdb->prepare( "INSERT INTO " . $bp['groups']['table_name_members'] . "( user_id, group_id, inviter_id, is_admin, is_mod, is_banned, user_title, date_modified, is_confirmed, comments, invite_sent ) VALUES ( %d, %d, %d, %d, %d, %d, %s, FROM_UNIXTIME(%d), %d, %s, %d )", $this->user_id, $this->group_id, $this->inviter_id, $this->is_admin, $this->is_mod, $this->is_banned, $this->user_title, $this->date_modified, $this->is_confirmed, $this->comments, $this->invite_sent );546 $sql = $wpdb->prepare( "UPDATE {$bp->groups->table_name_members} SET inviter_id = %d, is_admin = %d, is_mod = %d, is_banned = %d, user_title = %s, date_modified = FROM_UNIXTIME(%d), is_confirmed = %d, comments = %s, invite_sent = %d WHERE id = %d", $this->inviter_id, $this->is_admin, $this->is_mod, $this->is_banned, $this->user_title, $this->date_modified, $this->is_confirmed, $this->comments, $this->invite_sent, $this->id ); 547 } else { 548 $sql = $wpdb->prepare( "INSERT INTO {$bp->groups->table_name_members} ( user_id, group_id, inviter_id, is_admin, is_mod, is_banned, user_title, date_modified, is_confirmed, comments, invite_sent ) VALUES ( %d, %d, %d, %d, %d, %d, %s, FROM_UNIXTIME(%d), %d, %s, %d )", $this->user_id, $this->group_id, $this->inviter_id, $this->is_admin, $this->is_mod, $this->is_banned, $this->user_title, $this->date_modified, $this->is_confirmed, $this->comments, $this->invite_sent ); 549 549 } 550 550 … … 617 617 global $wpdb, $bp; 618 618 619 $delete_result = $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND group_id = %d", $user_id, $group_id ) );619 $delete_result = $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $user_id, $group_id ) ); 620 620 621 621 return $delete_result; … … 630 630 // If the user is logged in and viewing their own groups, we can show hidden and private groupss 631 631 if ( bp_is_home() ) { 632 $group_sql = $wpdb->prepare( "SELECT DISTINCT group_id FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0{$pag_sql}", $user_id );633 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0", $user_id ) );634 } else { 635 $group_sql = $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . "g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0{$pag_sql}", $user_id );636 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . "g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0", $user_id ) );632 $group_sql = $wpdb->prepare( "SELECT DISTINCT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0{$pag_sql}", $user_id ); 633 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0", $user_id ) ); 634 } else { 635 $group_sql = $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0{$pag_sql}", $user_id ); 636 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0", $user_id ) ); 637 637 } 638 638 … … 653 653 // If the user is logged in and viewing their own groups, we can show hidden and private groups 654 654 if ( bp_is_home() ) { 655 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT group_id FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_confirmed = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );656 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_confirmed = 1 ORDER BY date_modified ASC", $user_id ) );657 } else { 658 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . "g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );659 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . "g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY date_modified ASC", $user_id ) );655 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_confirmed = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) ); 656 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_confirmed = 1 ORDER BY date_modified ASC", $user_id ) ); 657 } else { 658 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) ); 659 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY date_modified ASC", $user_id ) ); 660 660 } 661 661 … … 671 671 // If the user is logged in and viewing their own groups, we can show hidden and private groups 672 672 if ( bp_is_home() ) { 673 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name_groupmeta'] . "gm WHERE m.group_id = gm.group_id AND gm.meta_key = 'total_member_count' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY CONVERT( gm.meta_value, SIGNED ) DESC {$pag_sql}", $user_id ) );674 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name_groupmeta'] . "gm WHERE m.group_id = gm.group_id AND gm.meta_key = 'total_member_count' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY CONVERT( gm.meta_value, SIGNED ) DESC", $user_id ) );675 } else { 676 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m LEFT JOIN " . $bp['groups']['table_name'] . " g ON m.group_id = g.id LEFT JOIN " . $bp['groups']['table_name_groupmeta'] . "gm ON m.group_id = gm.group_id AND gm.meta_key = 'total_member_count' AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY CONVERT( gm.meta_value, SIGNED ) DESC {$pag_sql}", $user_id ) );677 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m LEFT JOIN " . $bp['groups']['table_name'] . " g ON m.group_id = g.id LEFT JOIN " . $bp['groups']['table_name_groupmeta'] . "gm ON m.group_id = gm.group_id AND gm.meta_key = 'total_member_count' AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY CONVERT( gm.meta_value, SIGNED ) DESC", $user_id ) );673 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name_groupmeta} gm WHERE m.group_id = gm.group_id AND gm.meta_key = 'total_member_count' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY CONVERT( gm.meta_value, SIGNED ) DESC {$pag_sql}", $user_id ) ); 674 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name_groupmeta} gm WHERE m.group_id = gm.group_id AND gm.meta_key = 'total_member_count' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY CONVERT( gm.meta_value, SIGNED ) DESC", $user_id ) ); 675 } else { 676 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name} g ON m.group_id = g.id LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id AND gm.meta_key = 'total_member_count' AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY CONVERT( gm.meta_value, SIGNED ) DESC {$pag_sql}", $user_id ) ); 677 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name} g ON m.group_id = g.id LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id AND gm.meta_key = 'total_member_count' AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_confirmed = 1 ORDER BY CONVERT( gm.meta_value, SIGNED ) DESC", $user_id ) ); 678 678 } 679 679 … … 689 689 // If the user is logged in and viewing their own groups, we can show hidden and private groups 690 690 if ( bp_is_home() ) { 691 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m LEFT JOIN " . $bp['groups']['table_name_groupmeta'] . "gm ON m.group_id = gm.group_id WHERE gm.meta_key = 'last_activity' AND user_id = %d AND inviter_id = 0 AND is_banned = 0 ORDER BY gm.meta_value DESC {$pag_sql}", $user_id ) );692 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m LEFT JOIN " . $bp['groups']['table_name_groupmeta'] . "gm ON m.group_id = gm.group_id WHERE gm.meta_key = 'last_activity' AND user_id = %d AND inviter_id = 0 AND is_banned = 0 ORDER BY gm.meta_value DESC {$pag_sql}", $user_id ) );693 } else { 694 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m LEFT JOIN " . $bp['groups']['table_name_groupmeta'] . " gm ON m.group_id = gm.group_id LEFT JOIN " . $bp['groups']['table_name'] . "g ON m.group_id = g.id WHERE gm.meta_key = 'last_activity' AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY gm.meta_value DESC {$pag_sql}", $user_id ) );695 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m LEFT JOIN " . $bp['groups']['table_name_groupmeta'] . " gm ON m.group_id = gm.group_id LEFT JOIN " . $bp['groups']['table_name'] . "g ON m.group_id = g.id WHERE gm.meta_key = 'last_activity' AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY gm.meta_value DESC", $user_id ) );691 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id WHERE gm.meta_key = 'last_activity' AND user_id = %d AND inviter_id = 0 AND is_banned = 0 ORDER BY gm.meta_value DESC {$pag_sql}", $user_id ) ); 692 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id WHERE gm.meta_key = 'last_activity' AND user_id = %d AND inviter_id = 0 AND is_banned = 0 ORDER BY gm.meta_value DESC {$pag_sql}", $user_id ) ); 693 } else { 694 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id LEFT JOIN {$bp->groups->table_name} g ON m.group_id = g.id WHERE gm.meta_key = 'last_activity' AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY gm.meta_value DESC {$pag_sql}", $user_id ) ); 695 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name_groupmeta} gm ON m.group_id = gm.group_id LEFT JOIN {$bp->groups->table_name} g ON m.group_id = g.id WHERE gm.meta_key = 'last_activity' AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY gm.meta_value DESC", $user_id ) ); 696 696 } 697 697 … … 707 707 // If the user is logged in and viewing their own groups, we can show hidden and private groups 708 708 if ( bp_is_home() ) { 709 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m LEFT JOIN " . $bp['groups']['table_name'] . "g ON m.group_id = g.id WHERE m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY g.name ASC {$pag_sql}", $user_id ) );710 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m LEFT JOIN " . $bp['groups']['table_name'] . "g ON m.group_id = g.id WHERE m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY g.name ASC", $user_id ) );711 } else { 712 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . "g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY g.name ASC {$pag_sql}", $user_id ) );713 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . "g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY g.name ASC", $user_id ) );709 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name} g ON m.group_id = g.id WHERE m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY g.name ASC {$pag_sql}", $user_id ) ); 710 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m LEFT JOIN {$bp->groups->table_name} g ON m.group_id = g.id WHERE m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY g.name ASC", $user_id ) ); 711 } else { 712 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY g.name ASC {$pag_sql}", $user_id ) ); 713 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 ORDER BY g.name ASC", $user_id ) ); 714 714 } 715 715 … … 725 725 // If the user is logged in and viewing their own groups, we can show hidden and private groups 726 726 if ( bp_is_home() ) { 727 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT group_id FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_admin = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );728 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_admin = 1 ORDER BY date_modified ASC", $user_id ) );729 } else { 730 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . "g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_admin = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );731 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . "g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_admin = 1 ORDER BY date_modified ASC", $user_id ) );727 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_admin = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) ); 728 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_admin = 1 ORDER BY date_modified ASC", $user_id ) ); 729 } else { 730 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_admin = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) ); 731 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_admin = 1 ORDER BY date_modified ASC", $user_id ) ); 732 732 } 733 733 … … 743 743 // If the user is logged in and viewing their own groups, we can show hidden and private groups 744 744 if ( bp_is_home() ) { 745 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT group_id FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_mod = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );746 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_mod = 1 ORDER BY date_modified ASC", $user_id ) );747 } else { 748 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . "g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_mod = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) );749 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . "g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_mod = 1 ORDER BY date_modified ASC", $user_id ) );745 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_mod = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) ); 746 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0 AND is_mod = 1 ORDER BY date_modified ASC", $user_id ) ); 747 } else { 748 $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_mod = 1 ORDER BY date_modified ASC {$pag_sql}", $user_id ) ); 749 $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0 AND m.is_mod = 1 ORDER BY date_modified ASC", $user_id ) ); 750 750 } 751 751 … … 757 757 758 758 if ( !$user_id ) 759 $user_id = $bp ['current_userid'];759 $user_id = $bp->displayed_user->id; 760 760 761 761 if ( bp_is_home() ) { 762 return $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0", $user_id ) );763 } else { 764 return $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . "g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0", $user_id ) );762 return $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(group_id) FROM {$bp->groups->table_name_members} WHERE user_id = %d AND inviter_id = 0 AND is_banned = 0", $user_id ) ); 763 } else { 764 return $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.inviter_id = 0 AND m.is_banned = 0", $user_id ) ); 765 765 } 766 766 } … … 769 769 global $wpdb, $bp; 770 770 771 $group_ids = $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d and is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id ) );771 $group_ids = $wpdb->get_results( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d and is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id ) ); 772 772 773 773 return $group_ids; … … 780 780 return false; 781 781 782 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id, $group_id ) );782 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id, $group_id ) ); 783 783 } 784 784 … … 789 789 return false; 790 790 791 return $wpdb->query( $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND group_id = %d AND is_admin = 1 AND is_banned = 0", $user_id, $group_id ) );791 return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_admin = 1 AND is_banned = 0", $user_id, $group_id ) ); 792 792 } 793 793 … … 798 798 return false; 799 799 800 return $wpdb->query( $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND group_id = %d AND is_mod = 1 AND is_banned = 0", $user_id, $group_id ) );800 return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_mod = 1 AND is_banned = 0", $user_id, $group_id ) ); 801 801 } 802 802 … … 807 807 return false; 808 808 809 return $wpdb->query( $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND group_id = %d AND is_confirmed = 1 AND is_banned = 0", $user_id, $group_id ) );809 return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 1 AND is_banned = 0", $user_id, $group_id ) ); 810 810 } 811 811 … … 816 816 return false; 817 817 818 return $wpdb->get_var( $wpdb->prepare( "SELECT is_banned FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND group_id = %d", $user_id, $group_id ) );818 return $wpdb->get_var( $wpdb->prepare( "SELECT is_banned FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $user_id, $group_id ) ); 819 819 } 820 820 … … 825 825 return false; 826 826 827 return $wpdb->query( $wpdb->prepare( "SELECT id FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND is_banned = 0 AND inviter_id = 0", $user_id, $group_id ) );827 return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND is_banned = 0 AND inviter_id = 0", $user_id, $group_id ) ); 828 828 } 829 829 … … 833 833 // If the user is logged in and viewing their random groups, we can show hidden and private groups 834 834 if ( bp_is_home() ) { 835 return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT group_id FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d AND is_confirmed = 1 AND is_banned = 0 ORDER BY rand() LIMIT $total_groups", $user_id ) );836 } else { 837 return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM " . $bp['groups']['table_name_members'] . " m, " . $bp['groups']['table_name'] . "g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0 ORDER BY rand() LIMIT $total_groups", $user_id ) );835 return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND is_confirmed = 1 AND is_banned = 0 ORDER BY rand() LIMIT $total_groups", $user_id ) ); 836 } else { 837 return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0 ORDER BY rand() LIMIT $total_groups", $user_id ) ); 838 838 } 839 839 } … … 842 842 global $bp, $wpdb; 843 843 844 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM " . $bp['groups']['table_name_members'] . "WHERE group_id = %d AND is_admin = 1 AND is_banned = 0", $group_id ) );844 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_admin = 1 AND is_banned = 0", $group_id ) ); 845 845 } 846 846 … … 848 848 global $bp, $wpdb; 849 849 850 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM " . $bp['groups']['table_name_members'] . "WHERE group_id = %d AND is_mod = 1 AND is_banned = 0", $group_id ) );850 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_mod = 1 AND is_banned = 0", $group_id ) ); 851 851 } 852 852 … … 863 863 $banned_sql = $wpdb->prepare( " AND is_banned = 0" ); 864 864 865 $members = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM " . $bp['groups']['table_name_members'] . "WHERE group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql} {$pag_sql}", $group_id ) );865 $members = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql} {$pag_sql}", $group_id ) ); 866 866 867 867 if ( !$members ) … … 871 871 $total_member_count = count($members); 872 872 else 873 $total_member_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(user_id) FROM " . $bp['groups']['table_name_members'] . "WHERE group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql}", $group_id ) );873 $total_member_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(user_id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_sql}", $group_id ) ); 874 874 875 875 return array( 'members' => $members, 'count' => $total_member_count ); … … 879 879 global $wpdb, $bp; 880 880 881 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['groups']['table_name_members'] . "WHERE user_id = %d", $user_id ) );881 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d", $user_id ) ); 882 882 } 883 883 } -
trunk/bp-groups/bp-groups-cssjs.php
r930 r1021 9 9 global $bp; 10 10 11 if ( $bp ['current_component'] == $bp['groups']['slug'])11 if ( $bp->current_component == $bp->groups->slug ) 12 12 wp_enqueue_script( 'bp-groups-js', site_url( MUPLUGINDIR . '/bp-groups/js/general.js' ) ); 13 13 } … … 23 23 global $bp, $create_group_step; 24 24 25 if ( $create_group_step == '3' || ( $bp ['current_component'] == $bp['groups']['slug'] && $bp['action_variables'][0] == 'group-avatar' ) ) {25 if ( $create_group_step == '3' || ( $bp->current_component == $bp->groups->slug && $bp->action_variables[0] == 'group-avatar' ) ) { 26 26 wp_enqueue_script('jquery'); 27 27 wp_enqueue_script('prototype'); -
trunk/bp-groups/bp-groups-notifications.php
r884 r1021 7 7 return false; 8 8 9 $wire_post = new BP_Wire_Post( $bp ['groups']['table_name_wire'], $wire_post_id );9 $wire_post = new BP_Wire_Post( $bp->groups->table_name_wire, $wire_post_id ); 10 10 $group = new BP_Groups_Group( $group_id, false, true ); 11 11 … … 24 24 $to = $ud->user_email; 25 25 26 $wire_link = site_url() . '/' . $bp ['groups']['slug']. '/' . $group->slug . '/wire';27 $group_link = site_url() . '/' . $bp ['groups']['slug']. '/' . $group->slug;26 $wire_link = site_url() . '/' . $bp->groups->slug . '/' . $group->slug . '/wire'; 27 $group_link = site_url() . '/' . $bp->groups->slug . '/' . $group->slug; 28 28 $settings_link = site_url() . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/settings/notifications'; 29 29 … … 65 65 $to = $ud->user_email; 66 66 67 $group_link = site_url() . '/' . $bp ['groups']['slug']. '/' . $group->slug;67 $group_link = site_url() . '/' . $bp->groups->slug . '/' . $group->slug; 68 68 $settings_link = site_url() . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/settings/notifications'; 69 69 … … 239 239 $settings_link = site_url() . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/settings/notifications'; 240 240 $invited_link = site_url() . '/' . MEMBERS_SLUG . '/' . $invited_ud->user_login; 241 $invites_link = $invited_link . '/' . $bp ['groups']['slug']. '/invites';241 $invites_link = $invited_link . '/' . $bp->groups->slug . '/invites'; 242 242 243 243 // Set up and send the message -
trunk/bp-groups/bp-groups-templatetags.php
r1015 r1021 28 28 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $groups_per_page; 29 29 30 if ( ( $bp ['current_action'] == 'my-groups' && $_REQUEST['group-filter-box'] == '' ) || ( !$bp['current_action'] && !isset($_REQUEST['page']) && $_REQUEST['group-filter-box'] == '') ) {31 32 $order = $bp ['action_variables'][0];30 if ( ( $bp->current_action == 'my-groups' && empty( $_REQUEST['group-filter-box'] ) ) || ( !$bp->current_action && !isset($_REQUEST['page']) && empty( $_REQUEST['group-filter-box'] ) ) ) { 31 32 $order = $bp->action_variables[0]; 33 33 34 34 if ( $order == 'recently-joined' ) { 35 $this->groups = groups_get_recently_joined_for_user( $bp ['current_userid'], $this->pag_num, $this->pag_page );35 $this->groups = groups_get_recently_joined_for_user( $bp->displayed_user->id, $this->pag_num, $this->pag_page ); 36 36 } else if ( $order == 'most-popular' ) { 37 $this->groups = groups_get_most_popular_for_user( $bp ['current_userid'], $this->pag_num, $this->pag_page );37 $this->groups = groups_get_most_popular_for_user( $bp->displayed_user->id, $this->pag_num, $this->pag_page ); 38 38 } else if ( $order == 'admin-of' ) { 39 $this->groups = groups_get_user_is_admin_of( $bp ['current_userid'], $this->pag_num, $this->pag_page );39 $this->groups = groups_get_user_is_admin_of( $bp->displayed_user->id, $this->pag_num, $this->pag_page ); 40 40 } else if ( $order == 'mod-of' ) { 41 $this->groups = groups_get_user_is_mod_of( $bp ['current_userid'], $this->pag_num, $this->pag_page );41 $this->groups = groups_get_user_is_mod_of( $bp->displayed_user->id, $this->pag_num, $this->pag_page ); 42 42 } else if ( $order == 'alphabetically' ) { 43 $this->groups = groups_get_alphabetically_for_user( $bp ['current_userid'], $this->pag_num, $this->pag_page );43 $this->groups = groups_get_alphabetically_for_user( $bp->displayed_user->id, $this->pag_num, $this->pag_page ); 44 44 } else { 45 $this->groups = groups_get_recently_active_for_user( $bp ['current_userid'], $this->pag_num, $this->pag_page );45 $this->groups = groups_get_recently_active_for_user( $bp->displayed_user->id, $this->pag_num, $this->pag_page ); 46 46 } 47 47 … … 50 50 $this->group_count = count($this->groups); 51 51 52 } else if ( ( $bp ['current_action'] == 'my-groups' && $_REQUEST['group-filter-box'] != '' ) || ( !$bp['current_action']&& !isset($_REQUEST['page']) && $_REQUEST['group-filter-box'] != '' ) ) {52 } else if ( ( $bp->current_action == 'my-groups' && $_REQUEST['group-filter-box'] != '' ) || ( !$bp->current_action && !isset($_REQUEST['page']) && $_REQUEST['group-filter-box'] != '' ) ) { 53 53 54 54 $this->groups = groups_filter_user_groups( $_REQUEST['group-filter-box'], $this->pag_num, $this->pag_page ); … … 57 57 $this->group_count = count($this->groups); 58 58 59 } else if ( $bp ['current_action']== 'invites' ) {59 } else if ( $bp->current_action == 'invites' ) { 60 60 61 61 $this->groups = groups_get_invites_for_user(); … … 83 83 $this->single_group = true; 84 84 85 $group = new stdClass ();85 $group = new stdClass; 86 86 $group->group_id = BP_Groups_Group::get_id_from_slug($group_slug); 87 87 … … 92 92 } else { 93 93 94 $this->groups = groups_get_user_groups( $bp ['current_userid'], $this->pag_num, $this->pag_page );94 $this->groups = groups_get_user_groups( $bp->displayed_user->id, $this->pag_num, $this->pag_page ); 95 95 $this->total_group_count = (int)$this->groups['total']; 96 96 $this->groups = $this->groups['groups']; … … 167 167 168 168 if ( !$is_single_group ) { 169 $groups_template = new BP_Groups_Template( $bp ['current_userid'], false, $groups_per_page );169 $groups_template = new BP_Groups_Template( $bp->displayed_user->id, false, $groups_per_page ); 170 170 } else { 171 $groups_template = new BP_Groups_Template( $bp ['current_userid'], $group_obj->slug, $groups_per_page );171 $groups_template = new BP_Groups_Template( $bp->displayed_user->id, $group_obj->slug, $groups_per_page ); 172 172 } 173 173 … … 191 191 return true; 192 192 } else { 193 if ( groups_is_user_member( $bp ['loggedin_userid'], $groups_template->group->id ) ) {193 if ( groups_is_user_member( $bp->loggedin_user->id, $groups_template->group->id ) ) { 194 194 return true; 195 195 } … … 202 202 global $groups_template; 203 203 204 if ( $groups_template->group->news == '')204 if ( empty( $groups_template->group->news ) ) 205 205 return false; 206 206 … … 265 265 $last_active = groups_get_groupmeta( $groups_template->group->id, 'last_activity' ); 266 266 267 if ( $last_active == '')267 if ( empty( $last_active ) ) 268 268 _e( 'not yet active', 'buddypress' ); 269 269 else … … 278 278 279 279 if ( $echo ) 280 echo apply_filters( 'bp_group_permalink', $bp ['root_domain'] . '/' . $bp['groups']['slug']. '/' . $group_obj->slug );280 echo apply_filters( 'bp_group_permalink', $bp->root_domain . '/' . $bp->groups->slug . '/' . $group_obj->slug ); 281 281 else 282 return apply_filters( 'bp_group_permalink', $bp ['root_domain'] . '/' . $bp['groups']['slug']. '/' . $group_obj->slug );282 return apply_filters( 'bp_group_permalink', $bp->root_domain . '/' . $bp->groups->slug . '/' . $group_obj->slug ); 283 283 } 284 284 … … 290 290 291 291 if ( $echo ) 292 echo apply_filters( 'bp_group_admin_permalink', $bp ['root_domain'] . '/' . $bp['groups']['slug']. '/' . $group_obj->slug . '/admin' );292 echo apply_filters( 'bp_group_admin_permalink', $bp->root_domain . '/' . $bp->groups->slug . '/' . $group_obj->slug . '/admin' ); 293 293 else 294 return apply_filters( 'bp_group_admin_permalink', $bp ['root_domain'] . '/' . $bp['groups']['slug']. '/' . $group_obj->slug . '/admin' );294 return apply_filters( 'bp_group_admin_permalink', $bp->root_domain . '/' . $bp->groups->slug . '/' . $group_obj->slug . '/admin' ); 295 295 } 296 296 … … 480 480 global $groups_template, $bp; 481 481 482 if ( $bp ['current_action'] == 'my-groups' || !$bp['current_action']) {483 $action = $bp ['loggedin_domain'] . $bp['groups']['slug']. '/my-groups/search/';482 if ( $bp->current_action == 'my-groups' || !$bp->current_action ) { 483 $action = $bp->loggedin_user->domain . $bp->groups->slug . '/my-groups/search/'; 484 484 $label = __('Filter Groups', 'buddypress'); 485 485 $name = 'group-filter-box'; 486 486 } else { 487 $action = $bp ['loggedin_domain'] . $bp['groups']['slug']. '/group-finder/search/';487 $action = $bp->loggedin_user->domain . $bp->groups->slug . '/group-finder/search/'; 488 488 $label = __('Find a Group', 'buddypress'); 489 489 $name = 'groupfinder-search-box'; 490 $value = $bp ['action_variables'][0];490 $value = $bp->action_variables[0]; 491 491 } 492 492 ?> 493 493 <form action="<?php echo $action ?>" id="group-search-form" method="post"> 494 <label for="<?php echo $name ?>" id="<?php echo $name ?>-label"><?php echo $label ?> <img id="ajax-loader" src="<?php echo $bp ['groups']['image_base']?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></label>494 <label for="<?php echo $name ?>" id="<?php echo $name ?>-label"><?php echo $label ?> <img id="ajax-loader" src="<?php echo $bp->groups->image_base ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></label> 495 495 <input type="search" name="<?php echo $name ?>" id="<?php echo $name ?>" value="<?php echo $value ?>"<?php echo $disabled ?> /> 496 496 <?php if ( function_exists('wp_nonce_field') ) … … 504 504 global $bp; 505 505 506 if ( !groups_total_groups_for_user( $bp ['current_userid']) )506 if ( !groups_total_groups_for_user( $bp->displayed_user->id ) ) 507 507 return true; 508 508 … … 715 715 global $bp, $groups_template; 716 716 717 $current_tab = $bp ['action_variables'][0];717 $current_tab = $bp->action_variables[0]; 718 718 ?> 719 <?php if ( $bp ['is_item_admin'] || $bp['is_item_mod']) { ?>720 <li<?php if ( $current_tab == 'edit-details' || $current_tab == '' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['root_domain'] . '/' . $bp['groups']['slug']?>/<?php echo $groups_template->group->slug ?>/admin/edit-details"><?php _e('Edit Details', 'buddypress') ?></a></li>719 <?php if ( $bp->is_item_admin || $bp->is_item_mod ) { ?> 720 <li<?php if ( $current_tab == 'edit-details' || empty( $current_tab ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $groups_template->group->slug ?>/admin/edit-details"><?php _e('Edit Details', 'buddypress') ?></a></li> 721 721 <?php } ?> 722 722 723 <?php if ( $bp ['is_item_admin']) { ?>724 <li<?php if ( $current_tab == 'group-settings' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp ['root_domain'] . '/' . $bp['groups']['slug']?>/<?php echo $groups_template->group->slug ?>/admin/group-settings"><?php _e('Group Settings', 'buddypress') ?></a></li>723 <?php if ( $bp->is_item_admin ) { ?> 724 <li<?php if ( $current_tab == 'group-settings' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $groups_template->group->slug ?>/admin/group-settings"><?php _e('Group Settings', 'buddypress') ?></a></li> 725 725 <?php } ?> 726 726 727 <?php if ( $bp ['is_item_admin']) { ?>728 <li<?php if ( $current_tab == 'group-avatar' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp ['root_domain'] . '/' . $bp['groups']['slug']?>/<?php echo $groups_template->group->slug ?>/admin/group-avatar"><?php _e('Group Avatar', 'buddypress') ?></a></li>727 <?php if ( $bp->is_item_admin ) { ?> 728 <li<?php if ( $current_tab == 'group-avatar' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $groups_template->group->slug ?>/admin/group-avatar"><?php _e('Group Avatar', 'buddypress') ?></a></li> 729 729 <?php } ?> 730 730 731 <?php if ( $bp ['is_item_admin']) { ?>732 <li<?php if ( $current_tab == 'manage-members' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp ['root_domain'] . '/' . $bp['groups']['slug']?>/<?php echo $groups_template->group->slug ?>/admin/manage-members"><?php _e('Manage Members', 'buddypress') ?></a></li>731 <?php if ( $bp->is_item_admin ) { ?> 732 <li<?php if ( $current_tab == 'manage-members' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $groups_template->group->slug ?>/admin/manage-members"><?php _e('Manage Members', 'buddypress') ?></a></li> 733 733 <?php } ?> 734 734 735 <?php if ( $bp ['is_item_admin']&& $groups_template->group->status == 'private' ) : ?>736 <li<?php if ( $current_tab == 'membership-requests' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp ['root_domain'] . '/' . $bp['groups']['slug']?>/<?php echo $groups_template->group->slug ?>/admin/membership-requests"><?php _e('Membership Requests', 'buddypress') ?></a></li>735 <?php if ( $bp->is_item_admin && $groups_template->group->status == 'private' ) : ?> 736 <li<?php if ( $current_tab == 'membership-requests' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $groups_template->group->slug ?>/admin/membership-requests"><?php _e('Membership Requests', 'buddypress') ?></a></li> 737 737 <?php endif; ?> 738 738 739 <?php if ( $bp ['is_item_admin']) { ?>740 <li<?php if ( $current_tab == 'delete-group' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp ['root_domain'] . '/' . $bp['groups']['slug']?>/<?php echo $groups_template->group->slug ?>/admin/delete-group"><?php _e('Delete Group', 'buddypress') ?></a></li>739 <?php if ( $bp->is_item_admin ) { ?> 740 <li<?php if ( $current_tab == 'delete-group' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $groups_template->group->slug ?>/admin/delete-group"><?php _e('Delete Group', 'buddypress') ?></a></li> 741 741 <?php } ?> 742 742 … … 763 763 $group = $groups_template->group; 764 764 765 if ( groups_check_for_membership_request( $bp ['loggedin_userid'], $group->id ) )765 if ( groups_check_for_membership_request( $bp->loggedin_user->id, $group->id ) ) 766 766 return true; 767 767 … … 772 772 global $bp, $create_group_step, $completed_to_step; 773 773 ?> 774 <li<?php if ( $create_group_step == '1' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp ['current_domain'] . $bp['groups']['slug']?>/create/step/1">1. <?php _e('Group Details', 'buddypress') ?></a></li>775 <li<?php if ( $create_group_step == '2' ) : ?> class="current"<?php endif; ?>><?php if ( $completed_to_step > 0 ) { ?><a href="<?php echo $bp ['current_domain'] . $bp['groups']['slug']?>/create/step/2">2. <?php _e('Group Settings', 'buddypress') ?></a><?php } else { ?><span>2. <?php _e('Group Settings', 'buddypress') ?></span><?php } ?></li>776 <li<?php if ( $create_group_step == '3' ) : ?> class="current"<?php endif; ?>><?php if ( $completed_to_step > 1 ) { ?><a href="<?php echo $bp ['current_domain'] . $bp['groups']['slug']?>/create/step/3">3. <?php _e('Group Avatar', 'buddypress') ?></a><?php } else { ?><span>3. <?php _e('Group Avatar', 'buddypress') ?></span><?php } ?></li>777 <li<?php if ( $create_group_step == '4' ) : ?> class="current"<?php endif; ?>><?php if ( $completed_to_step > 2 ) { ?><a href="<?php echo $bp ['current_domain'] . $bp['groups']['slug']?>/create/step/4">4. <?php _e('Invite Members', 'buddypress') ?></a><?php } else { ?><span>4. <?php _e('Invite Members', 'buddypress') ?></span><?php } ?></li>774 <li<?php if ( $create_group_step == '1' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/create/step/1">1. <?php _e('Group Details', 'buddypress') ?></a></li> 775 <li<?php if ( $create_group_step == '2' ) : ?> class="current"<?php endif; ?>><?php if ( $completed_to_step > 0 ) { ?><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/create/step/2">2. <?php _e('Group Settings', 'buddypress') ?></a><?php } else { ?><span>2. <?php _e('Group Settings', 'buddypress') ?></span><?php } ?></li> 776 <li<?php if ( $create_group_step == '3' ) : ?> class="current"<?php endif; ?>><?php if ( $completed_to_step > 1 ) { ?><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/create/step/3">3. <?php _e('Group Avatar', 'buddypress') ?></a><?php } else { ?><span>3. <?php _e('Group Avatar', 'buddypress') ?></span><?php } ?></li> 777 <li<?php if ( $create_group_step == '4' ) : ?> class="current"<?php endif; ?>><?php if ( $completed_to_step > 2 ) { ?><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/create/step/4">4. <?php _e('Invite Members', 'buddypress') ?></a><?php } else { ?><span>4. <?php _e('Invite Members', 'buddypress') ?></span><?php } ?></li> 778 778 <?php 779 779 do_action( 'groups_creation_tabs' ); … … 807 807 808 808 ?> 809 <form action="<?php echo $bp ['current_domain'] . $bp['groups']['slug']?>/create/step/<?php echo $create_group_step ?>" method="post" id="create-group-form" class="standard-form" enctype="multipart/form-data">809 <form action="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/create/step/<?php echo $create_group_step ?>" method="post" id="create-group-form" class="standard-form" enctype="multipart/form-data"> 810 810 <?php switch( $create_group_step ) { 811 811 case '1': ?> … … 907 907 908 908 if ( function_exists('friends_install') ) { 909 if ( friends_get_friend_count_for_user( $bp ['loggedin_userid']) ) {909 if ( friends_get_friend_count_for_user( $bp->loggedin_user->id ) ) { 910 910 bp_group_send_invite_form( $group_obj ); 911 911 } else { … … 936 936 return false; 937 937 938 $friends = friends_get_friends_invite_list( $bp ['loggedin_userid'], $group_obj->id );938 $friends = friends_get_friends_invite_list( $bp->loggedin_user->id, $group_obj->id ); 939 939 940 940 if ( $friends ) { 941 $invites = groups_get_invites_for_group( $bp ['loggedin_userid'], $group_obj->id );941 $invites = groups_get_invites_for_group( $bp->loggedin_user->id, $group_obj->id ); 942 942 943 943 ?> … … 968 968 global $bp, $create_group_step, $completed_to_step; 969 969 ?> 970 <li<?php if ( !isset($bp ['action_variables'][0]) || $bp['action_variables'][0] == 'recently-active' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug']?>/my-groups/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li>971 <li<?php if ( $bp ['action_variables'][0] == 'recently-joined' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug']?>/my-groups/recently-joined"><?php _e( 'Recently Joined', 'buddypress' ) ?></a></li>972 <li<?php if ( $bp ['action_variables'][0] == 'most-popular' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug']?>/my-groups/most-popular""><?php _e( 'Most Popular', 'buddypress' ) ?></a></li>973 <li<?php if ( $bp ['action_variables'][0] == 'admin-of' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug']?>/my-groups/admin-of""><?php _e( 'Administrator Of', 'buddypress' ) ?></a></li>974 <li<?php if ( $bp ['action_variables'][0] == 'mod-of' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug']?>/my-groups/mod-of""><?php _e( 'Moderator Of', 'buddypress' ) ?></a></li>975 <li<?php if ( $bp ['action_variables'][0] == 'alphabetically' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp['current_domain'] . $bp['groups']['slug']?>/my-groups/alphabetically""><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li>970 <li<?php if ( !isset($bp->action_variables[0]) || $bp->action_variables[0] == 'recently-active' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li> 971 <li<?php if ( $bp->action_variables[0] == 'recently-joined' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/recently-joined"><?php _e( 'Recently Joined', 'buddypress' ) ?></a></li> 972 <li<?php if ( $bp->action_variables[0] == 'most-popular' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/most-popular""><?php _e( 'Most Popular', 'buddypress' ) ?></a></li> 973 <li<?php if ( $bp->action_variables[0] == 'admin-of' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/admin-of""><?php _e( 'Administrator Of', 'buddypress' ) ?></a></li> 974 <li<?php if ( $bp->action_variables[0] == 'mod-of' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/mod-of""><?php _e( 'Moderator Of', 'buddypress' ) ?></a></li> 975 <li<?php if ( $bp->action_variables[0] == 'alphabetically' ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/alphabetically""><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li> 976 976 977 977 <?php … … 982 982 global $bp; 983 983 984 $current_filter = $bp ['action_variables'][0];984 $current_filter = $bp->action_variables[0]; 985 985 986 986 switch ( $current_filter ) { … … 1009 1009 global $bp, $groups_template; 1010 1010 1011 if ( groups_is_user_member( $bp ['loggedin_userid'], $groups_template->group->id ) )1011 if ( groups_is_user_member( $bp->loggedin_user->id, $groups_template->group->id ) ) 1012 1012 return true; 1013 1013 … … 1018 1018 global $groups_template, $bp; 1019 1019 1020 echo apply_filters( 'bp_group_accept_invite_link', $bp ['loggedin_domain'] . $bp['groups']['slug']. '/invites/accept/' . $groups_template->group->id );1020 echo apply_filters( 'bp_group_accept_invite_link', $bp->loggedin_user->domain . $bp->groups->slug . '/invites/accept/' . $groups_template->group->id ); 1021 1021 } 1022 1022 … … 1024 1024 global $groups_template, $bp; 1025 1025 1026 echo apply_filters( 'bp_group_reject_invite_link', $bp ['loggedin_domain'] . $bp['groups']['slug']. '/invites/reject/' . $groups_template->group->id );1026 echo apply_filters( 'bp_group_reject_invite_link', $bp->loggedin_user->domain . $bp->groups->slug . '/invites/reject/' . $groups_template->group->id ); 1027 1027 } 1028 1028 … … 1033 1033 return false; 1034 1034 1035 if ( !friends_check_user_has_friends( $bp ['loggedin_userid'] ) || !friends_count_invitable_friends( $bp['loggedin_userid'], $groups_template->group->id ) )1035 if ( !friends_check_user_has_friends( $bp->loggedin_user->id ) || !friends_count_invitable_friends( $bp->loggedin_user->id, $groups_template->group->id ) ) 1036 1036 return false; 1037 1037 … … 1058 1058 ?> 1059 1059 <div class="left-menu"> 1060 <h4><?php _e( 'Select Friends', 'buddypress' ) ?> <img id="ajax-loader" src="<?php echo $bp ['groups']['image_base']?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></h4>1060 <h4><?php _e( 'Select Friends', 'buddypress' ) ?> <img id="ajax-loader" src="<?php echo $bp->groups->image_base ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /></h4> 1061 1061 <?php bp_group_list_invite_friends() ?> 1062 1062 <?php wp_nonce_field( 'invite_user' ) ?> … … 1070 1070 </div> 1071 1071 1072 <?php $invites = groups_get_invites_for_group( $bp ['loggedin_userid'], $group_obj->id ) ?>1072 <?php $invites = groups_get_invites_for_group( $bp->loggedin_user->id, $group_obj->id ) ?> 1073 1073 1074 1074 <ul id="friend-list" class="item-list"> … … 1081 1081 <span class="activity"><?php echo $user->last_active ?></span> 1082 1082 <div class="action"> 1083 <a class="remove" href="<?php echo site_url() . $bp ['groups']['slug']. '/' . $group_obj->id . '/invites/remove/' . $user->id ?>" id="uid-<?php echo $user->id ?>"><?php _e( 'Remove Invite', 'buddypress' ) ?></a>1083 <a class="remove" href="<?php echo site_url() . $bp->groups->slug . '/' . $group_obj->id . '/invites/remove/' . $user->id ?>" id="uid-<?php echo $user->id ?>"><?php _e( 'Remove Invite', 'buddypress' ) ?></a> 1084 1084 </div> 1085 1085 </li> … … 1097 1097 <img src="<?php echo $group_obj->avatar_full ?>" alt="Group Avatar" class="avatar" /> 1098 1098 <?php } else { ?> 1099 <img src="<?php echo $bp ['groups']['image_base']. '/none.gif' ?>" alt="No Group Avatar" class="avatar" />1099 <img src="<?php echo $bp->groups->image_base . '/none.gif' ?>" alt="No Group Avatar" class="avatar" /> 1100 1100 <?php } 1101 1101 } … … 1122 1122 1123 1123 // If they're not logged in or are banned from the group, no join button. 1124 if ( !is_user_logged_in() || groups_is_user_banned( $bp ['loggedin_userid'], $group->id ) )1124 if ( !is_user_logged_in() || groups_is_user_banned( $bp->loggedin_user->id, $group->id ) ) 1125 1125 return false; 1126 1126 … … 1129 1129 switch ( $group->status ) { 1130 1130 case 'public': 1131 if ( BP_Groups_Member::check_is_member( $bp ['loggedin_userid'], $group->id ) )1131 if ( BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group->id ) ) 1132 1132 echo '<a class="leave-group" href="' . bp_group_permalink( $group, false ) . '/leave-group">' . __('Leave Group', 'buddypress') . '</a>'; 1133 1133 else … … 1136 1136 1137 1137 case 'private': 1138 if ( BP_Groups_Member::check_is_member( $bp ['loggedin_userid'], $group->id ) ) {1138 if ( BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group->id ) ) { 1139 1139 echo '<a class="leave-group" href="' . bp_group_permalink( $group, false ) . '/leave-group">' . __('Leave Group', 'buddypress') . '</a>'; 1140 1140 } else { … … 1214 1214 global $bp; 1215 1215 1216 $group_ids = BP_Groups_Member::get_random_groups( $bp ['current_userid']);1216 $group_ids = BP_Groups_Member::get_random_groups( $bp->displayed_user->id ); 1217 1217 ?> 1218 1218 <div class="info-group"> 1219 <h4><?php bp_word_or_name( __( "My Groups", 'buddypress' ), __( "%s's Groups", 'buddypress' ) ) ?> (<?php echo BP_Groups_Member::total_group_count() ?>) <a href="<?php echo $bp ['current_domain'] . $bp['groups']['slug']?>"><?php _e('See All', 'buddypress') ?> »</a></h4>1219 <h4><?php bp_word_or_name( __( "My Groups", 'buddypress' ), __( "%s's Groups", 'buddypress' ) ) ?> (<?php echo BP_Groups_Member::total_group_count() ?>) <a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>"><?php _e('See All', 'buddypress') ?> »</a></h4> 1220 1220 <?php if ( $group_ids ) { ?> 1221 1221 <ul class="horiz-gallery"> … … 1411 1411 global $bp; 1412 1412 1413 if ( $bp ['current_action']== 'group-finder' )1413 if ( $bp->current_action == 'group-finder' ) 1414 1414 echo apply_filters( 'bp_group_reject_invite_link', 'groupfinder-pag' ); 1415 1415 else -
trunk/bp-groups/bp-groups-widgets.php
r805 r1021 33 33 <?php if ( $groups['groups'] ) : ?> 34 34 <div class="item-options" id="groups-list-options"> 35 <img id="ajax-loader-groups" src="<?php echo $bp ['groups']['image_base']?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /> 35 <img id="ajax-loader-groups" src="<?php echo $bp->groups->image_base ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /> 36 36 <a href="<?php echo site_url() . '/groups' ?>" id="newest-groups"><?php _e("Newest", 'buddypress') ?></a> | 37 37 <a href="<?php echo site_url() . '/groups' ?>" id="recently-active-groups"><?php _e("Active", 'buddypress') ?></a> | -
trunk/bp-groups/directories/bp-groups-directory-groups.php
r897 r1021 3 3 global $bp, $current_blog; 4 4 5 if ( $bp ['current_component'] == $bp['groups']['slug'] && $bp['current_action'] == '') {5 if ( $bp->current_component == $bp->groups->slug && empty( $bp->current_action ) ) { 6 6 add_action( 'bp_template_content', 'groups_directory_groups_content' ); 7 7 add_action( 'bp_template_sidebar', 'groups_directory_groups_sidebar' ); … … 88 88 <div id="group-dir-count" class="pag-count"> 89 89 <?php echo sprintf( __( 'Viewing group %d to %d (%d total active groups)', 'buddypress' ), $from_num, $to_num, $groups['total'] ); ?> 90 <img id="ajax-loader-groups" src="<?php echo $bp ['core']['image_base']?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />90 <img id="ajax-loader-groups" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" /> 91 91 </div> 92 92 … … 156 156 <div class="widget"> 157 157 <h2 class="widgettitle"><?php _e( 'Find Groups', 'buddypress' ) ?></h2> 158 <form action="<?php echo site_url() . '/' . $bp ['groups']['slug']. '/search/' ?>" method="post" id="search-groups-form">158 <form action="<?php echo site_url() . '/' . $bp->groups->slug . '/search/' ?>" method="post" id="search-groups-form"> 159 159 <label><input type="text" name="groups_search" id="groups_search" value="<?php if ( isset( $_GET['s'] ) ) { echo $_GET['s']; } else { _e('Search anything...', 'buddypress' ); } ?>" onfocus="if (this.value == '<?php _e('Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('Search anything...', 'buddypress' ) ?>';}" /></label> 160 160 <input type="submit" id="groups_search_submit" name="groups_search_submit" value="Search" /> -
trunk/bp-messages.php
r1017 r1021 29 29 30 30 // Remove indexes so we can alter the field types for these fields. 31 $wpdb->query( "ALTER TABLE ". $bp['messages']['table_name_threads'] . "DROP INDEX message_ids " );32 $wpdb->query( "ALTER TABLE ". $bp['messages']['table_name_threads'] . "DROP INDEX sender_ids " );33 34 $sql[] = "CREATE TABLE ". $bp['messages']['table_name_threads'] ."(31 $wpdb->query( "ALTER TABLE {$bp->messages->table_name_threads} DROP INDEX message_ids " ); 32 $wpdb->query( "ALTER TABLE {$bp->messages->table_name_threads} DROP INDEX sender_ids " ); 33 34 $sql[] = "CREATE TABLE {$bp->messages->table_name_threads} ( 35 35 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 36 36 message_ids longtext NOT NULL, … … 44 44 ) {$charset_collate};"; 45 45 46 $sql[] = "CREATE TABLE ". $bp['messages']['table_name_recipients'] ."(46 $sql[] = "CREATE TABLE {$bp->messages->table_name_recipients} ( 47 47 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 48 48 user_id int(11) NOT NULL, … … 58 58 ) {$charset_collate};"; 59 59 60 $sql[] = "CREATE TABLE ". $bp['messages']['table_name_messages'] ."(60 $sql[] = "CREATE TABLE {$bp->messages->table_name_messages} ( 61 61 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 62 62 sender_id int(11) NOT NULL, … … 71 71 ) {$charset_collate};"; 72 72 73 $sql[] = "CREATE TABLE ". $bp['messages']['table_name_notices'] ."(73 $sql[] = "CREATE TABLE {$bp->messages->table_name_notices} ( 74 74 id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 75 75 subject varchar(200) NOT NULL, … … 97 97 global $bp, $wpdb; 98 98 99 $bp['messages'] = array( 100 'table_name' => $wpdb->base_prefix . 'bp_messages', 101 'table_name_threads' => $wpdb->base_prefix . 'bp_messages_threads', 102 'table_name_messages' => $wpdb->base_prefix . 'bp_messages_messages', 103 'table_name_recipients' => $wpdb->base_prefix . 'bp_messages_recipients', 104 'table_name_notices' => $wpdb->base_prefix . 'bp_messages_notices', 105 'format_activity_function' => 'messages_format_activity', 106 'image_base' => site_url( MUPLUGINDIR . '/bp-messages/images' ), 107 'slug' => BP_MESSAGES_SLUG 108 ); 109 110 $bp['version_numbers'][$bp['messages']['slug']] = BP_MESSAGES_VERSION; 99 $bp->messages->table_name_threads = $wpdb->base_prefix . 'bp_messages_threads'; 100 $bp->messages->table_name_messages = $wpdb->base_prefix . 'bp_messages_messages'; 101 $bp->messages->table_name_recipients = $wpdb->base_prefix . 'bp_messages_recipients'; 102 $bp->messages->table_name_notices = $wpdb->base_prefix . 'bp_messages_notices'; 103 $bp->messages->format_activity_function = 'messages_format_activity'; 104 $bp->messages->image_base = site_url( MUPLUGINDIR . '/bp-messages/images' ); 105 $bp->messages->slug = BP_MESSAGES_SLUG; 106 107 $bp->version_numbers->messages = BP_MESSAGES_VERSION; 111 108 } 112 109 add_action( 'wp', 'messages_setup_globals', 1 ); … … 126 123 if ( is_site_admin() ) { 127 124 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 128 if ( ( $wpdb->get_var( "SHOW TABLES LIKE '% " . $bp['messages']['table_name'] . "%'" ) == false ) || ( get_site_option('bp-messages-db-version') < BP_MESSAGES_DB_VERSION ) )125 if ( ( $wpdb->get_var( "SHOW TABLES LIKE '%{$bp->messages->table_name_messages}%'" ) == false ) || ( get_site_option('bp-messages-db-version') < BP_MESSAGES_DB_VERSION ) ) 129 126 messages_install(); 130 127 } … … 146 143 147 144 /* Add 'Profile' to the main navigation */ 148 bp_core_add_nav_item( __('Messages', 'buddypress'), $bp ['messages']['slug'], false, false );149 bp_core_add_nav_default( $bp ['messages']['slug'], 'messages_screen_inbox', 'inbox', bp_is_home() );150 151 $messages_link = $bp ['loggedin_domain'] . $bp['messages']['slug']. '/';145 bp_core_add_nav_item( __('Messages', 'buddypress'), $bp->messages->slug, false, false ); 146 bp_core_add_nav_default( $bp->messages->slug, 'messages_screen_inbox', 'inbox', bp_is_home() ); 147 148 $messages_link = $bp->loggedin_user->domain . $bp->messages->slug . '/'; 152 149 153 150 /* Add the subnav items to the profile */ 154 bp_core_add_subnav_item( $bp ['messages']['slug'], 'inbox', __('Inbox', 'buddypress') . $count_indicator, $messages_link, 'messages_screen_inbox', false, bp_is_home() );155 bp_core_add_subnav_item( $bp ['messages']['slug'], 'sentbox', __('Sent Messages', 'buddypress'), $messages_link, 'messages_screen_sentbox', false, bp_is_home() );156 bp_core_add_subnav_item( $bp ['messages']['slug'], 'compose', __('Compose', 'buddypress'), $messages_link, 'messages_screen_compose', false, bp_is_home() );157 bp_core_add_subnav_item( $bp ['messages']['slug'], 'notices', __('Notices', 'buddypress'), $messages_link, 'messages_screen_notices', false, true, true );158 159 if ( $bp ['current_component'] == $bp['messages']['slug']) {151 bp_core_add_subnav_item( $bp->messages->slug, 'inbox', __('Inbox', 'buddypress') . $count_indicator, $messages_link, 'messages_screen_inbox', false, bp_is_home() ); 152 bp_core_add_subnav_item( $bp->messages->slug, 'sentbox', __('Sent Messages', 'buddypress'), $messages_link, 'messages_screen_sentbox', false, bp_is_home() ); 153 bp_core_add_subnav_item( $bp->messages->slug, 'compose', __('Compose', 'buddypress'), $messages_link, 'messages_screen_compose', false, bp_is_home() ); 154 bp_core_add_subnav_item( $bp->messages->slug, 'notices', __('Notices', 'buddypress'), $messages_link, 'messages_screen_notices', false, true, true ); 155 156 if ( $bp->current_component == $bp->messages->slug ) { 160 157 if ( bp_is_home() ) { 161 $bp ['bp_options_title'] = __('My Messages', 'buddypress');162 } else { 163 $bp_options_avatar = bp_core_get_avatar( $bp ['current_userid'], 1 );164 $bp ['bp_options_title'] = $bp['current_fullname'];158 $bp->bp_options_title = __( 'My Messages', 'buddypress' ); 159 } else { 160 $bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 ); 161 $bp->bp_options_title = $bp->displayed_user->fullname; 165 162 } 166 163 } … … 214 211 return false; 215 212 216 $notice_id = $bp ['action_variables'][1];213 $notice_id = $bp->action_variables[1]; 217 214 218 215 if ( $notice_id && is_numeric($notice_id) ) { 219 216 $notice = new BP_Messages_Notice($notice_id); 220 217 221 if ( $bp ['action_variables'][0] == 'deactivate' ) {218 if ( $bp->action_variables[0] == 'deactivate' ) { 222 219 if ( !$notice->deactivate() ) { 223 220 bp_core_add_message( __('There was a problem deactivating that notice.', 'buddypress'), 'error' ); … … 225 222 bp_core_add_message( __('Notice deactivated.', 'buddypress') ); 226 223 } 227 } else if ( $bp ['action_variables'][0] == 'activate' ) {224 } else if ( $bp->action_variables[0] == 'activate' ) { 228 225 if ( !$notice->activate() ) { 229 226 bp_core_add_message( __('There was a problem activating that notice.', 'buddypress'), 'error' ); … … 231 228 bp_core_add_message( __('Notice activated.', 'buddypress') ); 232 229 } 233 } else if ( $bp ['action_variables'][0] == 'delete' ) {230 } else if ( $bp->action_variables[0] == 'delete' ) { 234 231 if ( !$notice->delete() ) { 235 232 bp_core_add_message( __('There was a problem deleting that notice.', 'buddypress'), 'buddypress' ); … … 238 235 } 239 236 } 240 bp_core_redirect( $bp ['loggedin_domain'] . $bp['messages']['slug']. '/notices' );237 bp_core_redirect( $bp->loggedin_user->domain . $bp->messages->slug . '/notices' ); 241 238 } 242 239 … … 279 276 global $bp, $thread_id; 280 277 281 if ( $bp ['current_component'] != $bp['messages']['slug'] || $bp['current_action']!= 'view' )278 if ( $bp->current_component != $bp->messages->slug || $bp->current_action != 'view' ) 282 279 return false; 283 280 284 $thread_id = $bp ['action_variables'][0];281 $thread_id = $bp->action_variables[0]; 285 282 286 283 if ( !$thread_id || !is_numeric($thread_id) || !BP_Messages_Thread::check_access($thread_id) ) { 287 bp_core_redirect( $bp ['current_domain'] . $bp['current_component']);288 } else { 289 $bp ['bp_options_nav'][$bp['messages']['slug']]['view'] = array(284 bp_core_redirect( $bp->displayed_user->domain . $bp->current_component ); 285 } else { 286 $bp->bp_options_nav[$bp->messages->slug]['view'] = array( 290 287 'name' => __('From: ' . BP_Messages_Thread::get_last_sender($thread_id), 'buddypress'), 291 'link' => $bp ['loggedin_domain'] . $bp['messages']['slug']. '/'288 'link' => $bp->loggedin_user->domain . $bp->messages->slug . '/' 292 289 ); 293 290 … … 301 298 global $bp, $thread_id; 302 299 303 if ( $bp ['current_component'] != $bp['messages']['slug'] || $bp['action_variables'][0] != 'delete' )300 if ( $bp->current_component != $bp->messages->slug || $bp->action_variables[0] != 'delete' ) 304 301 return false; 305 302 306 $thread_id = $bp ['action_variables'][1];303 $thread_id = $bp->action_variables[1]; 307 304 308 305 if ( !$thread_id || !is_numeric($thread_id) || !BP_Messages_Thread::check_access($thread_id) ) { 309 bp_core_redirect( $bp ['current_domain'] . $bp['current_component'] . '/' . $bp['current_action']);310 } else { 311 //echo $bp ['loggedin_domain'] . $bp['current_component'] . '/' . $bp['current_action']; die;306 bp_core_redirect( $bp->displayed_user->domain . $bp->current_component . '/' . $bp->current_action ); 307 } else { 308 //echo $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action; die; 312 309 // delete message 313 310 if ( !messages_delete_thread($thread_id) ) { … … 316 313 bp_core_add_message( __('Message deleted.', 'buddypress') ); 317 314 } 318 bp_core_redirect( $bp ['loggedin_domain'] . $bp['current_component'] . '/' . $bp['current_action']);315 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action ); 319 316 } 320 317 } … … 325 322 global $bp, $thread_ids; 326 323 327 if ( $bp ['current_component'] != $bp['messages']['slug'] || $bp['action_variables'][0] != 'bulk-delete' )324 if ( $bp->current_component != $bp->messages->slug || $bp->action_variables[0] != 'bulk-delete' ) 328 325 return false; 329 326 … … 331 328 332 329 if ( !$thread_ids || !BP_Messages_Thread::check_access($thread_ids) ) { 333 bp_core_redirect( $bp ['current_domain'] . $bp['current_component'] . '/' . $bp['current_action']);330 bp_core_redirect( $bp->displayed_user->domain . $bp->current_component . '/' . $bp->current_action ); 334 331 } else { 335 332 if ( !messages_delete_thread( $thread_ids ) ) { … … 338 335 bp_core_add_message( __('Messages deleted.', 'buddypress') ); 339 336 } 340 bp_core_redirect( $bp ['loggedin_domain'] . $bp['current_component'] . '/' . $bp['current_action']);337 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action ); 341 338 } 342 339 } … … 370 367 if ( $action == 'new_message') { 371 368 if ( (int)$total_items > 1 ) 372 return apply_filters( 'bp_messages_multiple_new_message_notification', '<a href="' . $bp ['loggedin_domain'] . $bp['messages']['slug']. '/inbox" title="Inbox">' . sprintf( __('You have %d new messages'), (int)$total_items ) . '</a>', $total_items );369 return apply_filters( 'bp_messages_multiple_new_message_notification', '<a href="' . $bp->loggedin_user->domain . $bp->messages->slug . '/inbox" title="Inbox">' . sprintf( __('You have %d new messages'), (int)$total_items ) . '</a>', $total_items ); 373 370 else 374 return apply_filters( 'bp_messages_single_new_message_notification', '<a href="' . $bp ['loggedin_domain'] . $bp['messages']['slug']. '/inbox" title="Inbox">' . sprintf( __('You have %d new message'), (int)$total_items ) . '</a>', $total_items );371 return apply_filters( 'bp_messages_single_new_message_notification', '<a href="' . $bp->loggedin_user->domain . $bp->messages->slug . '/inbox" title="Inbox">' . sprintf( __('You have %d new message'), (int)$total_items ) . '</a>', $total_items ); 375 372 } 376 373 … … 400 397 bp_core_add_message( __('There was an error posting that notice.', 'buddypress'), 'error' ); 401 398 } 402 bp_core_redirect( $bp ['loggedin_domain'] . $bp['current_component']. '/notices' );399 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/notices' ); 403 400 return true; 404 401 } … … 410 407 if ( !$from_ajax ) { 411 408 bp_core_add_message( __('Please enter at least one valid user to send this message to.', 'buddypress'), 'error' ); 412 bp_core_redirect( $bp ['loggedin_domain'] . $bp['current_component']. '/compose' );409 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/compose' ); 413 410 } else { 414 411 return array('status' => 0, 'message' => __('There was an error sending the reply, please try again.', 'buddypress')); … … 418 415 } else if ( count( $recipients ) == 1 && $recipients[0] == $current_user->user_login ) { 419 416 bp_core_add_message( __('You must send your message to one or more users not including yourself.', 'buddypress'), 'error' ); 420 bp_core_redirect( $bp ['loggedin_domain'] . $bp['current_component']. '/compose' );417 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/compose' ); 421 418 422 419 // If the subject or content boxes are empty. … … 424 421 if ( !$from_ajax ) { 425 422 bp_core_add_message( __('Please make sure you fill in all the fields.', 'buddypress'), 'error' ); 426 bp_core_redirect( $bp ['loggedin_domain'] . $bp['current_component']. '/compose' );423 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/compose' ); 427 424 } else { 428 425 return array('status' => 0, 'message' => __('Please make sure you have typed a message before sending a reply.', 'buddypress')); … … 438 435 $pmessage = new BP_Messages_Message; 439 436 440 $pmessage->sender_id = $bp ['loggedin_userid'];437 $pmessage->sender_id = $bp->loggedin_user->id; 441 438 $pmessage->subject = $subject; 442 439 $pmessage->message = $content; … … 462 459 } else { 463 460 bp_core_add_message( $message, $type ); 464 bp_core_redirect( $bp ['loggedin_domain'] . $bp['current_component']. '/compose' );461 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/compose' ); 465 462 } 466 463 } else { 467 $message = __('Message sent successfully!', 'buddypress') . ' <a href="' . $bp ['loggedin_domain'] . $bp['messages']['slug']. '/view/' . $pmessage->thread_id . '">' . __('View Message', 'buddypress') . '</a> »';464 $message = __('Message sent successfully!', 'buddypress') . ' <a href="' . $bp->loggedin_user->domain . $bp->messages->slug . '/view/' . $pmessage->thread_id . '">' . __('View Message', 'buddypress') . '</a> »'; 468 465 $type = 'success'; 469 466 470 467 // Send notices to the recipients 471 468 for ( $i = 0; $i < count($pmessage->recipients); $i++ ) { 472 if ( $pmessage->recipients[$i] != $bp ['loggedin_userid']) {469 if ( $pmessage->recipients[$i] != $bp->loggedin_user->id ) { 473 470 bp_core_add_notification( $pmessage->id, $pmessage->recipients[$i], 'messages', 'new_message' ); 474 471 } … … 481 478 } else { 482 479 bp_core_add_message( $message ); 483 bp_core_redirect( $bp ['loggedin_domain'] . $bp['current_component']. '/inbox' );480 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/inbox' ); 484 481 } 485 482 } … … 492 489 } else { 493 490 bp_core_add_message( $message, $type ); 494 bp_core_redirect( $bp ['loggedin_domain'] . $bp['messages']['slug']. '/compose' );491 bp_core_redirect( $bp->loggedin_user->domain . $bp->messages->slug . '/compose' ); 495 492 } 496 493 } … … 601 598 <tr> 602 599 <td> 603 <img src="<?php echo $bp ['messages']['image_base']?>/email_open.gif" alt="Message" style="vertical-align: top;" /> 600 <img src="<?php echo $bp->messages->image_base ?>/email_open.gif" alt="Message" style="vertical-align: top;" /> 604 601 <?php _e('Sent between ', 'buddypress') ?> <?php echo BP_Messages_Thread::get_recipient_links($thread->recipients) ?> 605 <?php _e('and', 'buddypress') ?> <?php echo bp_core_get_userlink($bp ['loggedin_userid']) ?>.602 <?php _e('and', 'buddypress') ?> <?php echo bp_core_get_userlink($bp->loggedin_user->id) ?>. 606 603 </td> 607 604 </tr> … … 631 628 <div class="avatar-box"> 632 629 <?php if ( function_exists('bp_core_get_avatar') ) 633 echo bp_core_get_avatar($bp ['loggedin_userid'], 1);630 echo bp_core_get_avatar($bp->loggedin_user->id, 1); 634 631 ?> 635 632 -
trunk/bp-messages/autocomplete/bp-messages-autocomplete.php
r659 r1021 10 10 11 11 // Get the friend ids based on the search terms 12 $friends = friends_search_friends( $_GET['q'], $bp ['loggedin_userid'], $_GET['limit'], 1 );12 $friends = friends_search_friends( $_GET['q'], $bp->loggedin_user->id, $_GET['limit'], 1 ); 13 13 14 14 if ( $friends['friends'] ) { -
trunk/bp-messages/bp-messages-ajax.php
r922 r1021 21 21 <?php 22 22 } else { 23 $result['message'] = '<img src="' . $bp ['messages']['image_base']. '/warning.gif" alt="Warning" /> ' . $result['message'];23 $result['message'] = '<img src="' . $bp->messages->image_base . '/warning.gif" alt="Warning" /> ' . $result['message']; 24 24 echo "-1[[split]]" . $result['message']; 25 25 } -
trunk/bp-messages/bp-messages-classes.php
r713 r1021 38 38 global $wpdb, $bp; 39 39 40 $thread = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp['messages']['table_name_threads'] . "WHERE id = %d", $id ) );40 $thread = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_threads} WHERE id = %d", $id ) ); 41 41 42 42 if ( $thread ) { … … 63 63 foreach ( $this->message_ids as $key => $message_id ) { 64 64 if ( $this->box == 'sentbox' ) { 65 if ( !messages_is_user_sender( $bp ['loggedin_userid'], $message_id ) ) {65 if ( !messages_is_user_sender( $bp->loggedin_user->id, $message_id ) ) { 66 66 unset( $this->message_ids[$key] ); 67 67 } else { … … 69 69 } 70 70 } else { 71 if ( messages_is_user_sender( $bp ['loggedin_userid'], $message_id ) ) {71 if ( messages_is_user_sender( $bp->loggedin_user->id, $message_id ) ) { 72 72 unset( $this->message_ids[$key] ); 73 73 } else { … … 94 94 $this->unread_count = $this->get_unread(); 95 95 96 $last_message = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp['messages']['table_name_messages'] . "WHERE id = %d", $this->last_message_id ) );96 $last_message = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_messages} WHERE id = %d", $this->last_message_id ) ); 97 97 98 98 if ( $last_message ) { … … 111 111 112 112 if ( $this->message_ids) 113 return $wpdb->get_results( "SELECT * FROM " . $bp['messages']['table_name_messages'] . "WHERE id IN (" . $wpdb->escape($this->message_ids) . ")" );113 return $wpdb->get_results( "SELECT * FROM {$bp->messages->table_name_messages} WHERE id IN (" . $wpdb->escape($this->message_ids) . ")" ); 114 114 else 115 115 return false; … … 119 119 global $wpdb, $bp; 120 120 121 $sql = $wpdb->prepare( "SELECT unread_count FROM " . $bp['messages']['table_name_recipients'] . " WHERE thread_id = %d AND user_id = %d", $this->thread_id, $bp['loggedin_userid']);121 $sql = $wpdb->prepare( "SELECT unread_count FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d AND user_id = %d", $this->thread_id, $bp->loggedin_user->id ); 122 122 $unread_count = $wpdb->get_var($sql); 123 123 … … 136 136 global $wpdb, $bp; 137 137 138 $recipients = $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM " . $bp['messages']['table_name_recipients'] . "WHERE thread_id = %d", $this->thread_id ) );138 $recipients = $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $this->thread_id ) ); 139 139 140 140 for ( $i = 0; $i < count($recipients); $i++ ) { 141 141 $recipient = $recipients[$i]; 142 142 143 if ( count($recipients) > 1 && $recipient != $bp ['loggedin_userid'])143 if ( count($recipients) > 1 && $recipient != $bp->loggedin_user->id ) 144 144 $recipient_ids[] = $recipient; 145 145 } … … 153 153 global $wpdb, $bp; 154 154 155 $delete_for_user = $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_recipients'] . " SET is_deleted = 1 WHERE thread_id = %d AND user_id = %d", $thread_id, $bp['loggedin_userid']) );155 $delete_for_user = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET is_deleted = 1 WHERE thread_id = %d AND user_id = %d", $thread_id, $bp->loggedin_user->id ) ); 156 156 157 157 // Check to see if any more recipients remain for this message 158 158 // if not, then delete the message from the database. 159 $recipients = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM " . $bp['messages']['table_name_recipients'] . "WHERE thread_id = %d AND is_deleted = 0", $thread_id ) );159 $recipients = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d AND is_deleted = 0", $thread_id ) ); 160 160 161 161 if ( !$recipients ) { 162 162 // Get message ids: 163 $message_ids = $wpdb->get_var( $wpdb->prepare( "SELECT message_ids FROM " . $bp['messages']['table_name_threads'] . "WHERE id = %d", $thread_id ) );163 $message_ids = $wpdb->get_var( $wpdb->prepare( "SELECT message_ids FROM {$bp->messages->table_name_threads} WHERE id = %d", $thread_id ) ); 164 164 $message_ids = unserialize($message_ids); 165 165 166 166 // delete thread: 167 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['messages']['table_name_threads'] . "WHERE id = %d", $thread_id ) );167 $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_threads} WHERE id = %d", $thread_id ) ); 168 168 169 169 // delete messages: 170 170 for ( $i = 0; $i < count($message_ids); $i++ ) { 171 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['messages']['table_name_messages'] . "WHERE id = %d", $message_ids[$i] ) );171 $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_messages} WHERE id = %d", $message_ids[$i] ) ); 172 172 } 173 173 174 174 // delete the recipients 175 $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['messages']['table_name_recipients'] . "WHERE id = %d", $thread_id ) );175 $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_recipients} WHERE id = %d", $thread_id ) ); 176 176 } 177 177 … … 186 186 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 187 187 188 $sql = $wpdb->prepare( "SELECT r.thread_id FROM " . $bp['messages']['table_name_recipients'] . " r, " . $bp['messages']['table_name_threads'] . " t WHERE t.id = r.thread_id AND r.is_deleted = 0 AND r.user_id = %d$exclude_sender ORDER BY t.last_post_date DESC$pag_sql", $bp['loggedin_userid']);188 $sql = $wpdb->prepare( "SELECT r.thread_id FROM {$bp->messages->table_name_recipients} r, {$bp->messages->table_name_threads} t WHERE t.id = r.thread_id AND r.is_deleted = 0 AND r.user_id = %d$exclude_sender ORDER BY t.last_post_date DESC$pag_sql", $bp->loggedin_user->id ); 189 189 190 190 if ( !$thread_ids = $wpdb->get_results($sql) ) … … 207 207 global $wpdb, $bp; 208 208 209 $sql = $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_recipients'] . " SET unread_count = 0 WHERE user_id = %d AND thread_id = %d", $bp['loggedin_userid'], $thread_id );209 $sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = 0 WHERE user_id = %d AND thread_id = %d", $bp->loggedin_user->id, $thread_id ); 210 210 $wpdb->query($sql); 211 211 } … … 214 214 global $wpdb, $bp; 215 215 216 $sql = $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_recipients'] . " SET unread_count = 1 WHERE user_id = %d AND thread_id = %d", $bp['loggedin_userid'], $thread_id );216 $sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = 1 WHERE user_id = %d AND thread_id = %d", $bp->loggedin_user->id, $thread_id ); 217 217 $wpdb->query($sql); 218 218 } … … 225 225 $exclude_sender = ' AND sender_only != 1'; 226 226 227 return (int) $wpdb->get_var( $wpdb->prepare( "SELECT count(thread_id) FROM " . $bp['messages']['table_name_recipients'] . "WHERE user_id = %d AND is_deleted = 0$exclude_sender", $user_id ) );227 return (int) $wpdb->get_var( $wpdb->prepare( "SELECT count(thread_id) FROM {$bp->messages->table_name_recipients} WHERE user_id = %d AND is_deleted = 0$exclude_sender", $user_id ) ); 228 228 } 229 229 … … 231 231 global $wpdb, $bp; 232 232 233 $sender_ids = $wpdb->get_var( $wpdb->prepare( "SELECT sender_ids FROM " . $bp['messages']['table_name_threads'] . "WHERE id = %d", $thread_id ) );233 $sender_ids = $wpdb->get_var( $wpdb->prepare( "SELECT sender_ids FROM {$bp->messages->table_name_threads} WHERE id = %d", $thread_id ) ); 234 234 235 235 if ( !$sender_ids ) … … 238 238 $sender_ids = unserialize($sender_ids); 239 239 240 return in_array( $bp ['loggedin_userid'], $sender_ids );240 return in_array( $bp->loggedin_user->id, $sender_ids ); 241 241 } 242 242 … … 244 244 global $wpdb, $bp; 245 245 246 $sql = $wpdb->prepare("SELECT last_sender_id FROM " . $bp['messages']['table_name_threads'] . "WHERE id = %d", $thread_id);246 $sql = $wpdb->prepare("SELECT last_sender_id FROM {$bp->messages->table_name_threads} WHERE id = %d", $thread_id); 247 247 248 248 if ( !$sender_id = $wpdb->get_var($sql) ) … … 255 255 global $wpdb, $bp; 256 256 257 $sql = $wpdb->prepare( "SELECT unread_count FROM " . $bp['messages']['table_name_recipients'] . " WHERE user_id = %d AND is_deleted = 0", $bp['loggedin_userid']);257 $sql = $wpdb->prepare( "SELECT unread_count FROM {$bp->messages->table_name_recipients} WHERE user_id = %d AND is_deleted = 0", $bp->loggedin_user->id ); 258 258 259 259 if ( !$unread_counts = $wpdb->get_results($sql) ) … … 271 271 global $wpdb, $bp; 272 272 273 $sql = $wpdb->prepare("SELECT id FROM " . $bp['messages']['table_name_recipients'] . " WHERE thread_id = %d AND user_id = %d", $id, $bp['loggedin_userid']);273 $sql = $wpdb->prepare("SELECT id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d AND user_id = %d", $id, $bp->loggedin_user->id ); 274 274 $has_access = $wpdb->get_var($sql); 275 275 … … 308 308 309 309 $this->date_sent = time(); 310 $this->sender_id = $bp ['loggedin_userid'];310 $this->sender_id = $bp->loggedin_user->id; 311 311 312 312 if ( $id ) { … … 318 318 global $wpdb, $bp; 319 319 320 $sql = $wpdb->prepare("SELECT * FROM " . $bp['messages']['table_name_messages'] . "WHERE id = %d", $id);320 $sql = $wpdb->prepare("SELECT * FROM {$bp->messages->table_name_messages} WHERE id = %d", $id); 321 321 322 322 if ( $message = $wpdb->get_row($sql) ) { … … 336 336 337 337 // First insert the message into the messages table 338 if ( !$wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['messages']['table_name_messages'] . "( sender_id, subject, message, date_sent, message_order, sender_is_group ) VALUES ( %d, %s, %s, FROM_UNIXTIME(%d), %d, %d )", $this->sender_id, $this->subject, $this->message, $this->date_sent, $this->message_order, $this->sender_is_group ) ) )338 if ( !$wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_messages} ( sender_id, subject, message, date_sent, message_order, sender_is_group ) VALUES ( %d, %s, %s, FROM_UNIXTIME(%d), %d, %d )", $this->sender_id, $this->subject, $this->message, $this->date_sent, $this->message_order, $this->sender_is_group ) ) ) 339 339 return false; 340 340 … … 342 342 if ( $this->thread_id ) { 343 343 // Select and update the current message ids for the thread. 344 $the_ids = $wpdb->get_row( $wpdb->prepare( "SELECT message_ids, sender_ids FROM " . $bp['messages']['table_name_threads'] . "WHERE id = %d", $this->thread_id ) );344 $the_ids = $wpdb->get_row( $wpdb->prepare( "SELECT message_ids, sender_ids FROM {$bp->messages->table_name_threads} WHERE id = %d", $this->thread_id ) ); 345 345 $message_ids = unserialize($the_ids->message_ids); 346 346 $message_ids[] = $wpdb->insert_id; … … 359 359 360 360 // Update the thread the message belongs to. 361 $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_threads'] . "SET message_ids = %s, sender_ids = %s, last_message_id = %d, last_sender_id = %d WHERE id = %d", $message_ids, $sender_ids, $wpdb->insert_id, $this->sender_id, $this->thread_id ) );361 $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_threads} SET message_ids = %s, sender_ids = %s, last_message_id = %d, last_sender_id = %d WHERE id = %d", $message_ids, $sender_ids, $wpdb->insert_id, $this->sender_id, $this->thread_id ) ); 362 362 363 363 // Find the recipients and update the unread counts for each … … 366 366 367 367 for ( $i = 0; $i < count($this->recipients); $i++ ) { 368 if ( $this->recipients[$i]->user_id != $bp ['loggedin_userid'])369 $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_recipients'] . "SET unread_count = unread_count + 1, sender_only = 0 WHERE thread_id = %d AND user_id = %d", $this->thread_id, $this->recipients[$i] ) );368 if ( $this->recipients[$i]->user_id != $bp->loggedin_user->id ) 369 $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = unread_count + 1, sender_only = 0 WHERE thread_id = %d AND user_id = %d", $this->thread_id, $this->recipients[$i] ) ); 370 370 } 371 371 } else { … … 373 373 $message_id = $wpdb->insert_id; 374 374 $serialized_message_id = serialize( array( (int)$message_id ) ); 375 $serialized_sender_id = serialize( array( (int)$bp ['loggedin_userid']) );376 377 $sql = $wpdb->prepare( "INSERT INTO " . $bp['messages']['table_name_threads'] . "( message_ids, sender_ids, first_post_date, last_post_date, last_message_id, last_sender_id ) VALUES ( %s, %s, FROM_UNIXTIME(%d), FROM_UNIXTIME(%d), %d, %d )", $serialized_message_id, $serialized_sender_id, $this->date_sent, $this->date_sent, $message_id, $this->sender_id );375 $serialized_sender_id = serialize( array( (int)$bp->loggedin_user->id ) ); 376 377 $sql = $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_threads} ( message_ids, sender_ids, first_post_date, last_post_date, last_message_id, last_sender_id ) VALUES ( %s, %s, FROM_UNIXTIME(%d), FROM_UNIXTIME(%d), %d, %d )", $serialized_message_id, $serialized_sender_id, $this->date_sent, $this->date_sent, $message_id, $this->sender_id ); 378 378 379 379 if ( $wpdb->query($sql) === false ) … … 385 385 // Add a new entry for each recipient; 386 386 for ( $i = 0; $i < count($this->recipients); $i++ ) { 387 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['messages']['table_name_recipients'] . "( user_id, thread_id, unread_count ) VALUES ( %d, %d, 1 )", $this->recipients[$i], $this->thread_id ) );387 $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_recipients} ( user_id, thread_id, unread_count ) VALUES ( %d, %d, 1 )", $this->recipients[$i], $this->thread_id ) ); 388 388 } 389 389 390 390 if ( !in_array( $this->sender_id, $this->recipients ) ) { 391 391 // Finally, add a recipient entry for the sender, as replies need to go to this person too. 392 $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['messages']['table_name_recipients'] . "( user_id, thread_id, unread_count, sender_only ) VALUES ( %d, %d, 0, 0 )", $this->sender_id, $this->thread_id ) );392 $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_recipients} ( user_id, thread_id, unread_count, sender_only ) VALUES ( %d, %d, 0, 0 )", $this->sender_id, $this->thread_id ) ); 393 393 } 394 394 } … … 403 403 global $bp, $wpdb; 404 404 405 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM " . $bp['messages']['table_name_recipients'] . "WHERE thread_id = %d", $this->thread_id ) );405 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $this->thread_id ) ); 406 406 } 407 407 … … 425 425 global $wpdb, $bp; 426 426 427 $message_ids = $wpdb->get_var( $wpdb->prepare( "SELECT message_ids FROM " . $bp['messages']['table_name_threads'] . "WHERE id = %d", $thread_id ) );427 $message_ids = $wpdb->get_var( $wpdb->prepare( "SELECT message_ids FROM {$bp->messages->table_name_threads} WHERE id = %d", $thread_id ) ); 428 428 $message_ids = implode( ',', unserialize($message_ids)); 429 429 430 $sql = $wpdb->prepare( "SELECT id FROM " . $bp['messages']['table_name_messages'] . " WHERE sender_id = %d AND id IN (" . $wpdb->escape($message_ids) . ") ORDER BY date_sent DESC LIMIT 1", $bp['loggedin_userid']);430 $sql = $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE sender_id = %d AND id IN (" . $wpdb->escape($message_ids) . ") ORDER BY date_sent DESC LIMIT 1", $bp->loggedin_user->id ); 431 431 return $wpdb->get_var($sql); 432 432 } … … 434 434 function is_user_sender( $user_id, $message_id ) { 435 435 global $wpdb, $bp; 436 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM " . $bp['messages']['table_name_messages'] . "WHERE sender_id = %d AND id = %d", $user_id, $message_id ) );436 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE sender_id = %d AND id = %d", $user_id, $message_id ) ); 437 437 } 438 438 439 439 function get_message_sender( $message_id ) { 440 440 global $wpdb, $bp; 441 return $wpdb->get_var( $wpdb->prepare( "SELECT sender_id FROM " . $bp['messages']['table_name_messages'] . "WHERE id = %d", $message_id ) );441 return $wpdb->get_var( $wpdb->prepare( "SELECT sender_id FROM {$bp->messages->table_name_messages} WHERE id = %d", $message_id ) ); 442 442 } 443 443 } … … 460 460 global $wpdb, $bp; 461 461 462 $notice = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $bp['messages']['table_name_notices'] . "WHERE id = %d", $this->id ) );462 $notice = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_notices} WHERE id = %d", $this->id ) ); 463 463 464 464 if ( $notice ) { … … 474 474 475 475 if ( !$this->id ) { 476 $sql = $wpdb->prepare( "INSERT INTO " . $bp['messages']['table_name_notices'] . "(subject, message, date_sent, is_active) VALUES (%s, %s, FROM_UNIXTIME(%d), %d)", $this->subject, $this->message, $this->date_sent, $this->is_active );476 $sql = $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_notices} (subject, message, date_sent, is_active) VALUES (%s, %s, FROM_UNIXTIME(%d), %d)", $this->subject, $this->message, $this->date_sent, $this->is_active ); 477 477 } else { 478 $sql = $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_notices'] . "SET subject = %s, message = %s, is_active = %d WHERE id = %d", $this->subject, $this->message, $this->is_active, $this->id );478 $sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET subject = %s, message = %s, is_active = %d WHERE id = %d", $this->subject, $this->message, $this->is_active, $this->id ); 479 479 } 480 480 … … 486 486 487 487 // Now deactivate all notices apart from the new one. 488 $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_notices'] . "SET is_active = 0 WHERE id != %d", $id ) );489 490 update_usermeta( $bp ['loggedin_userid'], 'last_activity', date( 'Y-m-d H:i:s' ) );488 $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET is_active = 0 WHERE id != %d", $id ) ); 489 490 update_usermeta( $bp->loggedin_user->id, 'last_activity', date( 'Y-m-d H:i:s' ) ); 491 491 492 492 return true; … … 512 512 global $wpdb, $bp; 513 513 514 $sql = $wpdb->prepare( "DELETE FROM " . $bp['messages']['table_name_notices'] . "WHERE id = %d", $this->id );514 $sql = $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_notices} WHERE id = %d", $this->id ); 515 515 516 516 if ( !$wpdb->query($sql) ) … … 525 525 global $wpdb, $bp; 526 526 527 $notices = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $bp['messages']['table_name_notices'] . "ORDER BY date_sent DESC" ) );527 $notices = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_notices} ORDER BY date_sent DESC" ) ); 528 528 return $notices; 529 529 } … … 532 532 global $wpdb, $bp; 533 533 534 $notice_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp ['messages']['table_name_notices']) );534 $notice_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $bp->messages->table_name_notices ) ); 535 535 return $notice_count; 536 536 } … … 539 539 global $wpdb, $bp; 540 540 541 $notice_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM " . $bp['messages']['table_name_notices'] . "WHERE is_active = 1") );541 $notice_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_notices} WHERE is_active = 1") ); 542 542 return new BP_Messages_Notice($notice_id); 543 543 } -
trunk/bp-messages/bp-messages-cssjs.php
r884 r1021 4 4 global $bp; 5 5 6 if ( $bp ['current_component'] == $bp['messages']['slug'])6 if ( $bp->current_component == $bp->messages->slug ) 7 7 wp_enqueue_script( 'bp-messages-js', site_url( MUPLUGINDIR . '/bp-messages/js/general.php' ) ); 8 8 9 9 // Include the autocomplete JS for composing a message. 10 if ( $bp ['current_component'] == $bp['messages']['slug'] && $bp['current_action']== 'compose') {10 if ( $bp->current_component == $bp->messages->slug && $bp->current_action == 'compose') { 11 11 wp_enqueue_script( 'bp-jquery-autocomplete', site_url( MUPLUGINDIR . '/bp-messages/js/autocomplete/jquery.autocomplete.js' ), 'jquery' ); 12 12 wp_enqueue_script( 'bp-jquery-autocomplete-fb', site_url( MUPLUGINDIR . '/bp-messages/js/autocomplete/jquery.autocompletefb.js' ), 'jquery' ); … … 23 23 global $bp; 24 24 25 if ( $bp ['current_component'] == $bp['messages']['slug'] && $bp['current_action']== 'compose') {25 if ( $bp->current_component == $bp->messages->slug && $bp->current_action == 'compose') { 26 26 wp_enqueue_style( 'bp-messages-autocomplete', site_url( MUPLUGINDIR . '/bp-messages/css/autocomplete/jquery.autocompletefb.css' ) ); 27 27 wp_print_styles(); -
trunk/bp-messages/bp-messages-templatetags.php
r920 r1021 98 98 global $bp, $messages_template; 99 99 100 if ( $bp ['current_action']== 'notices' && !is_site_admin() ) {101 wp_redirect( $bp ['current_userid']);100 if ( $bp->current_action == 'notices' && !is_site_admin() ) { 101 wp_redirect( $bp->displayed_user->id ); 102 102 } else { 103 if ( $bp ['current_action']== 'inbox' )104 bp_core_delete_notifications_for_user_by_type( $bp ['loggedin_userid'], 'messages', 'new_message' );105 106 $messages_template = new BP_Messages_Template( $bp ['loggedin_userid'], $bp['current_action']);103 if ( $bp->current_action == 'inbox' ) 104 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'messages', 'new_message' ); 105 106 $messages_template = new BP_Messages_Template( $bp->loggedin_user->id, $bp->current_action ); 107 107 } 108 108 … … 147 147 function bp_message_thread_view_link() { 148 148 global $messages_template, $bp; 149 echo apply_filters( 'bp_message_thread_view_link', $bp ['loggedin_domain'] . $bp['messages']['slug']. '/view/' . $messages_template->thread->thread_id );149 echo apply_filters( 'bp_message_thread_view_link', $bp->loggedin_user->domain . $bp->messages->slug . '/view/' . $messages_template->thread->thread_id ); 150 150 } 151 151 152 152 function bp_message_thread_delete_link() { 153 153 global $messages_template, $bp; 154 echo apply_filters( 'bp_message_thread_delete_link', $bp ['loggedin_domain'] . $bp['messages']['slug'] . '/' . $bp['current_action']. '/delete/' . $messages_template->thread->thread_id );154 echo apply_filters( 'bp_message_thread_delete_link', $bp->loggedin_user->domain . $bp->messages->slug . '/' . $bp->current_action . '/delete/' . $messages_template->thread->thread_id ); 155 155 } 156 156 … … 197 197 global $bp; 198 198 199 echo apply_filters( 'bp_messages_form_action', $bp ['loggedin_domain'] . $bp['messages']['slug'] . '/' . $bp['current_action']);199 echo apply_filters( 'bp_messages_form_action', $bp->loggedin_user->domain . $bp->messages->slug . '/' . $bp->current_action ); 200 200 } 201 201 … … 219 219 global $bp; 220 220 221 if ( $bp ['current_action']!= 'sentbox' ) {221 if ( $bp->current_action != 'sentbox' ) { 222 222 ?> 223 223 <?php _e( 'Select:', 'buddypress' ) ?> … … 231 231 <a href="#" id="mark_as_unread"><?php _e('Mark as Unread', 'buddypress') ?></a> 232 232 <?php } ?> 233 <a href="#" id="delete_<?php echo $bp ['current_action']?>_messages"><?php _e('Delete Selected', 'buddypress') ?></a> 233 <a href="#" id="delete_<?php echo $bp->current_action ?>_messages"><?php _e('Delete Selected', 'buddypress') ?></a> 234 234 <?php 235 235 } … … 263 263 global $messages_template, $bp; 264 264 265 echo apply_filters( 'bp_message_notice_delete_link', $bp ['loggedin_domain'] . $bp['messages']['slug']. '/notices/delete/' . $messages_template->thread->id );265 echo apply_filters( 'bp_message_notice_delete_link', $bp->loggedin_user->domain . $bp->messages->slug . '/notices/delete/' . $messages_template->thread->id ); 266 266 } 267 267 … … 270 270 271 271 if ( $messages_template->thread->is_active == "1" ) { 272 $link = $bp ['loggedin_domain'] . $bp['messages']['slug']. '/notices/deactivate/' . $messages_template->thread->id;272 $link = $bp->loggedin_user->domain . $bp->messages->slug . '/notices/deactivate/' . $messages_template->thread->id; 273 273 } else { 274 $link = $bp ['loggedin_domain'] . $bp['messages']['slug']. '/notices/activate/' . $messages_template->thread->id;274 $link = $bp->loggedin_user->domain . $bp->messages->slug . '/notices/activate/' . $messages_template->thread->id; 275 275 } 276 276 echo apply_filters( 'bp_message_activate_deactivate_link', $link ); … … 316 316 return false; 317 317 318 $ud = get_userdata( $bp ['current_userid']);318 $ud = get_userdata( $bp->displayed_user->id ); 319 319 ?> 320 320 <div class="generic-button"> 321 <a class="send-message" title="<?php _e( 'Send Message', 'buddypress' ) ?>" href="<?php echo $bp ['loggedin_domain'] . $bp['messages']['slug']?>/compose/?r=<?php echo $ud->user_login ?>"><?php _e( 'Send Message', 'buddypress' ) ?></a>321 <a class="send-message" title="<?php _e( 'Send Message', 'buddypress' ) ?>" href="<?php echo $bp->loggedin_user->domain . $bp->messages->slug ?>/compose/?r=<?php echo $ud->user_login ?>"><?php _e( 'Send Message', 'buddypress' ) ?></a> 322 322 </div> 323 323 <?php … … 326 326 function bp_message_loading_image_src() { 327 327 global $bp; 328 echo $bp ['messages']['image_base']. '/ajax-loader.gif';328 echo $bp->messages->image_base . '/ajax-loader.gif'; 329 329 } 330 330 -
trunk/bp-wire.php
r974 r1021 27 27 global $bp, $wpdb; 28 28 29 $bp['wire'] = array( 30 'image_base' => site_url( MUPLUGINDIR . '/bp-wire/images' ), 31 'slug' => BP_WIRE_SLUG 32 ); 29 $bp->wire->image_base = site_url( MUPLUGINDIR . '/bp-wire/images' ); 30 $bp->wire->slug = BP_WIRE_SLUG; 33 31 34 $bp ['version_numbers'][$bp['wire']['slug']]= BP_WIRE_VERSION;32 $bp->version_numbers->wire = BP_WIRE_VERSION; 35 33 } 36 34 add_action( 'wp', 'bp_wire_setup_globals', 1 ); … … 47 45 48 46 /* Add 'Wire' to the main navigation */ 49 bp_core_add_nav_item( __('Wire', 'buddypress'), $bp ['wire']['slug']);50 bp_core_add_nav_default( $bp ['wire']['slug'], 'bp_wire_screen_latest', 'all-posts' );47 bp_core_add_nav_item( __('Wire', 'buddypress'), $bp->wire->slug ); 48 bp_core_add_nav_default( $bp->wire->slug, 'bp_wire_screen_latest', 'all-posts' ); 51 49 52 50 /* Add the subnav items to the wire nav */ 53 bp_core_add_subnav_item( $bp ['wire']['slug'], 'all-posts', __('All Posts', 'buddypress'), $bp['loggedin_domain'] . $bp['wire']['slug']. '/', 'bp_wire_screen_latest' );51 bp_core_add_subnav_item( $bp->wire->slug, 'all-posts', __('All Posts', 'buddypress'), $bp->loggedin_user->domain . $bp->wire->slug . '/', 'bp_wire_screen_latest' ); 54 52 55 if ( $bp ['current_component'] == $bp['wire']['slug']) {53 if ( $bp->current_component == $bp->wire->slug ) { 56 54 if ( bp_is_home() ) { 57 $bp ['bp_options_title']= __('My Wire', 'buddypress');55 $bp->bp_options_title = __('My Wire', 'buddypress'); 58 56 } else { 59 $bp ['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 );60 $bp ['bp_options_title'] = $bp['current_fullname'];57 $bp->bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 ); 58 $bp->bp_options_title = $bp->displayed_user->fullname; 61 59 } 62 60 } … … 75 73 if ( function_exists('bp_activity_record') ) { 76 74 extract($args); 75 77 76 bp_activity_record( $item_id, $component_name, $component_action, $is_private, $secondary_item_id, $user_id, $secondary_user_id ); 78 77 } … … 93 92 94 93 if ( !$table_name ) 95 $table_name = $bp [$component_name]['table_name_wire'];94 $table_name = $bp->{$component_name}->table_name_wire; 96 95 97 96 $wire_post = new BP_Wire_Post( $table_name ); 98 97 $wire_post->item_id = $item_id; 99 $wire_post->user_id = $bp ['loggedin_userid'];98 $wire_post->user_id = $bp->loggedin_user->id; 100 99 $wire_post->date_posted = time(); 101 102 100 103 101 $allowed_tags = apply_filters( 'bp_wire_post_allowed_tags', '<a>,<b>,<strong>,<i>,<em>,<img>' ); … … 126 124 127 125 if ( !$table_name ) 128 $table_name = $bp [$component_name]['table_name_wire'];126 $table_name = $bp->{$component_name}->table_name_wire; 129 127 130 128 $wire_post = new BP_Wire_Post( $table_name, $wire_post_id ); 131 129 132 if ( !$bp ['is_item_admin']) {133 if ( $wire_post->user_id != $bp ['loggedin_userid'])130 if ( !$bp->is_item_admin ) { 131 if ( $wire_post->user_id != $bp->loggedin_user->id ) 134 132 return false; 135 133 } -
trunk/bp-wire/bp-wire-ajax.php
r531 r1021 22 22 <div class="wire-post-metadata"> 23 23 <?php bp_wire_post_author_avatar() ?> 24 On<?php bp_wire_post_date() ?>25 <?php bp_wire_post_author_name() ?> said:24 <?php _e( 'On', 'buddypress' ) ?> <?php bp_wire_post_date() ?> 25 <?php bp_wire_post_author_name() ?> <?php _e( 'said:', 'buddypress' ) ?> 26 26 <?php bp_wire_delete_link() ?> 27 27 </div> -
trunk/bp-wire/bp-wire-classes.php
r511 r1021 24 24 global $wpdb, $bp; 25 25 26 $sql = $wpdb->prepare( "SELECT * FROM " . $this->table_name . "WHERE id = %d", $this->id );26 $sql = $wpdb->prepare( "SELECT * FROM {$this->table_name} WHERE id = %d", $this->id ); 27 27 28 28 $wire_post = $wpdb->get_row($sql); … … 41 41 if ( $this->id ) { 42 42 $sql = $wpdb->prepare( 43 "UPDATE " . $this->table_name . "SET43 "UPDATE {$this->table_name} SET 44 44 item_id = %d, 45 45 user_id = %d, … … 57 57 } else { 58 58 $sql = $wpdb->prepare( 59 "INSERT INTO " . $this->table_name . "(59 "INSERT INTO {$this->table_name} ( 60 60 item_id, 61 61 user_id, … … 84 84 global $wpdb, $bp; 85 85 86 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $this->table_name . "WHERE id = %d", $this->id ) );86 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$this->table_name} WHERE id = %d", $this->id ) ); 87 87 } 88 88 … … 95 95 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 96 96 97 $wire_posts = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $table_name . "WHERE item_id = %d ORDER BY date_posted DESC $pag_sql", $item_id ) );98 $count = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM " . $table_name . "WHERE item_id = %d", $item_id ) );97 $wire_posts = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$table_name} WHERE item_id = %d ORDER BY date_posted DESC $pag_sql", $item_id ) ); 98 $count = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$table_name} WHERE item_id = %d", $item_id ) ); 99 99 100 100 return array( 'wire_posts' => $wire_posts, 'count' => $count ); -
trunk/bp-wire/bp-wire-templatetags.php
r900 r1021 21 21 global $bp; 22 22 23 if ( $bp ['current_component'] == $bp['wire']['slug']) {24 $this->table_name = $bp ['profile']['table_name_wire'];23 if ( $bp->current_component == $bp->wire->slug ) { 24 $this->table_name = $bp->profile->table_name_wire; 25 25 26 26 // Seeing as we're viewing a users wire, lets remove any new wire 27 27 // post notifications 28 if ( $bp ['current_action']== 'all-posts' )29 bp_core_delete_notifications_for_user_by_type( $bp ['loggedin_userid'], 'xprofile', 'new_wire_post' );28 if ( $bp->current_action == 'all-posts' ) 29 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'xprofile', 'new_wire_post' ); 30 30 31 31 } else { 32 $this->table_name = $bp [$bp['current_component']]['table_name_wire'];32 $this->table_name = $bp->{$bp->current_component}->table_name_wire; 33 33 } 34 34 … … 42 42 $this->wire_post_count = count($this->wire_posts); 43 43 44 if ( (int)get_site_option('non-friend-wire-posting') && ( $bp ['current_component'] == $bp['profile']['slug'] || $bp['current_component'] == $bp['wire']['slug']) )44 if ( (int)get_site_option('non-friend-wire-posting') && ( $bp->current_component == $bp->profile->slug || $bp->current_component == $bp->wire->slug ) ) 45 45 $this->can_post = 1; 46 46 else … … 48 48 49 49 $this->pag_links = paginate_links( array( 50 'base' => add_query_arg( 'wpage', '%#%', $bp ['current_domain']),50 'base' => add_query_arg( 'wpage', '%#%', $bp->displayed_user->domain ), 51 51 'format' => '', 52 52 'total' => ceil($this->total_wire_post_count / $this->pag_num), … … 217 217 global $bp; 218 218 219 echo apply_filters( 'bp_wire_ajax_loader_src', $bp ['wire']['image_base']. '/ajax-loader.gif' );219 echo apply_filters( 'bp_wire_ajax_loader_src', $bp->wire->image_base . '/ajax-loader.gif' ); 220 220 } 221 221 … … 257 257 global $bp; 258 258 259 if ( $bp['current_item'] == '')260 $uri = $bp ['current_action'];261 else 262 $uri = $bp ['current_item'];263 264 if ( $bp ['current_component'] == 'wire' || $bp['current_component']== 'profile' ) {265 echo apply_filters( 'bp_wire_get_action', $bp ['current_domain'] . $bp['wire']['slug']. '/post/' );259 if ( empty( $bp->current_item ) ) 260 $uri = $bp->current_action; 261 else 262 $uri = $bp->current_item; 263 264 if ( $bp->current_component == 'wire' || $bp->current_component == 'profile' ) { 265 echo apply_filters( 'bp_wire_get_action', $bp->displayed_user->domain . $bp->wire->slug . '/post/' ); 266 266 } else { 267 echo apply_filters( 'bp_wire_get_action', site_url() . '/' . $bp[$bp ['current_component']]['slug'] . '/' . $uri . '/wire/post/' );267 echo apply_filters( 'bp_wire_get_action', site_url() . '/' . $bp[$bp->current_component]['slug'] . '/' . $uri . '/wire/post/' ); 268 268 } 269 269 } … … 272 272 global $bp; 273 273 274 echo apply_filters( 'bp_wire_poster_avatar', bp_core_get_avatar( $bp ['loggedin_userid'], 1 ) );274 echo apply_filters( 'bp_wire_poster_avatar', bp_core_get_avatar( $bp->loggedin_user->id, 1 ) ); 275 275 } 276 276 … … 279 279 280 280 if ( $echo ) 281 echo apply_filters( 'bp_wire_poster_name', '<a href="' . $bp ['loggedin_domain'] . $bp['profile']['slug']. '">' . __('You', 'buddypress') . '</a>' );282 else 283 return apply_filters( 'bp_wire_poster_name', '<a href="' . $bp ['loggedin_domain'] . $bp['profile']['slug']. '">' . __('You', 'buddypress') . '</a>' );281 echo apply_filters( 'bp_wire_poster_name', '<a href="' . $bp->loggedin_user->domain . $bp->profile->slug . '">' . __('You', 'buddypress') . '</a>' ); 282 else 283 return apply_filters( 'bp_wire_poster_name', '<a href="' . $bp->loggedin_user->domain . $bp->profile->slug . '">' . __('You', 'buddypress') . '</a>' ); 284 284 } 285 285 … … 297 297 global $wire_posts_template, $bp; 298 298 299 if ( $bp['current_item'] == '')300 $uri = $bp ['current_action'];301 else 302 $uri = $bp ['current_item'];303 304 if ( ( $wire_posts_template->wire_post->user_id == $bp ['loggedin_userid'] ) || $bp['is_item_admin']) {305 if ( $bp ['current_component'] == 'wire' || $bp['current_component']== 'profile' ) {306 echo apply_filters( 'bp_wire_delete_link', '<a href="' . $bp ['current_domain'] . $bp['wire']['slug']. '/delete/' . $wire_posts_template->wire_post->id . '">[' . __('Delete', 'buddypress') . ']</a>' );299 if ( empty( $bp->current_item ) ) 300 $uri = $bp->current_action; 301 else 302 $uri = $bp->current_item; 303 304 if ( ( $wire_posts_template->wire_post->user_id == $bp->loggedin_user->id ) || $bp->is_item_admin ) { 305 if ( $bp->current_component == 'wire' || $bp->current_component == 'profile' ) { 306 echo apply_filters( 'bp_wire_delete_link', '<a href="' . $bp->displayed_user->domain . $bp->wire->slug . '/delete/' . $wire_posts_template->wire_post->id . '">[' . __('Delete', 'buddypress') . ']</a>' ); 307 307 } else { 308 echo apply_filters( 'bp_wire_delete_link', '<a href="' . site_url() . '/' . $bp[$bp ['current_component']]['slug'] . '/' . $uri . '/wire/delete/' . $wire_posts_template->wire_post->id . '">[' . __('Delete', 'buddypress') . ']</a>' );308 echo apply_filters( 'bp_wire_delete_link', '<a href="' . site_url() . '/' . $bp[$bp->current_component]['slug'] . '/' . $uri . '/wire/delete/' . $wire_posts_template->wire_post->id . '">[' . __('Delete', 'buddypress') . ']</a>' ); 309 309 } 310 310 } … … 314 314 global $bp; 315 315 316 if ( $bp['current_item'] == '')317 $uri = $bp ['current_action'];318 else 319 $uri = $bp ['current_item'];320 321 if ( $bp ['current_component'] == 'wire' || $bp['current_component']== 'profile') {322 echo apply_filters( 'bp_wire_see_all_link', $bp ['current_domain'] . $bp['wire']['slug']);316 if ( empty( $bp->current_item ) ) 317 $uri = $bp->current_action; 318 else 319 $uri = $bp->current_item; 320 321 if ( $bp->current_component == 'wire' || $bp->current_component == 'profile') { 322 echo apply_filters( 'bp_wire_see_all_link', $bp->displayed_user->domain . $bp->wire->slug ); 323 323 } else { 324 echo apply_filters( 'bp_wire_see_all_link', $bp ['root_domain'] . '/' . $bp['groups']['slug']. '/' . $uri . '/wire' );324 echo apply_filters( 'bp_wire_see_all_link', $bp->root_domain . '/' . $bp->groups->slug . '/' . $uri . '/wire' ); 325 325 } 326 326 } -
trunk/bp-xprofile.php
r1017 r1021 49 49 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 50 50 51 if ( get_site_option( 'bp-xprofile-base-group-name' ) == '')51 if ( '' == get_site_option( 'bp-xprofile-base-group-name' ) ) 52 52 update_site_option( 'bp-xprofile-base-group-name', 'Base' ); 53 53 54 if ( get_site_option( 'bp-xprofile-fullname-field-name' ) == '')54 if ( '' == get_site_option( 'bp-xprofile-fullname-field-name' ) ) 55 55 update_site_option( 'bp-xprofile-fullname-field-name', 'Full Name' ); 56 56 57 $sql[] = "CREATE TABLE " . $bp['profile']['table_name_groups'] . "(57 $sql[] = "CREATE TABLE {$bp->profile->table_name_groups} ( 58 58 id int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, 59 59 name varchar(150) NOT NULL, … … 63 63 ) {$charset_collate};"; 64 64 65 $sql[] = "CREATE TABLE " . $bp['profile']['table_name_fields'] . "(65 $sql[] = "CREATE TABLE {$bp->profile->table_name_fields} ( 66 66 id int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, 67 67 group_id int(11) unsigned NOT NULL, … … 84 84 ) {$charset_collate};"; 85 85 86 $sql[] = "CREATE TABLE " . $bp['profile']['table_name_data'] . "(86 $sql[] = "CREATE TABLE {$bp->profile->table_name_data} ( 87 87 id int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, 88 88 field_id int(11) unsigned NOT NULL, … … 94 94 ) {$charset_collate};"; 95 95 96 if ( get_site_option( 'bp-xprofile-db-version' ) == '') {97 $sql[] = "INSERT INTO ". $bp['profile']['table_name_groups'] . "VALUES ( 1, '" . get_site_option( 'bp-xprofile-base-group-name' ) . "', '', 0 );";98 99 $sql[] = "INSERT INTO ". $bp['profile']['table_name_fields'] . "(96 if ( '' == get_site_option( 'bp-xprofile-db-version' ) ) { 97 $sql[] = "INSERT INTO {$bp->profile->table_name_groups} VALUES ( 1, '" . get_site_option( 'bp-xprofile-base-group-name' ) . "', '', 0 );"; 98 99 $sql[] = "INSERT INTO {$bp->profile->table_name_fields} ( 100 100 id, group_id, parent_id, type, name, description, is_required, field_order, option_order, order_by, is_public, can_delete 101 101 ) VALUES ( … … 117 117 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 118 118 119 $sql[] = "CREATE TABLE ". $bp['profile']['table_name_wire'] ."(120 id int(11) NOT NULL AUTO_INCREMENT,121 item_id int(11) NOT NULL,122 user_id int(11) NOT NULL,123 content longtext NOT NULL,124 date_posted datetime NOT NULL,125 PRIMARY KEY id (id),126 KEY item_id (item_id),127 KEY user_id (user_id)128 ) {$charset_collate};";119 $sql[] = "CREATE TABLE {$bp->profile->table_name_wire} ( 120 id int(11) NOT NULL AUTO_INCREMENT, 121 item_id int(11) NOT NULL, 122 user_id int(11) NOT NULL, 123 content longtext NOT NULL, 124 date_posted datetime NOT NULL, 125 PRIMARY KEY id (id), 126 KEY item_id (item_id), 127 KEY user_id (user_id) 128 ) {$charset_collate};"; 129 129 130 130 require_once( ABSPATH . 'wp-admin/upgrade-functions.php' ); … … 146 146 global $bp, $wpdb; 147 147 148 $bp['profile'] = array( 149 'table_name_groups' => $wpdb->base_prefix . 'bp_xprofile_groups', 150 'table_name_fields' => $wpdb->base_prefix . 'bp_xprofile_fields', 151 'table_name_data' => $wpdb->base_prefix . 'bp_xprofile_data', 152 'format_activity_function' => 'xprofile_format_activity', 153 'image_base' => site_url( MUPLUGINDIR . '/bp-xprofile/images' ), 154 'slug' => BP_XPROFILE_SLUG 155 ); 156 157 $bp['version_numbers'][$bp['profile']['slug']] = BP_XPROFILE_VERSION; 148 $bp->profile->table_name_groups = $wpdb->base_prefix . 'bp_xprofile_groups'; 149 $bp->profile->table_name_fields = $wpdb->base_prefix . 'bp_xprofile_fields'; 150 $bp->profile->table_name_data = $wpdb->base_prefix . 'bp_xprofile_data'; 151 $bp->profile->format_activity_function = 'xprofile_format_activity'; 152 $bp->profile->image_base = site_url( MUPLUGINDIR . '/bp-xprofile/images' ); 153 $bp->profile->slug = BP_XPROFILE_SLUG; 154 155 $bp->version_numbers->profile = BP_XPROFILE_VERSION; 158 156 159 157 if ( function_exists('bp_wire_install') ) 160 $bp ['profile']['table_name_wire']= $wpdb->base_prefix . 'bp_xprofile_wire';158 $bp->profile->table_name_wire = $wpdb->base_prefix . 'bp_xprofile_wire'; 161 159 } 162 160 add_action( 'wp', 'xprofile_setup_globals', 1 ); … … 189 187 190 188 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 191 if ( ( $wpdb->get_var("SHOW TABLES LIKE '% " . $bp['profile']['table_name_groups'] . "%'") == false ) || ( get_site_option('bp-xprofile-db-version') < BP_XPROFILE_DB_VERSION ) )189 if ( ( $wpdb->get_var("SHOW TABLES LIKE '%{$bp->profile->table_name_groups}%'") == false ) || ( get_site_option('bp-xprofile-db-version') < BP_XPROFILE_DB_VERSION ) ) 192 190 xprofile_install(); 193 191 194 if ( ( function_exists('bp_wire_install') && $wpdb->get_var("SHOW TABLES LIKE '% " . $bp['profile']['table_name_wire'] . "%'") == false ) || ( get_site_option('bp-xprofile-db-version') < BP_XPROFILE_DB_VERSION ) )192 if ( ( function_exists('bp_wire_install') && $wpdb->get_var("SHOW TABLES LIKE '%{$bp->profile->table_name_wire}%'") == false ) || ( get_site_option('bp-xprofile-db-version') < BP_XPROFILE_DB_VERSION ) ) 195 193 xprofile_wire_install(); 196 194 } … … 214 212 215 213 /* Add 'Profile' to the main navigation */ 216 bp_core_add_nav_item( __('Profile', 'buddypress'), $bp ['profile']['slug']);217 bp_core_add_nav_default( $bp ['profile']['slug'], 'xprofile_screen_display_profile', 'public' );218 219 $profile_link = $bp ['loggedin_domain'] . $bp['profile']['slug']. '/';214 bp_core_add_nav_item( __('Profile', 'buddypress'), $bp->profile->slug ); 215 bp_core_add_nav_default( $bp->profile->slug, 'xprofile_screen_display_profile', 'public' ); 216 217 $profile_link = $bp->loggedin_user->domain . $bp->profile->slug . '/'; 220 218 221 219 /* Add the subnav items to the profile */ 222 bp_core_add_subnav_item( $bp ['profile']['slug'], 'public', __('Public', 'buddypress'), $profile_link, 'xprofile_screen_display_profile' );223 bp_core_add_subnav_item( $bp ['profile']['slug'], 'edit', __('Edit Profile', 'buddypress'), $profile_link, 'xprofile_screen_edit_profile' );224 bp_core_add_subnav_item( $bp ['profile']['slug'], 'change-avatar', __('Change Avatar', 'buddypress'), $profile_link, 'xprofile_screen_change_avatar' );225 226 if ( $bp ['current_component'] == $bp['profile']['slug']) {220 bp_core_add_subnav_item( $bp->profile->slug, 'public', __('Public', 'buddypress'), $profile_link, 'xprofile_screen_display_profile' ); 221 bp_core_add_subnav_item( $bp->profile->slug, 'edit', __('Edit Profile', 'buddypress'), $profile_link, 'xprofile_screen_edit_profile' ); 222 bp_core_add_subnav_item( $bp->profile->slug, 'change-avatar', __('Change Avatar', 'buddypress'), $profile_link, 'xprofile_screen_change_avatar' ); 223 224 if ( $bp->current_component == $bp->profile->slug ) { 227 225 if ( bp_is_home() ) { 228 $bp ['bp_options_title']= __('My Profile', 'buddypress');226 $bp->bp_options_title = __('My Profile', 'buddypress'); 229 227 } else { 230 $bp ['bp_options_avatar'] = bp_core_get_avatar( $bp['current_userid'], 1 );231 $bp ['bp_options_title'] = $bp['current_fullname'];228 $bp->bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 ); 229 $bp->bp_options_title = $bp->displayed_user->fullname; 232 230 } 233 231 } … … 254 252 // logged in user. $is_new_friend is set in bp-core/bp-core-catchuri.php in bp_core_set_uri_globals() 255 253 if ( $is_new_friend ) 256 bp_core_delete_notifications_for_user_by_item_id( $bp ['loggedin_userid'], $bp['current_userid'], 'friends', 'friendship_accepted' );254 bp_core_delete_notifications_for_user_by_item_id( $bp->loggedin_user->id, $bp->displayed_user->id, 'friends', 'friendship_accepted' ); 257 255 258 256 do_action( 'xprofile_screen_display_profile', $is_new_friend ); … … 307 305 function xprofile_screen_notification_settings() { 308 306 global $current_user; ?> 307 <?php if ( function_exists('bp_wire_install') ) { ?> 309 308 <table class="notification-settings" id="profile-notification-settings"> 310 309 <tr> … … 314 313 <th class="no"><?php _e( 'No', 'buddypress' )?></th> 315 314 </tr> 316 <?php if ( function_exists('bp_wire_install') ) { ?> 315 317 316 <tr> 318 317 <td></td> … … 321 320 <td class="no"><input type="radio" name="notifications[notification_profile_wire_post]" value="no" <?php if ( get_usermeta( $current_user->id, 'notification_profile_wire_post' ) == 'no' ) { ?>checked="checked" <?php } ?>/></td> 322 321 </tr> 323 <?php } ?>324 322 325 323 <?php do_action( 'xprofile_screen_notification_settings' ) ?> 326 324 </table> 325 <?php } ?> 327 326 <?php 328 327 } … … 346 345 global $bp; 347 346 348 if ( 'delete-avatar' != $bp ['current_action'])347 if ( 'delete-avatar' != $bp->current_action ) 349 348 return false; 350 349 … … 371 370 global $bp; 372 371 373 if ( $bp ['current_component'] != $bp['wire']['slug'])372 if ( $bp->current_component != $bp->wire->slug ) 374 373 return false; 375 374 376 if ( 'post' != $bp ['current_action'])375 if ( 'post' != $bp->current_action ) 377 376 return false; 378 377 379 if ( !$wire_post_id = bp_wire_new_post( $bp ['current_userid'], $_POST['wire-post-textarea'], $bp['profile']['slug'], false, $bp['profile']['table_name_wire']) ) {378 if ( !$wire_post_id = bp_wire_new_post( $bp->displayed_user->id, $_POST['wire-post-textarea'], $bp->profile->slug, false, $bp->profile->table_name_wire ) ) { 380 379 bp_core_add_message( __('Wire message could not be posted. Please try again.', 'buddypress'), 'error' ); 381 380 } else { … … 385 384 } 386 385 387 if ( !strpos( $_SERVER['HTTP_REFERER'], $bp ['wire']['slug']) ) {388 bp_core_redirect( $bp ['current_domain']);386 if ( !strpos( $_SERVER['HTTP_REFERER'], $bp->wire->slug ) ) { 387 bp_core_redirect( $bp->displayed_user->domain ); 389 388 } else { 390 bp_core_redirect( $bp ['current_domain'] . $bp['wire']['slug']);389 bp_core_redirect( $bp->displayed_user->domain . $bp->wire->slug ); 391 390 } 392 391 } … … 408 407 global $bp; 409 408 410 if ( $bp ['current_component'] != $bp['wire']['slug'])409 if ( $bp->current_component != $bp->wire->slug ) 411 410 return false; 412 411 413 if ( $bp ['current_action']!= 'delete' )412 if ( $bp->current_action != 'delete' ) 414 413 return false; 415 414 416 $wire_post_id = $bp ['action_variables'][0];417 418 if ( bp_wire_delete_post( $wire_post_id, $bp ['profile']['slug'], $bp['profile']['table_name_wire']) ) {415 $wire_post_id = $bp->action_variables[0]; 416 417 if ( bp_wire_delete_post( $wire_post_id, $bp->profile->slug, $bp->profile->table_name_wire ) ) { 419 418 bp_core_add_message( __('Wire message successfully deleted.', 'buddypress') ); 420 419 … … 424 423 } 425 424 426 if ( !strpos( $_SERVER['HTTP_REFERER'], $bp ['wire']['slug']) ) {427 bp_core_redirect( $bp ['current_domain']);425 if ( !strpos( $_SERVER['HTTP_REFERER'], $bp->wire->slug ) ) { 426 bp_core_redirect( $bp->displayed_user->domain ); 428 427 } else { 429 bp_core_redirect( $bp ['current_domain']. $bp['wire']['slug']);428 bp_core_redirect( $bp->displayed_user->domain. $bp->wire->slug ); 430 429 } 431 430 } … … 499 498 case 'new_wire_post': 500 499 if ( class_exists('BP_Wire_Post') ) { 501 $wire_post = new BP_Wire_Post( $bp ['profile']['table_name_wire'], $item_id );500 $wire_post = new BP_Wire_Post( $bp->profile->table_name_wire, $item_id ); 502 501 } 503 502 … … 505 504 return false; 506 505 507 if ( ( $wire_post->item_id == $bp ['loggedin_userid'] && $wire_post->user_id == $bp['loggedin_userid'] ) || ( $wire_post->item_id == $bp['current_userid'] && $wire_post->user_id == $bp['current_userid']) ) {506 if ( ( $wire_post->item_id == $bp->loggedin_user->id && $wire_post->user_id == $bp->loggedin_user->id ) || ( $wire_post->item_id == $bp->displayed_user->id && $wire_post->user_id == $bp->displayed_user->id ) ) { 508 507 509 508 $from_user_link = bp_core_get_userlink($wire_post->user_id); … … 513 512 $return_values['primary_link'] = bp_core_get_userlink( $wire_post->user_id, false, true ); 514 513 515 } else if ( ( $wire_post->item_id != $bp ['loggedin_userid'] && $wire_post->user_id == $bp['loggedin_userid'] ) || ( $wire_post->item_id != $bp['current_userid'] && $wire_post->user_id == $bp['current_userid']) ) {514 } else if ( ( $wire_post->item_id != $bp->loggedin_user->id && $wire_post->user_id == $bp->loggedin_user->id ) || ( $wire_post->item_id != $bp->displayed_user->id && $wire_post->user_id == $bp->displayed_user->id ) ) { 516 515 517 516 $from_user_link = bp_core_get_userlink($wire_post->user_id); … … 546 545 return array( 547 546 'primary_link' => bp_core_get_userlink( $user_id, false, true ), 548 'content' => apply_filters( 'xprofile_updated_profile_activity', sprintf( __('%s updated the "%s" information on their profile', 'buddypress'), $user_link, '<a href="' . $bp ['current_domain'] . $bp['profile']['slug']. '">' . $profile_group->name . '</a>' ) . ' <span class="time-since">%s</span>', $user_link, $profile_group->name )547 'content' => apply_filters( 'xprofile_updated_profile_activity', sprintf( __('%s updated the "%s" information on their profile', 'buddypress'), $user_link, '<a href="' . $bp->displayed_user->domain . $bp->profile->slug . '">' . $profile_group->name . '</a>' ) . ' <span class="time-since">%s</span>', $user_link, $profile_group->name ) 549 548 ); 550 549 break; … … 574 573 if ( $action == 'new_wire_post') { 575 574 if ( (int)$total_items > 1 ) { 576 return apply_filters( 'bp_xprofile_multiple_new_wire_post_notification', '<a href="' . $bp ['loggedin_domain'] . $bp['wire']['slug']. '" title="Wire">' . sprintf( __('You have %d new posts on your wire'), (int)$total_items ) . '</a>', $total_items );575 return apply_filters( 'bp_xprofile_multiple_new_wire_post_notification', '<a href="' . $bp->loggedin_user->domain . $bp->wire->slug . '" title="Wire">' . sprintf( __('You have %d new posts on your wire'), (int)$total_items ) . '</a>', $total_items ); 577 576 } else { 578 577 $user_fullname = bp_core_global_user_fullname( $item_id ); 579 return apply_filters( 'bp_xprofile_single_new_wire_post_notification', '<a href="' . $bp ['loggedin_domain'] . $bp['wire']['slug']. '" title="Wire">' . sprintf( __('%s posted on your wire'), $user_fullname ) . '</a>', $user_fullname );578 return apply_filters( 'bp_xprofile_single_new_wire_post_notification', '<a href="' . $bp->loggedin_user->domain . $bp->wire->slug . '" title="Wire">' . sprintf( __('%s posted on your wire'), $user_fullname ) . '</a>', $user_fullname ); 580 579 } 581 580 } … … 647 646 // If the field is required and has been left blank then we need to add a callback error. 648 647 if ( ( $field->is_required && !isset($current_field) ) || 649 ( $field->is_required && $current_field == '') ) {648 ( $field->is_required && empty( $current_field ) ) ) { 650 649 651 650 // Add the error message to the errors array … … 655 654 // If the field is not required and the field has been left blank, delete any values for the 656 655 // field from the database. 657 } else if ( !$field->is_required && ( $current_field == ''|| is_null($current_field) ) ) {656 } else if ( !$field->is_required && ( empty( $current_field ) || is_null($current_field) ) ) { 658 657 659 658 // Create a new profile data object for the logged in user based on field ID. … … 795 794 $field_data[0]->value = xprofile_format_profile_field( $field_data[0]->type, $field_data[0]->value ); 796 795 797 if ( !$field_data[0]->value || $field_data[0]->value == '')796 if ( !$field_data[0]->value || empty( $field_data[0]->value ) ) 798 797 return false; 799 798 … … 813 812 */ 814 813 function xprofile_format_profile_field( $field_type, $field_value ) { 815 if ( !isset($field_value) || $field_value == '')814 if ( !isset($field_value) || empty( $field_value ) ) 816 815 return false; 817 816 -
trunk/bp-xprofile/bp-xprofile-admin.php
r1017 r1021 98 98 <td><span title="<?php echo $field->desc; ?>"><?php echo $field->name; ?> <?php if(!$field->can_delete) { ?>(Core)<?php } ?></span></td> 99 99 <td><?php echo $field->type; ?></td> 100 <td style="text-align:center;"><?php if ( $field->is_required ) { echo '<img src="' . $bp ['profile']['image_base']. '/tick.gif" alt="Yes" />'; } else { ?>--<?php } ?></td>100 <td style="text-align:center;"><?php if ( $field->is_required ) { echo '<img src="' . $bp->profile->image_base . '/tick.gif" alt="Yes" />'; } else { ?>--<?php } ?></td> 101 101 <td style="text-align:center;"><?php if ( !$field->can_delete ) { ?><strike><?php _e( 'Edit', 'buddypress' ) ?></strike><?php } else { ?><a class="edit" href="admin.php?page=xprofile_settings&group_id=<?php echo $groups[$i]->id; ?>&field_id=<?php echo $field->id; ?>&mode=edit_field"><?php _e( 'Edit', 'buddypress' ) ?></a><?php } ?></td> 102 102 <td style="text-align:center;"><?php if ( !$field->can_delete ) { ?><strike><?php _e( 'Delete', 'buddypress' ) ?></strike><?php } else { ?><a class="delete" href="admin.php?page=xprofile_settings&field_id=<?php echo $field->id; ?>&mode=delete_field"><?php _e( 'Delete', 'buddypress' ) ?></a><?php } ?></td> -
trunk/bp-xprofile/bp-xprofile-classes.php
r850 r1021 29 29 global $wpdb, $bp; 30 30 31 $sql = $wpdb->prepare("SELECT * FROM " . $bp['profile']['table_name_groups'] . "WHERE id = %d", $id);31 $sql = $wpdb->prepare("SELECT * FROM {$bp->profile->table_name_groups} WHERE id = %d", $id); 32 32 33 33 if ( $group = $wpdb->get_row($sql) ) { … … 47 47 48 48 if ( $this->id != null ) { 49 $sql = $wpdb->prepare("UPDATE " . $bp['profile']['table_name_groups'] . "SET name = %s, description = %s WHERE id = %d", $this->name, $this->description, $this->id);50 } else { 51 $sql = $wpdb->prepare("INSERT INTO " . $bp['profile']['table_name_groups'] . "(name, description, can_delete) VALUES (%s, %s, 1)", $this->name, $this->description);49 $sql = $wpdb->prepare("UPDATE {$bp->profile->table_name_groups} SET name = %s, description = %s WHERE id = %d", $this->name, $this->description, $this->id); 50 } else { 51 $sql = $wpdb->prepare("INSERT INTO {$bp->profile->table_name_groups} (name, description, can_delete) VALUES (%s, %s, 1)", $this->name, $this->description); 52 52 } 53 53 … … 64 64 return false; 65 65 66 $sql = $wpdb->prepare( "DELETE FROM " . $bp['profile']['table_name_groups'] . " WHERE id = %d", $this->id);66 $sql = $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_groups} WHERE id = %d", $this->id ); 67 67 68 68 if ( $wpdb->query($sql) === false) { … … 85 85 86 86 // Get field ids for the current group. 87 $sql = $wpdb->prepare("SELECT id, type FROM " . $bp['profile']['table_name_fields'] . "WHERE group_id = %d AND parent_id = 0 ORDER BY id", $this->id);87 $sql = $wpdb->prepare("SELECT id, type FROM {$bp->profile->table_name_fields} WHERE group_id = %d AND parent_id = 0 ORDER BY id", $this->id); 88 88 89 89 if(!$fields = $wpdb->get_results($sql)) … … 143 143 144 144 if ( $hide_empty ) { 145 $sql = $wpdb->prepare( "SELECT DISTINCT g.* FROM " . $bp['profile']['table_name_groups'] . " g INNER JOIN " . $bp['profile']['table_name_fields'] . " f ON g.id = f.group_id ORDER BY g.id ASC");146 } else { 147 $sql = $wpdb->prepare( "SELECT * FROM " . $bp['profile']['table_name_groups'] . " ORDER BY id ASC");145 $sql = $wpdb->prepare( "SELECT DISTINCT g.* FROM {$bp->profile->table_name_groups} g INNER JOIN {$bp->profile->table_name_fields} f ON g.id = f.group_id ORDER BY g.id ASC" ); 146 } else { 147 $sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_groups} ORDER BY id ASC" ); 148 148 } 149 149 … … 163 163 164 164 // Validate Form 165 if ( $_POST['group_name'] == '') {165 if ( empty( $_POST['group_name'] ) ) { 166 166 $message = __('Please make sure you give the group a name.', 'buddypress'); 167 167 return false; … … 204 204 } 205 205 206 $sql = $wpdb->prepare( "SELECT * FROM " . $bp['profile']['table_name_fields'] . " WHERE id = %d", $id);206 $sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_fields} WHERE id = %d", $id ); 207 207 208 208 if ( $field = $wpdb->get_row($sql) ) { … … 233 233 return false; 234 234 235 $sql = $wpdb->prepare("DELETE FROM " . $bp['profile']['table_name_fields'] . " WHERE id = %d OR parent_id = %d", $this->id, $this->id);235 $sql = $wpdb->prepare("DELETE FROM {$bp->profile->table_name_fields} WHERE id = %d OR parent_id = %d", $this->id, $this->id ); 236 236 237 237 if ( $wpdb->query($sql) === false ) … … 248 248 249 249 if ( $this->id != null ) { 250 $sql = $wpdb->prepare("UPDATE " . $bp['profile']['table_name_fields'] . "SET group_id = %d, parent_id = 0, type = %s, name = %s, description = %s, is_required = %d, is_public = %d, order_by = %s WHERE id = %d", $this->group_id, $this->type, $this->name, $this->desc, $this->is_required, $this->is_public, $this->order_by, $this->id);251 } else { 252 $sql = $wpdb->prepare("INSERT INTO " . $bp['profile']['table_name_fields'] . "(group_id, parent_id, type, name, description, is_required, is_public, order_by) VALUES (%d, 0, %s, %s, %s, %d, %d, %s)", $this->group_id, $this->type, $this->name, $this->desc, $this->is_required, $this->is_public, $this->order_by);250 $sql = $wpdb->prepare("UPDATE {$bp->profile->table_name_fields} SET group_id = %d, parent_id = 0, type = %s, name = %s, description = %s, is_required = %d, is_public = %d, order_by = %s WHERE id = %d", $this->group_id, $this->type, $this->name, $this->desc, $this->is_required, $this->is_public, $this->order_by, $this->id); 251 } else { 252 $sql = $wpdb->prepare("INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, is_public, order_by) VALUES (%d, 0, %s, %s, %s, %d, %d, %s)", $this->group_id, $this->type, $this->name, $this->desc, $this->is_required, $this->is_public, $this->order_by); 253 253 } 254 254 if ( $wpdb->query($sql) !== false ) { … … 298 298 299 299 if ( $num > 0 ) { 300 $sql = $wpdb->prepare( "INSERT INTO " . $bp['profile']['table_name_fields'] . "(group_id, parent_id, type, name, description, is_required, option_order) VALUES (%d, %d, 'option', %s, %s, 0, %d)", $this->group_id, $parent_id, $name, $description, $option_order);300 $sql = $wpdb->prepare( "INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, option_order) VALUES (%d, %d, 'option', %s, %s, 0, %d)", $this->group_id, $parent_id, $name, $description, $option_order); 301 301 $wpdb->query($sql); 302 302 } … … 334 334 if ( $option_value != "" ) { 335 335 // don't insert an empty option. 336 $sql = $wpdb->prepare("INSERT INTO " . $bp['profile']['table_name_fields'] . "(group_id, parent_id, type, name, description, is_required, option_order, is_default_option) VALUES (%d, %d, 'option', %s, '', 0, %d, %d)", $this->group_id, $parent_id, $option_value, $counter, $is_default);336 $sql = $wpdb->prepare("INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, option_order, is_default_option) VALUES (%d, %d, 'option', %s, '', 0, %d, %d)", $this->group_id, $parent_id, $option_value, $counter, $is_default); 337 337 338 338 if ( $wpdb->query($sql) === false ) { … … 464 464 465 465 if ( !$this->is_required ) { 466 $html .= '<a class="clear-value" style="text-decoration: none;" href="javascript:clear(\'field_' . $this->id . '\');"><img src="' . $bp ['profile']['image_base']. '/cross.gif" alt="Clear" /> Clear</a>';466 $html .= '<a class="clear-value" style="text-decoration: none;" href="javascript:clear(\'field_' . $this->id . '\');"><img src="' . $bp->profile->image_base . '/cross.gif" alt="Clear" /> Clear</a>'; 467 467 } 468 468 … … 596 596 } 597 597 598 $sql = $wpdb->prepare( "SELECT * FROM " . $bp['profile']['table_name_fields'] . "WHERE parent_id = %d AND group_id = %d $sort_sql", $parent_id, $this->group_id );598 $sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_fields} WHERE parent_id = %d AND group_id = %d $sort_sql", $parent_id, $this->group_id ); 599 599 600 600 if ( !$children = $wpdb->get_results($sql) ) … … 607 607 global $wpdb, $bp; 608 608 609 $sql = $wpdb->prepare("DELETE FROM " . $bp['profile']['table_name_fields'] . "WHERE parent_id = %d", $this->id);609 $sql = $wpdb->prepare("DELETE FROM {$bp->profile->table_name_fields} WHERE parent_id = %d", $this->id); 610 610 611 611 $wpdb->query($sql); … … 738 738 <p class="submit"> 739 739 <input type="submit" value="<?php _e("Save", 'buddypress') ?> »" name="saveField" id="saveField" style="font-weight: bold" /> 740 <?php _e('or', 'buddypress') ?> <a href="admin.php?page=xprofile_settings" style="color: red"><?php _e( 'Cancel', 'buddypress') ?></a>740 <?php _e('or', 'buddypress') ?> <a href="admin.php?page=xprofile_settings" style="color: red"><?php _e( 'Cancel', 'buddypress' ) ?></a> 741 741 </p> 742 742 … … 751 751 <div class="clear"> </div><br /> 752 752 753 <h2> Add Prebuilt Field</h2>753 <h2><?php _e( 'Add Prebuilt Field', 'buddypress' ) ?></h2> 754 754 <?php $this->render_prebuilt_fields(); ?> 755 755 … … 894 894 global $wpdb, $bp; 895 895 896 $sql = $wpdb->prepare( "SELECT f.id FROM " . $bp['profile']['table_name_fields'] . " AS f, " . $bp['profile']['table_name_groups'] . "AS g WHERE g.name = %s AND f.parent_id = 0 AND g.id = f.group_id ORDER BY f.id", get_site_option('bp-xprofile-base-group-name') );896 $sql = $wpdb->prepare( "SELECT f.id FROM {$bp->profile->table_name_fields} AS f, {$bp->profile->table_name_groups} AS g WHERE g.name = %s AND f.parent_id = 0 AND g.id = f.group_id ORDER BY f.id", get_site_option('bp-xprofile-base-group-name') ); 897 897 898 898 if ( !$temp_fields = $wpdb->get_results($sql) ) … … 910 910 911 911 // Validate Form 912 if ( $_POST['title'] == '' || $_POST['required'] == '' || $_POST['fieldtype'] == '') {912 if ( empty( $_POST['title'] ) || empty( $_POST['required'] ) || empty( $_POST['fieldtype'] ) ) { 913 913 $message = __('Please make sure you fill out all required fields.', 'buddypress'); 914 914 return false; … … 934 934 935 935 if ( $field_id ) { 936 $sql = $wpdb->prepare( "SELECT type FROM " . $bp['profile']['table_name_fields'] . " WHERE id = %d", $field_id);936 $sql = $wpdb->prepare( "SELECT type FROM {$bp->profile->table_name_fields} WHERE id = %d", $field_id ); 937 937 938 938 if ( !$field_type = $wpdb->get_var($sql) ) … … 949 949 950 950 if ( $group_id ) { 951 $sql = $wpdb->prepare( "DELETE FROM " . $bp['profile']['table_name_fields'] . " WHERE group_id = %d", $group_id);951 $sql = $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_fields} WHERE group_id = %d", $group_id ); 952 952 953 953 if ( $wpdb->get_var($sql) === false ) { … … 982 982 $user_id = $userdata->ID; 983 983 984 $sql = $wpdb->prepare( "SELECT * FROM " . $bp['profile']['table_name_data'] . " WHERE field_id = %d AND user_id = %d", $field_id, $user_id);984 $sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id = %d", $field_id, $user_id ); 985 985 986 986 if ( $profiledata = $wpdb->get_row($sql) ) { … … 997 997 998 998 // check to see if there is data already for the user. 999 $sql = $wpdb->prepare( "SELECT id FROM " . $bp['profile']['table_name_data'] . " WHERE user_id = %d AND field_id = %d", $userdata->ID, $this->field_id);999 $sql = $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_data} WHERE user_id = %d AND field_id = %d", $userdata->ID, $this->field_id ); 1000 1000 1001 1001 if ( !$wpdb->get_row($sql) ) … … 1009 1009 1010 1010 // check to see if this data is actually for a valid field. 1011 $sql = $wpdb->prepare("SELECT id FROM " . $bp['profile']['table_name_fields'] . " WHERE id = %d", $this->field_id);1011 $sql = $wpdb->prepare("SELECT id FROM {$bp->profile->table_name_fields} WHERE id = %d", $this->field_id ); 1012 1012 1013 1013 if ( !$wpdb->get_row($sql) ) … … 1024 1024 if ( $this->is_valid_field() ) { 1025 1025 if ( $this->exists() && $this->value != '' ) { 1026 $sql = $wpdb->prepare( "UPDATE " . $bp['profile']['table_name_data'] . " SET value = %s, last_updated = %s WHERE user_id = %d AND field_id = %d", $this->value, $this->last_updated, $this->user_id, $this->field_id);1027 } else if ( $this->exists() and $this->value == '') {1026 $sql = $wpdb->prepare( "UPDATE {$bp->profile->table_name_data} SET value = %s, last_updated = %s WHERE user_id = %d AND field_id = %d", $this->value, $this->last_updated, $this->user_id, $this->field_id ); 1027 } else if ( $this->exists() && empty( $this->value ) ) { 1028 1028 // Data removed, delete the entry. 1029 1029 $this->delete(); 1030 1030 } else { 1031 $sql = $wpdb->prepare("INSERT INTO " . $bp['profile']['table_name_data'] . " (user_id, field_id, value, last_updated) VALUES (%d, %d, %s, %s)", $this->user_id, $this->field_id, $this->value, $this->last_updated);1031 $sql = $wpdb->prepare("INSERT INTO {$bp->profile->table_name_data} (user_id, field_id, value, last_updated) VALUES (%d, %d, %s, %s)", $this->user_id, $this->field_id, $this->value, $this->last_updated ); 1032 1032 } 1033 1033 … … 1047 1047 global $wpdb, $bp; 1048 1048 1049 $sql = $wpdb->prepare( "DELETE FROM " . $bp['profile']['table_name_data'] . " WHERE field_id = %d AND user_id = %d", $this->field_id, $this->user_id);1049 $sql = $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id = %d", $this->field_id, $this->user_id ); 1050 1050 1051 1051 if ( $wpdb->query($sql) === false ) … … 1061 1061 1062 1062 if ( !$user_id ) 1063 $user_id = $bp ['current_userid'];1064 1065 $sql = $wpdb->prepare("SELECT * FROM " . $bp['profile']['table_name_data'] . "WHERE field_id = %d AND user_id = %d", $field_id, $user_id );1063 $user_id = $bp->displayed_user->id; 1064 1065 $sql = $wpdb->prepare("SELECT * FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id = %d", $field_id, $user_id ); 1066 1066 1067 1067 if ( $profile_data = $wpdb->get_row($sql) ) { … … 1079 1079 1080 1080 if ( !$user_id ) 1081 $user_id = $bp ['current_userid'];1082 1083 if ( !$bp ['profile'])1081 $user_id = $bp->displayed_user->id; 1082 1083 if ( !$bp->profile ) 1084 1084 xprofile_setup_globals(); 1085 1085 … … 1099 1099 } 1100 1100 1101 $sql = $wpdb->prepare( "SELECT d.value, f.name FROM " . $bp['profile']['table_name_data'] . " d, " . $bp['profile']['table_name_fields'] . "f WHERE d.field_id = f.id AND d.user_id = %d AND f.parent_id = 0 $field_sql", $user_id );1101 $sql = $wpdb->prepare( "SELECT d.value, f.name FROM {$bp->profile->table_name_data} d, {$bp->profile->table_name_fields} f WHERE d.field_id = f.id AND d.user_id = %d AND f.parent_id = 0 $field_sql", $user_id ); 1102 1102 1103 1103 if ( !$values = $wpdb->get_results($sql) ) … … 1126 1126 global $wpdb, $userdata, $bp; 1127 1127 1128 $sql = $wpdb->prepare( "DELETE FROM " . $bp['profile']['table_name_data'] . " WHERE field_id = %d", $field_id);1128 $sql = $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_data} WHERE field_id = %d", $field_id ); 1129 1129 1130 1130 if ( $wpdb->query($sql) === false ) … … 1137 1137 global $wpdb, $bp; 1138 1138 1139 $last_updated = $wpdb->get_var( $wpdb->prepare( "SELECT last_updated FROM " . $bp['profile']['table_name_data'] . "WHERE user_id = %d ORDER BY last_updated LIMIT 1", $user_id ) );1139 $last_updated = $wpdb->get_var( $wpdb->prepare( "SELECT last_updated FROM {$bp->profile->table_name_data} WHERE user_id = %d ORDER BY last_updated LIMIT 1", $user_id ) ); 1140 1140 1141 1141 return $last_updated; … … 1145 1145 global $wpdb, $bp; 1146 1146 1147 return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['profile']['table_name_data'] . "WHERE user_id = %d", $user_id ) );1147 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_data} WHERE user_id = %d", $user_id ) ); 1148 1148 } 1149 1149 … … 1154 1154 $exclude_sql = $wpdb->prepare( " AND pf.id != 1" ); 1155 1155 1156 return $wpdb->get_results( $wpdb->prepare( "SELECT pf.type, pf.name, pd.value FROM " . $bp['profile']['table_name_data'] . " pd INNER JOIN " . $bp['profile']['table_name_fields'] . "pf ON pd.field_id = pf.id AND pd.user_id = %d {$exclude_sql} ORDER BY RAND() LIMIT 1", $user_id ) );1156 return $wpdb->get_results( $wpdb->prepare( "SELECT pf.type, pf.name, pd.value FROM {$bp->profile->table_name_data} pd INNER JOIN {$bp->profile->table_name_fields} pf ON pd.field_id = pf.id AND pd.user_id = %d {$exclude_sql} ORDER BY RAND() LIMIT 1", $user_id ) ); 1157 1157 } 1158 1158 … … 1161 1161 1162 1162 if ( !$user_id ) 1163 $user_id = $bp ['current_userid'];1163 $user_id = $bp->displayed_user->id; 1164 1164 1165 1165 $data = bp_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id ); -
trunk/bp-xprofile/bp-xprofile-cssjs.php
r938 r1021 37 37 global $bp; 38 38 39 if ( $_SERVER['SCRIPT_NAME'] == '/wp-activate.php' || $bp ['current_component'] == ACTIVATION_SLUG || $bp['current_action']== 'change-avatar' ) {39 if ( $_SERVER['SCRIPT_NAME'] == '/wp-activate.php' || $bp->current_component == ACTIVATION_SLUG || $bp->current_action == 'change-avatar' ) { 40 40 //wp_enqueue_script('jquery'); 41 41 //wp_enqueue_script('prototype'); -
trunk/bp-xprofile/bp-xprofile-filters.php
r858 r1021 17 17 18 18 function xprofile_filter_format_field_value( $field_value, $field_type ) { 19 if ( !isset($field_value) || $field_value == '')19 if ( !isset($field_value) || empty( $field_value ) ) 20 20 return false; 21 21 -
trunk/bp-xprofile/bp-xprofile-notifications.php
r565 r1021 22 22 global $bp, $current_user; 23 23 24 if ( $bp ['current_component'] == $bp['wire']['slug']&& !bp_is_home() ) {24 if ( $bp->current_component == $bp->wire->slug && !bp_is_home() ) { 25 25 bp_core_add_notification( $poster_id, $user_id, 'xprofile', 'new_wire_post' ); 26 26 27 if ( !get_usermeta( $bp ['loggedin_userid'], 'notification_profile_wire_post' ) || get_usermeta( $bp['loggedin_userid'], 'notification_profile_wire_post' ) == 'yes' ) {27 if ( !get_usermeta( $bp->loggedin_user->id, 'notification_profile_wire_post' ) || get_usermeta( $bp->loggedin_user->id, 'notification_profile_wire_post' ) == 'yes' ) { 28 28 $poster_name = bp_fetch_user_fullname( $poster_id, false ); 29 $wire_post = new BP_Wire_Post( $bp ['profile']['table_name_wire'], $wire_post_id, true );29 $wire_post = new BP_Wire_Post( $bp->profile->table_name_wire, $wire_post_id, true ); 30 30 $ud = get_userdata($user_id); 31 31 -
trunk/bp-xprofile/bp-xprofile-signup.php
r730 r1021 130 130 ); 131 131 132 if ( $field->is_required && $value == '') {132 if ( $field->is_required && empty( $value ) ) { 133 133 $bp_xprofile_callback[$counter]["error_msg"] = $field->name . ' cannot be left blank.'; 134 134 $has_errors = true; … … 225 225 global $bp; 226 226 227 if ( $bp ['current_component'] != $bp['blogs']['slug'])227 if ( $bp->current_component != $bp->blogs->slug ) 228 228 return $_SESSION['xprofile_meta']; 229 229 else … … 268 268 // Loop through each bit of profile data and save it to profile. 269 269 for ( $i = 0; $i < count($field_ids); $i++ ) { 270 if ( $field_ids[$i] == '') continue;270 if ( empty( $field_ids[$i] ) ) continue; 271 271 272 272 $field_value = $meta["field_{$field_ids[$i]}"]; -
trunk/bp-xprofile/bp-xprofile-templatetags.php
r884 r1021 140 140 global $bp, $profile_template; 141 141 142 $profile_template = new BP_XProfile_Template($bp ['current_userid']);142 $profile_template = new BP_XProfile_Template($bp->displayed_user->id); 143 143 144 144 return $profile_template->has_groups(); … … 227 227 $groups = BP_XProfile_Group::get_all(); 228 228 229 if ( $group_name == '')229 if ( empty( $group_name ) ) 230 230 $group_name = bp_profile_group_name(false); 231 231 … … 237 237 } 238 238 239 echo '<li' . $selected . '><a href="' . $bp ['loggedin_domain'] . $bp['profile']['slug']. '/edit/group/' . $groups[$i]->id . '">' . $groups[$i]->name . '</a></li>';239 echo '<li' . $selected . '><a href="' . $bp->loggedin_user->domain . $bp->profile->slug . '/edit/group/' . $groups[$i]->id . '">' . $groups[$i]->name . '</a></li>'; 240 240 } 241 241 … … 246 246 global $bp; 247 247 248 $group_id = $bp ['action_variables'][1];248 $group_id = $bp->action_variables[1]; 249 249 250 250 if ( !is_numeric( $group_id ) ) … … 263 263 global $bp; 264 264 265 $group_id = $bp ['action_variables'][1];265 $group_id = $bp->action_variables[1]; 266 266 267 267 if ( !is_numeric( $group_id ) ) 268 268 $group_id = 1; // 'Basic' group. 269 269 270 xprofile_edit( $group_id, $bp ['loggedin_domain'] . $bp['profile']['slug']. '/edit/group/' . $group_id . '/?mode=save' );270 xprofile_edit( $group_id, $bp->loggedin_user->domain . $bp->profile->slug . '/edit/group/' . $group_id . '/?mode=save' ); 271 271 } 272 272 … … 274 274 global $bp; 275 275 276 bp_core_avatar_admin( null, $bp ['loggedin_domain'] . $bp['profile']['slug'] . '/change-avatar/', $bp['loggedin_domain'] . $bp['profile']['slug']. '/delete-avatar/' );276 bp_core_avatar_admin( null, $bp->loggedin_user->domain . $bp->profile->slug . '/change-avatar/', $bp->loggedin_user->domain . $bp->profile->slug . '/delete-avatar/' ); 277 277 } 278 278 … … 280 280 global $bp; 281 281 282 $last_updated = get_usermeta( $bp ['current_userid'], 'profile_last_updated' );282 $last_updated = get_usermeta( $bp->displayed_user->id, 'profile_last_updated' ); 283 283 284 284 if ( !$last_updated ) { … … 294 294 ?> 295 295 <div class="generic-button"> 296 <a class="edit" title="<?php _e( 'Edit Profile', 'buddypress' ) ?>" href="<?php echo $bp ['loggedin_domain'] . $bp['profile']['slug']?>/edit"><?php _e( 'Edit Profile', 'buddypress' ) ?></a>296 <a class="edit" title="<?php _e( 'Edit Profile', 'buddypress' ) ?>" href="<?php echo $bp->loggedin_user->domain . $bp->profile->slug ?>/edit"><?php _e( 'Edit Profile', 'buddypress' ) ?></a> 297 297 </div> 298 298 <?php -
trunk/buddypress-theme/buddypress-home/functions.php
r954 r1021 47 47 global $bp, $query_string; 48 48 49 if ( $bp ['current_component']== HOME_BLOG_SLUG ) {49 if ( $bp->current_component == HOME_BLOG_SLUG ) { 50 50 $pos = strpos( $query_string, 'pagename=' . HOME_BLOG_SLUG ); 51 51 … … 68 68 global $bp, $current_blog; 69 69 70 if ( $bp ['current_component'] == REGISTER_SLUG && $bp['current_action']== '' ) {70 if ( $bp->current_component == REGISTER_SLUG && $bp->current_action == '' ) { 71 71 bp_core_signup_set_headers(); 72 72 bp_core_load_template( 'register', true ); … … 78 78 global $bp, $current_blog; 79 79 80 if ( $bp ['current_component'] == ACTIVATION_SLUG && $bp['current_action']== '' ) {80 if ( $bp->current_component == ACTIVATION_SLUG && $bp->current_action == '' ) { 81 81 bp_core_activation_set_headers(); 82 82 bp_core_load_template( 'activate', true ); -
trunk/buddypress-theme/member-themes/buddypress-member/functions.php
r875 r1021 11 11 global $bp, $is_single_group; 12 12 13 if ( !bp_is_home() && $bp ['current_component']== 'profile' ||14 $bp ['current_component']== 'blog' ||15 $bp ['current_component']== 'friends' ||16 $bp ['current_component']== 'blogs' ) {17 if ( $bp ['current_userid'] != $bp['loggedin_userid'])13 if ( !bp_is_home() && $bp->current_component == 'profile' || 14 $bp->current_component == 'blog' || 15 $bp->current_component == 'friends' || 16 $bp->current_component == 'blogs' ) { 17 if ( $bp->displayed_user->id != $bp->loggedin_user->id ) 18 18 echo ' class="arrow"'; 19 19 } 20 20 21 if ( ( $bp ['current_component'] == 'groups' && $is_single_group ) || ( $bp['current_component']== 'groups' && !bp_is_home() ) )21 if ( ( $bp->current_component == 'groups' && $is_single_group ) || ( $bp->current_component == 'groups' && !bp_is_home() ) ) 22 22 echo ' class="arrow"'; 23 23 } … … 26 26 global $bp; 27 27 28 if ( ($bp ['current_userid'] != $bp['loggedin_userid']) )28 if ( ($bp->displayed_user->id != $bp->loggedin_user->id) ) 29 29 echo ' class="icons"'; 30 30 }
Note: See TracChangeset
for help on using the changeset viewer.