Skip to:
Content

BuddyPress.org

Changeset 12919


Ignore:
Timestamp:
04/28/2021 11:50:34 PM (5 years ago)
Author:
dcavins
Message:

Member Invites: Add core template functions.

Add class BP_Members_Invitations_Template and
template functions in BP_Members_Template.

See #8139.

Location:
trunk/src
Files:
1 added
4 edited

Legend:

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

    r12769 r12919  
    22492249
    22502250/**
     2251 * Check whether the current page is an Invitations screen.
     2252 *
     2253 * @since 8.0.0
     2254 *
     2255 * @return bool True if the current page is an Invitations screen.
     2256 */
     2257function bp_is_members_invitations_screen() {
     2258        return (bool) bp_is_current_component( bp_get_members_invitations_slug() );
     2259}
     2260
     2261/**
    22512262 * Is the current component an active core component?
    22522263 *
     
    26462657function bp_is_user_settings_profile() {
    26472658        return (bool) ( bp_is_user_settings() && bp_is_current_action( 'profile' ) );
     2659}
     2660
     2661/**
     2662 * Is the current page a user's community invitations page?
     2663 *
     2664 * Eg http://example.com/members/cassie/invitations/ (or a subpage thereof).
     2665 *
     2666 * @since 8.0.0
     2667 *
     2668 * @return bool True if the current page is a user's community invitations page.
     2669 */
     2670function bp_is_user_members_invitations() {
     2671        return (bool) ( bp_is_user() && bp_is_members_invitations_screen() );
     2672}
     2673
     2674/**
     2675 * Is the current page a user's List Invites page?
     2676 *
     2677 * Eg http://example.com/members/cassie/invitations/list-invites/.
     2678 *
     2679 * @since 8.0.0
     2680 *
     2681 * @return bool True if the current page is a user's List Invites page.
     2682 */
     2683function bp_is_user_members_invitations_list() {
     2684        return (bool) ( bp_is_user_members_invitations() && bp_is_current_action( 'list-invites' ) );
     2685}
     2686
     2687/**
     2688 * Is the current page a user's Send Invites page?
     2689 *
     2690 * Eg http://example.com/members/cassie/invitations/send-invites/.
     2691 *
     2692 * @since 8.0.0
     2693 *
     2694 * @return bool True if the current page is a user's Send Invites page.
     2695 */
     2696function bp_is_user_members_invitations_send_screen() {
     2697        return (bool) ( bp_is_user_members_invitations() && bp_is_current_action( 'send-invites' ) );
    26482698}
    26492699
  • trunk/src/bp-members/bp-members-filters.php

    r12917 r12919  
    173173}
    174174add_filter( 'bp_user_can', 'bp_members_user_can_filter', 10, 5 );
     175/**
     176 * Sanitize the invitation property output.
     177 *
     178 * @since 8.0.0
     179 *
     180 * @param int|string $value    The value for the requested property.
     181 * @param string     $property The name of the requested property.
     182 * @param string     $context  The context of display.
     183 * @return int|string          The sanitized value.
     184 */
     185function bp_members_sanitize_invitation_property( $value = '', $property = '', $context = 'html' ) {
     186        if ( ! $property ) {
     187                return '';
     188        }
     189
     190        switch ( $property ) {
     191                case 'id':
     192                case 'user_id':
     193                case 'item_id':
     194                case 'secondary_item_id':
     195                        $value = absint( $value );
     196                        break;
     197                case 'invite_sent':
     198                case 'accepted':
     199                        $value = absint( $value ) ? __( 'Yes', 'buddypress' ) : __( 'No', 'buddypress' );
     200                        $value = 'attribute' === $context ? esc_attr( $value ) : esc_html( $value );
     201                        break;
     202                case 'invitee_email':
     203                        $value = sanitize_email( $value );
     204                        break;
     205                case 'content':
     206                        $value = wp_kses( $value, array() );
     207                        $value = wptexturize( $value );
     208                        break;
     209                case 'date_modified':
     210                        $value = mysql2date( 'Y/m/d g:i:s a', $value );
     211                        $value = 'attribute' === $context ? esc_attr( $value ) : esc_html( $value );
     212                        break;
     213
     214                default:
     215                        $value = 'attribute' === $context ? esc_attr( $value ) : esc_html( $value );
     216                        break;
     217        }
     218
     219        return $value;
     220}
     221add_filter( 'bp_the_members_invitation_property', 'bp_members_sanitize_invitation_property', 10, 3 );
  • trunk/src/bp-members/bp-members-template.php

    r12892 r12919  
    273273                 */
    274274                return apply_filters( 'bp_get_activate_slug', $slug );
     275        }
     276
     277/**
     278 * Output the members invitation pane slug.
     279 *
     280 * @since 8.0.0
     281 *
     282 */
     283function bp_members_invitations_slug() {
     284        echo bp_get_members_invitations_slug();
     285}
     286        /**
     287         * Return the members invitations root slug.
     288         *
     289         * @since 8.0.0
     290         *
     291         * @return string
     292         */
     293        function bp_get_members_invitations_slug() {
     294
     295                /**
     296                 * Filters the Members invitations pane root slug.
     297                 *
     298                 * @since 8.0.0
     299                 *
     300                 * @param string $slug Members invitations pane root slug.
     301                 */
     302                return apply_filters( 'bp_get_members_invitations_slug', _x( 'invitations', 'Member profile invitations pane URL base', 'buddypress' ) );
    275303        }
    276304
     
    23822410        function bp_get_signup_email_value() {
    23832411                $value = '';
    2384                 if ( isset( $_POST['signup_email'] ) )
     2412                if ( isset( $_POST['signup_email'] ) ) {
    23852413                        $value = $_POST['signup_email'];
     2414                } else if ( bp_get_members_invitations_allowed() ) {
     2415                        $invite = bp_get_members_invitation_from_request();
     2416                        if ( $invite ) {
     2417                                $value = $invite->invitee_email;
     2418                        }
     2419                }
    23862420
    23872421                /**
     
    27572791
    27582792/**
     2793 * Are users allowed to invite users to join this site?
     2794 *
     2795 * @since 8.0.0
     2796 *
     2797 * @return bool
     2798 */
     2799function bp_get_members_invitations_allowed() {
     2800        /**
     2801         * Filters whether or not community invitations are allowed.
     2802         *
     2803         * @since 8.0.0
     2804         *
     2805         * @param bool $allowed Whether or not community invitations are allowed.
     2806         */
     2807        return apply_filters( 'bp_get_members_invitations_allowed', bp_is_active( 'members', 'invitations' ) && (bool) bp_get_option( 'bp-enable-members-invitations' ) );
     2808}
     2809
     2810/**
    27592811 * Hook member activity feed to <head>.
    27602812 *
     
    28702922                return apply_filters( 'bp_get_avatar_delete_link', wp_nonce_url( bp_displayed_user_domain() . bp_get_profile_slug() . '/change-avatar/delete-avatar/', 'bp_delete_avatar_link' ) );
    28712923        }
     2924
     2925
     2926/** The Members Invitations Loop ******************************************************************/
     2927
     2928/**
     2929 * Initialize the community invitations loop.
     2930 *
     2931 * Based on the $args passed, bp_has_invitations() populates
     2932 * buddypress()->invitations->query_loop global, enabling the use of BP
     2933 * templates and template functions to display a list of invitations.
     2934 *
     2935 * @since 8.0.0
     2936 *
     2937 * @param array|string $args {
     2938 *     Arguments for limiting the contents of the invitations loop. Can be
     2939 *     passed as an associative array, or as a URL query string.
     2940 *
     2941 *     See {@link BP_Invitations_Invitation::get()} for detailed
     2942 *     information on the arguments.  In addition, also supports:
     2943 *
     2944 *     @type int    $max      Optional. Max items to display. Default: false.
     2945 *     @type string $page_arg URL argument to use for pagination.
     2946 *                            Default: 'ipage'.
     2947 * }
     2948 * @return bool
     2949 */
     2950function bp_has_members_invitations( $args = '' ) {
     2951
     2952        // Get the user ID.
     2953        if ( bp_displayed_user_id() ) {
     2954                $user_id = bp_displayed_user_id();
     2955        } else {
     2956                $user_id = bp_loggedin_user_id();
     2957        }
     2958
     2959        // Set the search terms (by default an empty string to get all notifications)
     2960        $search_terms = '';
     2961
     2962        if ( isset( $_REQUEST['s'] ) ) {
     2963                $search_terms = stripslashes( $_REQUEST['s'] );
     2964        }
     2965
     2966        // Parse the args.
     2967        $r = bp_parse_args( $args, array(
     2968                'id'                => false,
     2969                'inviter_id'        => $user_id,
     2970                'invitee_email'     => false,
     2971                'item_id'           => false,
     2972                'type'              => 'invite',
     2973                'invite_sent'       => 'all',
     2974                'accepted'          => 'pending',
     2975                'search_terms'      => $search_terms,
     2976                'order_by'          => 'date_modified',
     2977                'sort_order'        => 'DESC',
     2978                'page'              => 1,
     2979                'per_page'          => 25,
     2980                'fields'            => 'all',
     2981
     2982                // These are additional arguments that are not available in
     2983                // BP_Invitations_Invitation::get().
     2984                'page_arg'          => 'ipage',
     2985        ), 'has_community_invitations' );
     2986
     2987        // Get the notifications.
     2988        $query_loop = new BP_Members_Invitations_Template( $r );
     2989
     2990        // Setup the global query loop.
     2991        buddypress()->members->invitations->query_loop = $query_loop;
     2992
     2993        /**
     2994         * Filters whether or not the user has network invitations to display.
     2995         *
     2996         * @since 8.0.0
     2997         *
     2998         * @param bool                      $value      Whether or not there are network invitations to display.
     2999         * @param BP_Notifications_Template $query_loop BP_Members_Invitations_Template object instance.
     3000         * @param array                     $r          Array of arguments passed into the BP_Members_Invitations_Template class.
     3001         */
     3002        return apply_filters( 'bp_has_members_invitations', $query_loop->has_invitations(), $query_loop, $r );
     3003}
     3004
     3005/**
     3006 * Get the network invitations returned by the template loop.
     3007 *
     3008 * @since 8.0.0
     3009 *
     3010 * @return array List of network invitations.
     3011 */
     3012function bp_the_members_invitations() {
     3013        return buddypress()->members->invitations->query_loop->invitations();
     3014}
     3015
     3016/**
     3017 * Get the current network invitation object in the loop.
     3018 *
     3019 * @since 8.0.0
     3020 *
     3021 * @return object The current network invitation within the loop.
     3022 */
     3023function bp_the_members_invitation() {
     3024        return buddypress()->members->invitations->query_loop->the_invitation();
     3025}
     3026
     3027/**
     3028 * Output the pagination count for the current network invitations loop.
     3029 *
     3030 * @since 8.0.0
     3031 */
     3032function bp_members_invitations_pagination_count() {
     3033        echo bp_get_members_invitations_pagination_count();
     3034}
     3035        /**
     3036         * Return the pagination count for the current network invitation loop.
     3037         *
     3038         * @since 8.0.0
     3039         *
     3040         * @return string HTML for the pagination count.
     3041         */
     3042        function bp_get_members_invitations_pagination_count() {
     3043                $query_loop = buddypress()->members->invitations->query_loop;
     3044                $start_num  = intval( ( $query_loop->pag_page - 1 ) * $query_loop->pag_num ) + 1;
     3045                $from_num   = bp_core_number_format( $start_num );
     3046                $to_num     = bp_core_number_format( ( $start_num + ( $query_loop->pag_num - 1 ) > $query_loop->total_invitation_count ) ? $query_loop->total_invitation_count : $start_num + ( $query_loop->pag_num - 1 ) );
     3047                $total      = bp_core_number_format( $query_loop->total_invitation_count );
     3048
     3049                if ( 1 == $query_loop->total_invitation_count ) {
     3050                        $pag = __( 'Viewing 1 invitation', 'buddypress' );
     3051                } else {
     3052                        /* translators: 1: notification from number. 2: notification to number. 3: total notifications. */
     3053                        $pag = sprintf( _n( 'Viewing %1$s - %2$s of %3$s invitation', 'Viewing %1$s - %2$s of %3$s invitations', $query_loop->total_invitation_count, 'buddypress' ), $from_num, $to_num, $total );
     3054                }
     3055
     3056                /**
     3057                 * Filters the pagination count for the current network invitation loop.
     3058                 *
     3059                 * @since 8.0.0
     3060                 *
     3061                 * @param string $pag HTML for the pagination count.
     3062                 */
     3063                return apply_filters( 'bp_get_members_invitations_pagination_count', $pag );
     3064        }
     3065
     3066/**
     3067 * Output the pagination links for the current network invitation loop.
     3068 *
     3069 * @since 8.0.0
     3070 */
     3071function bp_members_invitations_pagination_links() {
     3072        echo bp_get_members_invitations_pagination_links();
     3073}
     3074        /**
     3075         * Return the pagination links for the current network invitations loop.
     3076         *
     3077         * @since 8.0.0
     3078         *
     3079         * @return string HTML for the pagination links.
     3080         */
     3081        function bp_get_members_invitations_pagination_links() {
     3082
     3083                /**
     3084                 * Filters the pagination links for the current network invitations loop.
     3085                 *
     3086                 * @since 8.0.0
     3087                 *
     3088                 * @param string $pag_links HTML for the pagination links.
     3089                 */
     3090                return apply_filters( 'bp_get_members_invitations_pagination_links', buddypress()->members->invitations->query_loop->pag_links );
     3091        }
     3092
     3093/**
     3094 * Output the requested property of the invitation currently being iterated on.
     3095 *
     3096 * @since 8.0.0
     3097 *
     3098 * @param string $property The name of the property to display.
     3099 * @param string $context  The context of display.
     3100 *                         Possible values are 'attribute' and 'html'.
     3101 */
     3102function bp_the_members_invitation_property( $property = '', $context = 'html' ) {
     3103        if ( ! $property ) {
     3104                return;
     3105        }
     3106
     3107        /**
     3108         * Use this filter to sanitize the output.
     3109         *
     3110         * @since 8.0.0
     3111         *
     3112         * @param int|string $value    The value for the requested property.
     3113         * @param string     $property The name of the requested property.
     3114         * @param string     $context  The context of display.
     3115         */
     3116        echo apply_filters( 'bp_the_members_invitation_property', bp_get_the_members_invitation_property( $property ), $property, $context );
     3117}
     3118        /**
     3119         * Return the value for a property of the network invitation currently being iterated on.
     3120         *
     3121         * @since 8.0.0
     3122         *
     3123         * @return int ID of the current network invitation.
     3124         */
     3125        function bp_get_the_members_invitation_property( $property = 'id' ) {
     3126
     3127                switch ( $property ) {
     3128                        case 'id':
     3129                        case 'user_id':
     3130                        case 'item_id':
     3131                        case 'secondary_item_id':
     3132                        case 'invite_sent':
     3133                        case 'accepted':
     3134                                $value = 0;
     3135                                break;
     3136                        case 'invitee_email':
     3137                        case 'type':
     3138                        case 'content':
     3139                        case 'date_modified':
     3140                                $value = '';
     3141                                break;
     3142                        default:
     3143                                // A known property has not been specified.
     3144                                $property = null;
     3145                                $value = '';
     3146                                break;
     3147                }
     3148
     3149                if ( isset( buddypress()->members->invitations->query_loop->invitation->{$property} ) ) {
     3150                        $value = buddypress()->members->invitations->query_loop->invitation->{$property};
     3151                }
     3152
     3153                /**
     3154                 * Filters the property of the network invitation currently being iterated on.
     3155                 *
     3156                 * @since 8.0.0
     3157                 *
     3158                 * @param int|string $value Property value of the network invitation being iterated on.
     3159                 */
     3160                return apply_filters( 'bp_get_the_members_invitation_property_' . $property, $value );
     3161        }
     3162
     3163/**
     3164 * Output the action links for the current invitation.
     3165 *
     3166 * @since 8.0.0
     3167 *
     3168 * @param array|string $args Array of arguments.
     3169 */
     3170function bp_the_members_invitation_action_links( $args = '' ) {
     3171        echo bp_get_the_members_invitation_action_links( $args );
     3172}
     3173        /**
     3174         * Return the action links for the current invitation.
     3175         *
     3176         * @since 8.0.0
     3177         *
     3178         * @param array|string $args {
     3179         *     @type string $before  HTML before the links.
     3180         *     @type string $after   HTML after the links.
     3181         *     @type string $sep     HTML between the links.
     3182         *     @type array  $links   Array of links to implode by 'sep'.
     3183         *     @type int    $user_id User ID to fetch action links for. Defaults to displayed user ID.
     3184         * }
     3185         * @return string HTML links for actions to take on single notifications.
     3186         */
     3187        function bp_get_the_members_invitation_action_links( $args = '' ) {
     3188                // Set default user ID to use.
     3189                $inviter_id = isset( $args['inviter_id'] ) ? $args['inviter_id'] : bp_displayed_user_id();
     3190
     3191                // Parse.
     3192                $r = wp_parse_args( $args, array(
     3193                        'before' => '',
     3194                        'after'  => '',
     3195                        'sep'    => ' | ',
     3196                        'links'  => array(
     3197                                bp_get_the_members_invitation_resend_link( $inviter_id ),
     3198                                bp_get_the_members_invitation_delete_link( $inviter_id )
     3199                        )
     3200                ) );
     3201
     3202                // Build the links.
     3203                $retval = $r['before'] . implode( $r['sep'], $r['links'] ) . $r['after'];
     3204
     3205                /**
     3206                 * Filters the action links for the current invitation.
     3207                 *
     3208                 * @since 8.0.0
     3209                 *
     3210                 * @param string $retval HTML links for actions to take on single invitation.
     3211                 * @param array  $r      Array of parsed arguments.
     3212                 */
     3213                return apply_filters( 'bp_get_the_members_invitation_action_links', $retval, $r );
     3214        }
     3215
     3216/**
     3217 * Output the resend link for the current invitation.
     3218 *
     3219 * @since 8.0.0
     3220 *
     3221 * @param int $user_id The user ID.
     3222 */
     3223function bp_the_members_invitations_resend_link( $user_id = 0 ) {
     3224        echo bp_get_the_members_invitation_delete_link( $user_id );
     3225}
     3226        /**
     3227         * Return the resend link for the current notification.
     3228         *
     3229         * @since 8.0.0
     3230         *
     3231         * @param int $user_id The user ID.
     3232         * @return string
     3233         */
     3234        function bp_get_the_members_invitation_resend_link( $user_id = 0 ) {
     3235                // Set default user ID to use.
     3236                $user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
     3237
     3238                // Don't allow resending of accepted invitations.
     3239                if ( bp_get_the_members_invitation_property( 'accepted' ) ) {
     3240                        return;
     3241                }
     3242
     3243                $retval = sprintf( '<a href="%1$s" class="resend secondary confirm bp-tooltip">%2$s</a>', esc_url( bp_get_the_members_invitations_resend_url( $user_id ) ), __( 'Resend', 'buddypress' ) );
     3244
     3245                /**
     3246                 * Filters the resend link for the current invitation.
     3247                 *
     3248                 * @since 8.0.0
     3249                 *
     3250                 * @param string $retval  HTML for the delete link for the current notification.
     3251                 * @param int    $user_id The user ID.
     3252                 */
     3253                return apply_filters( 'bp_get_the_members_invitation_resend_link', $retval, $user_id );
     3254        }
     3255
     3256/**
     3257 * Output the URL used for resending a single invitation.
     3258 *
     3259 * Since this function directly outputs a URL, it is escaped.
     3260 *
     3261 * @since 8.0.0
     3262 *
     3263 * @param int $user_id The user ID.
     3264 */
     3265function bp_the_members_invitations_resend_url( $user_id = 0 ) {
     3266        echo esc_url( bp_get_the_members_invitations_resend_url( $user_id ) );
     3267}
     3268        /**
     3269         * Return the URL used for resending a single invitation.
     3270         *
     3271         * @since 8.0.0
     3272         *
     3273         * @param int $user_id The user ID.
     3274         * @return string
     3275         */
     3276        function bp_get_the_members_invitations_resend_url( $user_id = 0 ) {
     3277                // Set default user ID to use.
     3278                $user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
     3279                $link = bp_get_members_invitations_list_invites_permalink( $user_id );
     3280
     3281                // Get the ID.
     3282                $id = bp_get_the_members_invitation_property( 'id' );
     3283
     3284                // Get the args to add to the URL.
     3285                $args = array(
     3286                        'action'        => 'resend',
     3287                        'invitation_id' => $id
     3288                );
     3289
     3290                // Add the args.
     3291                $url = add_query_arg( $args, $link );
     3292
     3293                // Add the nonce.
     3294                $url = wp_nonce_url( $url, 'bp_network_invitation_resend_' . $id );
     3295
     3296                /**
     3297                 * Filters the URL used for resending a single invitation.
     3298                 *
     3299                 * @since 8.0.0
     3300                 *
     3301                 * @param string $url     URL used for deleting a single invitation.
     3302                 * @param int    $user_id The user ID.
     3303                 */
     3304                return apply_filters( 'bp_get_the_members_invitations_resend_url', $url, $user_id );
     3305        }
     3306
     3307/**
     3308 * Output the delete link for the current invitation.
     3309 *
     3310 * @since 8.0.0
     3311 *
     3312 * @param int $user_id The user ID.
     3313 */
     3314function bp_the_members_invitations_delete_link( $user_id = 0 ) {
     3315        echo bp_get_the_members_invitation_delete_link( $user_id );
     3316}
     3317        /**
     3318         * Return the delete link for the current invitation.
     3319         *
     3320         * @since 8.0.0
     3321         *
     3322         * @param int $user_id The user ID.
     3323         * @return string
     3324         */
     3325        function bp_get_the_members_invitation_delete_link( $user_id = 0 ) {
     3326                // Set default user ID to use.
     3327                $user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
     3328
     3329                // Modify the message for accepted/not accepted invitatons.
     3330                if ( bp_get_the_members_invitation_property( 'accepted' ) ) {
     3331                        $message = __( 'Delete', 'buddypress' );
     3332                } else {
     3333                        $message = __( 'Cancel', 'buddypress' );
     3334                }
     3335
     3336                $retval = sprintf(
     3337                        '<a href="%1$s" class="delete secondary confirm bp-tooltip">%2$s</a>',
     3338                        esc_url( bp_get_the_members_invitations_delete_url( $user_id ) ),
     3339                        esc_html( $message )
     3340                );
     3341
     3342                /**
     3343                 * Filters the delete link for the current invitation.
     3344                 *
     3345                 * @since 8.0.0
     3346                 *
     3347                 * @param string $retval  HTML for the delete link for the current notification.
     3348                 * @param int    $user_id The user ID.
     3349                 */
     3350                return apply_filters( 'bp_get_the_members_invitation_delete_link', $retval, $user_id );
     3351        }
     3352
     3353/**
     3354 * Output the URL used for deleting a single invitation.
     3355 *
     3356 * Since this function directly outputs a URL, it is escaped.
     3357 *
     3358 * @since 8.0.0
     3359 *
     3360 * @param int $user_id The user ID.
     3361 */
     3362function bp_the_members_invitations_delete_url( $user_id = 0 ) {
     3363        echo esc_url( bp_get_the_members_invitations_delete_url( $user_id ) );
     3364}
     3365        /**
     3366         * Return the URL used for deleting a single invitation.
     3367         *
     3368         * @since 8.0.0
     3369         *
     3370         * @param int $user_id The user ID.
     3371         * @return string
     3372         */
     3373        function bp_get_the_members_invitations_delete_url( $user_id = 0 ) {
     3374                // Set default user ID to use.
     3375                $user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
     3376                $link = bp_get_members_invitations_list_invites_permalink( $user_id );
     3377
     3378                // Get the ID.
     3379                $id = bp_get_the_members_invitation_property( 'id' );
     3380
     3381                // Get the args to add to the URL.
     3382                $args = array(
     3383                        'action'        => 'cancel',
     3384                        'invitation_id' => $id
     3385                );
     3386
     3387                // Add the args.
     3388                $url = add_query_arg( $args, $link );
     3389
     3390                // Add the nonce.
     3391                $url = wp_nonce_url( $url, 'bp_members_invitations_cancel_' . $id );
     3392
     3393                /**
     3394                 * Filters the URL used for deleting a single invitation.
     3395                 *
     3396                 * @since 8.0.0
     3397                 *
     3398                 * @param string $url     URL used for deleting a single invitation.
     3399                 * @param int    $user_id The user ID.
     3400                 */
     3401                return apply_filters( 'bp_get_the_members_invitations_delete_url', $url, $user_id );
     3402        }
     3403
     3404/**
     3405 * Output the members invitations list permalink for a user.
     3406 *
     3407 * @since 8.0.0
     3408 *
     3409 * @param int $user_id The user ID.
     3410 */
     3411function bp_members_invitations_list_invites_permalink( $user_id = 0 ) {
     3412        echo bp_get_members_invitations_list_invites_permalink( $user_id );
     3413}
     3414        /**
     3415         * Return the members invitations list permalink for a user.
     3416         *
     3417         * @since 8.0.0
     3418         *
     3419         * @return string Members invitations list permalink for a user.
     3420         */
     3421        function bp_get_members_invitations_list_invites_permalink( $user_id = 0 ) {
     3422                if ( 0 === $user_id ) {
     3423                        $user_id = bp_loggedin_user_id();
     3424                        $domain  = bp_loggedin_user_domain();
     3425                } else {
     3426                        $domain = bp_core_get_user_domain( (int) $user_id );
     3427                }
     3428
     3429                $retval = trailingslashit( $domain . bp_get_members_invitations_slug() . '/list-invites' );
     3430
     3431                /**
     3432                 * Filters the members invitations list permalink for a user.
     3433                 *
     3434                 * @since 8.0.0
     3435                 *
     3436                 * @param string $retval  Permalink for the sent invitation list screen.
     3437                 * @param int    $user_id The user ID.
     3438                 */
     3439                return apply_filters( 'bp_get_members_invitations_list_invites_permalink', $retval, $user_id );
     3440        }
     3441
     3442/**
     3443 * Output the send invitation permalink for a user.
     3444 *
     3445 * @since 8.0.0
     3446 *
     3447 * @param int $user_id The user ID.
     3448 */
     3449function bp_members_invitations_send_invites_permalink( $user_id = 0 ) {
     3450        echo bp_get_members_invitations_send_invites_permalink( $user_id );
     3451}
     3452        /**
     3453         * Return the send invitations permalink.
     3454         *
     3455         * @since 8.0.0
     3456         *
     3457         * @param int $user_id The user ID.
     3458         * @return string      The send invitations permalink.
     3459         */
     3460        function bp_get_members_invitations_send_invites_permalink( $user_id = 0 ) {
     3461                if ( 0 === $user_id ) {
     3462                        $user_id = bp_loggedin_user_id();
     3463                        $domain  = bp_loggedin_user_domain();
     3464                } else {
     3465                        $domain = bp_core_get_user_domain( (int) $user_id );
     3466                }
     3467
     3468                $retval = trailingslashit( $domain . bp_get_members_invitations_slug() . '/send-invites' );
     3469
     3470                /**
     3471                 * Filters the send invitations permalink.
     3472                 *
     3473                 * @since 8.0.0
     3474                 *
     3475                 * @param string $retval  Permalink for the sent invitation list screen.
     3476                 * @param int    $user_id The user ID.
     3477                 */
     3478                return apply_filters( 'bp_get_members_invitations_send_invites_permalink', $retval, $user_id );
     3479        }
  • trunk/src/class-buddypress.php

    r12917 r12919  
    624624                        'BP_REST_Signup_Endpoint'                    => 'members',
    625625                        'BP_Members_Invitation_Manager'              => 'members',
     626                        'BP_Members_Invitations_Template'            => 'members',
    626627
    627628                        'BP_REST_Messages_Endpoint' => 'messages',
Note: See TracChangeset for help on using the changeset viewer.