Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/19/2016 03:46:29 AM (8 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 );
Note: See TracChangeset for help on using the changeset viewer.