Skip to:
Content

Changeset 6523


Ignore:
Timestamp:
11/15/12 13:39:14 (17 months ago)
Author:
djpaul
Message:

Add new Activity template loop function to get the parent activity's user ID. Fixes #4663

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-template.php

    r6502 r6523  
    13781378 
    13791379        return apply_filters( 'bp_get_activity_parent_content', $content ); 
     1380    } 
     1381 
     1382/** 
     1383 * Output the parent activity's user ID 
     1384 * 
     1385 * @since BuddyPress (1.7) 
     1386 */ 
     1387function 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 ); 
    13801409    } 
    13811410 
Note: See TracChangeset for help on using the changeset viewer.