Changeset 9326 for trunk/src/bp-friends/bp-friends-activity.php
- Timestamp:
- 01/09/2015 08:56:45 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-friends/bp-friends-activity.php
r9318 r9326 272 272 273 273 /** 274 * Set up activity arguments for use with the 'just-me' scope. 275 * 276 * For details on the syntax, see {@link BP_Activity_Query}. 277 * 278 * @since BuddyPress (2.2.0) 279 * 280 * @param array $retval Empty array by default 281 * @param array $filter Current activity arguments 282 * @return array 283 */ 284 function bp_friends_filter_activity_just_me_scope( $retval, $filter ) { 285 // Get the requested action 286 $action = $filter['filter']['action']; 287 288 // Make sure actions are listed in an array 289 if ( ! is_array( $action ) ) { 290 $action = explode( ',', $filter['filter']['action'] ); 291 } 292 293 $action = array_flip( array_filter( $action ) ); 294 295 /** 296 * If filtering activities for something other than the friendship_created action 297 * return without changing anything 298 */ 299 if ( ! empty( $action ) && ! isset( $action['friendship_created'] ) ) { 300 return $retval; 301 } 302 303 /** 304 * Else make sure to get the friendship_created action, the user is involved in 305 * - user initiated the friendship 306 * - user has been requested a friendship 307 */ 308 return array( 309 'relation' => 'OR', 310 array( 311 'column' => 'user_id', 312 'value' => $filter['user_id'] 313 ), 314 array( 315 'relation' => 'AND', 316 array( 317 'column' => 'component', 318 'value' => 'friends', 319 ), 320 array( 321 'column' => 'secondary_item_id', 322 'value' => $filter['user_id'], 323 ), 324 ), 325 'override' => array( 326 'display_comments' => 'stream', 327 'filter' => array( 'user_id' => 0 ), 328 ), 329 ); 330 } 331 add_filter( 'bp_activity_set_just-me_scope_args', 'bp_friends_filter_activity_just_me_scope', 20, 2 ); 332 333 /** 274 334 * Add activity stream items when one members accepts another members request 275 335 * for virtual friendship. … … 294 354 'secondary_item_id' => $friend_user_id 295 355 ) ); 296 297 // Record in activity streams for the friend298 friends_record_activity( array(299 'user_id' => $friend_user_id,300 'type' => 'friendship_created',301 'item_id' => $friendship_id,302 'secondary_item_id' => $initiator_user_id,303 'hide_sitewide' => true // We've already got the first entry site wide304 ) );305 356 } 306 357 add_action( 'friends_friendship_accepted', 'bp_friends_friendship_accepted_activity', 10, 4 );
Note: See TracChangeset
for help on using the changeset viewer.