Changeset 9406 for trunk/src/bp-friends/bp-friends-activity.php
- Timestamp:
- 01/28/2015 10:50:33 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-friends/bp-friends-activity.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-friends/bp-friends-activity.php
r9372 r9406 239 239 * @return array 240 240 */ 241 function bp_friends_filter_activity_scope( $retval, $filter ) { 242 $friends = friends_get_friend_user_ids( $filter['user_id'] ); 243 241 function bp_friends_filter_activity_scope( $retval = array(), $filter = array() ) { 242 243 // Determine the user_id 244 if ( ! empty( $filter['user_id'] ) ) { 245 $user_id = $filter['user_id']; 246 } else { 247 $user_id = bp_displayed_user_id() 248 ? bp_displayed_user_id() 249 : bp_loggedin_user_id(); 250 } 251 252 // Determine friends of user 253 $friends = friends_get_friend_user_ids( $user_id ); 244 254 if ( empty( $friends ) ) { 245 255 $friends = array( 0 ); 246 256 } 247 257 248 $retval = array(258 $retval = array( 249 259 'relation' => 'AND', 250 260 array( … … 253 263 'value' => (array) $friends 254 264 ), 265 255 266 // we should only be able to view sitewide activity content for friends 256 267 array( … … 258 269 'value' => 0 259 270 ), 271 272 // overrides 273 'override' => array( 274 'filter' => array( 'user_id' => 0 ), 275 'show_hidden' => true 276 ), 260 277 ); 261 262 // wipe out the user ID263 $retval['override']['filter']['user_id'] = 0;264 265 // make sure we aren't limiting items by 'hide_sitewide' since we're already266 // limiting it above267 $retval['override']['show_hidden'] = true;268 278 269 279 return $retval; … … 282 292 * @return array 283 293 */ 284 function bp_friends_filter_activity_just_me_scope( $retval, $filter ) { 294 function bp_friends_filter_activity_just_me_scope( $retval = array(), $filter = array() ) { 295 296 // Determine the user_id 297 if ( ! empty( $filter['user_id'] ) ) { 298 $user_id = $filter['user_id']; 299 } else { 300 $user_id = bp_displayed_user_id() 301 ? bp_displayed_user_id() 302 : bp_loggedin_user_id(); 303 } 304 285 305 // Get the requested action 286 306 $action = $filter['filter']['action']; … … 294 314 295 315 /** 296 * If filtering activities for something other than the friendship_created action297 * return without changing anything316 * If filtering activities for something other than the friendship_created 317 * action return without changing anything 298 318 */ 299 319 if ( ! empty( $action ) && ! isset( $action['friendship_created'] ) ) { 300 320 return $retval; 321 } 322 323 // Juggle existing override value 324 $override = array(); 325 if ( ! empty( $retval['override'] ) ) { 326 $override = $retval['override']; 327 unset( $retval['override'] ); 301 328 } 302 329 … … 306 333 * - user has been requested a friendship 307 334 */ 308 returnarray(335 $retval = array( 309 336 'relation' => 'OR', 310 array( 311 'column' => 'user_id', 312 'value' => $filter['user_id'] 313 ), 337 $retval, 314 338 array( 315 339 'relation' => 'AND', … … 320 344 array( 321 345 'column' => 'secondary_item_id', 322 'value' => $ filter['user_id'],346 'value' => $user_id, 323 347 ), 324 ), 325 'override' => array( 326 'display_comments' => 'stream', 327 'filter' => array( 'user_id' => 0 ), 328 ), 348 ) 329 349 ); 350 351 // Juggle back override value 352 if ( ! empty( $override ) ) { 353 $retval['override'] = $override; 354 } 355 356 return $retval; 330 357 } 331 358 add_filter( 'bp_activity_set_just-me_scope_args', 'bp_friends_filter_activity_just_me_scope', 20, 2 );
Note: See TracChangeset
for help on using the changeset viewer.