| | 1383 | * Output the parent activity's user ID |
| | 1384 | * |
| | 1385 | * @since BuddyPress (1.7) |
| | 1386 | */ |
| | 1387 | function bp_activity_parent_user_id() { |
| | 1388 | echo bp_get_activity_parent_user_id(); |
| | 1389 | } |
| | 1390 | |
| | 1391 | /** |
| | 1392 | * Return the parent activity's user ID |
| | 1393 | * |
| | 1394 | * @global BP_Activity_Template $activities_template |
| | 1395 | * @return bool|int False if parent activity can't be found, otherwise returns the parent activity's user ID |
| | 1396 | * @since BuddyPress (1.7) |
| | 1397 | */ |
| | 1398 | function bp_get_activity_parent_user_id() { |
| | 1399 | global $activities_template; |
| | 1400 | |
| | 1401 | $retval = false; |
| | 1402 | |
| | 1403 | // Get the user ID of the parent activity |
| | 1404 | $parent_id = $activities_template->activity->item_id; |
| | 1405 | if ( $parent_id && ! empty( $activities_template->activity_parents[$parent_id] ) ) |
| | 1406 | $retval = $activities_template->activity_parents[$parent_id]->user_id; |
| | 1407 | |
| | 1408 | return apply_filters( 'bp_get_activity_parent_user_id', $retval ); |
| | 1409 | } |
| | 1410 | |
| | 1411 | /** |