Skip to:
Content

BuddyPress.org

Changeset 10785


Ignore:
Timestamp:
05/19/2016 03:46:29 AM (4 years ago)
Author:
boonebgorges
Message:

Pass parsed function parameters to a number of template filters.

The template filters in question are ones that get their main context from
a template global (say, $members_template), but get auxiliary information
about how to build markup from the function params. As such, it's useful to
have these parameters available via filter.

Props Offereins.
See #6997.

Location:
trunk/src
Files:
6 edited

Legend:

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

    r10784 r10785  
    30153015         *
    30163016         * @since 1.1.0
     3017         * @since 2.6.0 Added the `$r` parameter.
    30173018         *
    30183019         * @param string $value All of the links to be displayed to the user.
    3019          */
    3020         return apply_filters( 'bp_get_activity_filter_links', implode( "\n", $component_links ) );
     3020         * @param array  $r     Array of parsed arguments.
     3021         */
     3022        return apply_filters( 'bp_get_activity_filter_links', implode( "\n", $component_links ), $r );
    30213023    }
    30223024
  • trunk/src/bp-blogs/bp-blogs-template.php

    r10783 r10785  
    632632         *
    633633         * @since 1.2.0
     634         * @since 2.6.0 Added the `$r` parameter.
    634635         *
    635636         * @param string $retval HTML markup for the latest post.
    636          */
    637         return apply_filters( 'bp_get_blog_latest_post', $retval );
     637         * @param array  $r      Array of parsed arguments.
     638         */
     639        return apply_filters( 'bp_get_blog_latest_post', $retval, $r );
    638640    }
    639641
  • trunk/src/bp-members/bp-members-template.php

    r10779 r10785  
    431431     *
    432432     * @since 1.2.4
     433     * @since 2.6.0 Added the `$r` parameter
    433434     *
    434435     * @param bool  $value            Whether or not there are members to iterate over.
    435436     * @param array $members_template Populated $members_template global.
    436      */
    437     return apply_filters( 'bp_has_members', $members_template->has_members(), $members_template );
     437     * @param array $r                Array of arguments passed into the BP_Core_Members_Template class.
     438     */
     439    return apply_filters( 'bp_has_members', $members_template->has_members(), $members_template, $r );
    438440}
    439441
     
    773775     *
    774776     * @since 1.2.0
    775      *
    776      * @param string $value Formatted HTML <img> element, or raw avatar URL based on $html arg.
    777      */
    778     echo apply_filters( 'bp_member_avatar', bp_get_member_avatar( $args ) );
     777     * @since 2.6.0 Added the `$args` parameter.
     778     *
     779     * @param string       $value Formatted HTML <img> element, or raw avatar URL based on $html arg.
     780     * @param array|string $args  See {@link bp_get_member_avatar()}.
     781     */
     782    echo apply_filters( 'bp_member_avatar', bp_get_member_avatar( $args ), $args );
    779783}
    780784    /**
     
    821825         *
    822826         * @since 1.2.0
     827         * @since 2.6.0 Added the `$r` parameter.
    823828         *
    824829         * @param string $value Formatted HTML <img> element, or raw avatar URL based on $html arg.
    825          */
    826         return apply_filters( 'bp_get_member_avatar', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->id, 'type' => $type, 'alt' => $alt, 'css_id' => $id, 'class' => $class, 'width' => $width, 'height' => $height, 'email' => $members_template->member->user_email ) ) );
     830         * @param array  $r     Array of parsed arguments. See {@link bp_get_member_avatar()}.
     831         */
     832        return apply_filters( 'bp_get_member_avatar', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->id, 'type' => $type, 'alt' => $alt, 'css_id' => $id, 'class' => $class, 'width' => $width, 'height' => $height, 'email' => $members_template->member->user_email ) ), $r );
    827833    }
    828834
     
    10341040         *
    10351041         * @since 1.2.5
     1042         * @since 2.6.0 Added the `$r` parameter.
    10361043         *
    10371044         * @param string $value Excerpt of the latest update for current member in the loop.
    1038          */
    1039         $update_content = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], $length ) ) ) );
     1045         * @param array  $r     Array of parsed arguments.
     1046         */
     1047        $update_content = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], $length ) ) ), $r );
    10401048
    10411049        $update_content = sprintf( _x( '- &quot;%s&quot;', 'member latest update in member directory', 'buddypress' ), $update_content );
     
    10531061         *
    10541062         * @since 1.2.0
     1063         * @since 2.6.0 Added the `$r` parameter.
    10551064         *
    10561065         * @param string $update_content Formatted latest update for current member.
    1057          */
    1058         return apply_filters( 'bp_get_member_latest_update', $update_content );
     1066         * @param array  $r              Array of parsed arguments.
     1067         */
     1068        return apply_filters( 'bp_get_member_latest_update', $update_content, $r );
    10591069    }
    10601070
     
    11391149         *
    11401150         * @since 1.2.0
     1151         * @since 2.6.0 Added the `$r` parameter.
    11411152         *
    11421153         * @param string|bool $data Profile data if found, otherwise false.
     1154         * @param array       $r    Array of parsed arguments.
    11431155         */
    11441156        return apply_filters( 'bp_get_member_profile_data', $data );
  • trunk/src/bp-messages/bp-messages-template.php

    r10781 r10785  
    683683         *
    684684         * @since 1.0.0
     685         * @since 2.6.0 Added the `$r` parameter.
    685686         *
    686687         * @param string $value User avatar string.
     688         * @param array  $r     Array of parsed arguments.
    687689         */
    688690        return apply_filters( 'bp_get_message_thread_avatar', bp_core_fetch_avatar( array(
     
    694696            'width'   => $r['width'],
    695697            'height'  => $r['height'],
    696         ) ) );
     698        ) ), $r );
    697699    }
    698700
     
    18091811         *
    18101812         * @since 1.1.0
     1813         * @since 2.6.0 Added the `$r` parameter.
    18111814         *
    18121815         * @param string $value <img> tag containing the avatar value.
     1816         * @param array  $r     Array of parsed arguments.
    18131817         */
    18141818        return apply_filters( 'bp_get_the_thread_message_sender_avatar_thumb', bp_core_fetch_avatar( array(
     
    18181822            'height'  => $r['height'],
    18191823            'alt'     => bp_core_get_user_displayname( $thread_template->message->sender_id )
    1820         ) ) );
     1824        ) ), $r );
    18211825    }
    18221826
  • trunk/src/bp-notifications/bp-notifications-template.php

    r10725 r10785  
    216216     *
    217217     * @since 1.9.0
     218     * @since 2.6.0 Added the `$r` parameter.
    218219     *
    219220     * @param bool                      $value      Whether or not there are notifications to display.
    220221     * @param BP_Notifications_Template $query_loop BP_Notifications_Template object instance.
    221      */
    222     return apply_filters( 'bp_has_notifications', $query_loop->has_notifications(), $query_loop );
     222     * @param array                     $r          Array of arguments passed into the BP_Notifications_Template class.
     223     */
     224    return apply_filters( 'bp_has_notifications', $query_loop->has_notifications(), $query_loop, $r );
    223225}
    224226
     
    827829         *
    828830         * @since 1.9.0
     831         * @since 2.6.0 Added the `$r` parameter.
    829832         *
    830833         * @param string $retval HTML links for actions to take on single notifications.
    831          */
    832         return apply_filters( 'bp_get_the_notification_action_links', $retval );
     834         * @param array  $r      Array of parsed arguments.
     835         */
     836        return apply_filters( 'bp_get_the_notification_action_links', $retval, $r );
    833837    }
    834838
  • trunk/src/bp-xprofile/bp-xprofile-template.php

    r10780 r10785  
    7474     *
    7575     * @since 1.1.0
     76     * @since 2.6.0 Added the `$r` parameter.
    7677     *
    7778     * @param bool   $has_groups       Whether or not there are group profiles to display.
    7879     * @param string $profile_template Current profile template being used.
    79      */
    80     return apply_filters( 'bp_has_profile', $profile_template->has_groups(), $profile_template );
     80     * @param array  $r                Array of arguments passed into the BP_XProfile_Data_Template class.
     81     */
     82    return apply_filters( 'bp_has_profile', $profile_template->has_groups(), $profile_template, $r );
    8183}
    8284
     
    883885         *
    884886         * @since 1.6.0
     887         * @since 2.6.0 Added the `$level` parameter.
    885888         *
    886889         * @param string $retval Field visibility level label.
    887          */
    888         return apply_filters( 'bp_get_the_profile_field_visibility_level_label', $fields[ $level ]['label'] );
     890         * @param string $level  Field visibility level.
     891         */
     892        return apply_filters( 'bp_get_the_profile_field_visibility_level_label', $fields[ $level ]['label'], $level );
    889893    }
    890894
     
    942946         *
    943947         * @since 1.2.0
     948         * @since 2.6.0 Added the `$r` parameter.
    944949         *
    945950         * @param mixed $value Profile data for a specific field for the user.
    946          */
    947         return apply_filters( 'bp_get_profile_field_data', xprofile_get_field_data( $r['field'], $r['user_id'] ) );
     951         * @param array $r     Array of parsed arguments.
     952         */
     953        return apply_filters( 'bp_get_profile_field_data', xprofile_get_field_data( $r['field'], $r['user_id'] ), $r );
    948954    }
    949955
Note: See TracChangeset for help on using the changeset viewer.