Skip to:
Content

BuddyPress.org

Changeset 6489


Ignore:
Timestamp:
11/06/2012 02:41:45 PM (12 years ago)
Author:
djpaul
Message:

Add parameter to bp_get_activity_action() to prevent the timestamp being appended to the action text. Fixes #4648

This was limiting how the function can be used in theme templates; some themes may want to show the timestamp somewhere else.

File:
1 edited

Legend:

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

    r6483 r6489  
    11221122 * @since BuddyPress (1.2)
    11231123 *
     1124 * @param array $args See bp_get_activity_action()
    11241125 * @uses bp_get_activity_action()
    11251126 */
    1126 function bp_activity_action() {
    1127     echo bp_get_activity_action();
     1127function bp_activity_action( $args = array() ) {
     1128    echo bp_get_activity_action( $args );
    11281129}
    11291130
     
    11341135     *
    11351136     * @global object $activities_template {@link BP_Activity_Template}
     1137     * @param array $args Only parameter is "no_timestamp". If true, timestamp is shown in output.
    11361138     * @uses apply_filters_ref_array() To call the 'bp_get_activity_action_pre_meta' hook
    11371139     * @uses bp_insert_activity_meta()
     
    11401142     * @return string The activity action
    11411143     */
    1142     function bp_get_activity_action() {
    1143         global $activities_template;
     1144    function bp_get_activity_action( $args = array() ) {
     1145        global $activities_template;
     1146
     1147        $defaults = array(
     1148            'no_timestamp' => false,
     1149        );
     1150
     1151        $args = wp_parse_args( $args, $defaults );
     1152        extract( $args, EXTR_SKIP );
    11441153
    11451154        $action = $activities_template->activity->action;
    1146         $action = apply_filters_ref_array( 'bp_get_activity_action_pre_meta', array( $action, &$activities_template->activity ) );
    1147 
    1148         if ( !empty( $action ) )
     1155        $action = apply_filters_ref_array( 'bp_get_activity_action_pre_meta', array( $action, &$activities_template->activity, $args ) );
     1156
     1157        if ( ! empty( $action ) && ! $no_timestamp )
    11491158            $action = bp_insert_activity_meta( $action );
    11501159
    1151         return apply_filters_ref_array( 'bp_get_activity_action', array( $action, &$activities_template->activity ) );
     1160        return apply_filters_ref_array( 'bp_get_activity_action', array( $action, &$activities_template->activity, $args ) );
    11521161    }
    11531162
Note: See TracChangeset for help on using the changeset viewer.