Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/31/2023 05:26:39 PM (13 months ago)
Author:
imath
Message:

Make sure all displayed user URLs are built using the BP Rewrites API

Replace all remaining bp_displayed_user_domain() usage in favor of
bp_displayed_user_url().
Introduce the bp_members_get_path_chunks() function to quickly build BP
Rewrites argument for member's URL using an array of slugs.
Deprecate bp_activities_member_rss_link(), bp_blogs_blog_tabs() &
bp_groups_header_tabs().
Improve bp_displayed_user_link() so that it's possible to pass an array
of slugs to output an escaped BP Rewrites ready URL.

Props r-a-y, johnjamesjacoby, boonebgorges

Closes https://github.com/buddypress/buddypress/pull/79
See #4954

File:
1 edited

Legend:

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

    r13442 r13443  
    973973     */
    974974    function bp_get_messages_form_action() {
     975        $path_chunks = bp_members_get_path_chunks( array( bp_get_messages_slug(), bp_current_action(), bp_action_variable( 0 ) ) );
     976        $url         = bp_displayed_user_url( $path_chunks );
    975977
    976978        /**
     
    979981         * @since 1.0.0
    980982         *
    981          * @param string $value The form action.
    982          */
    983         return apply_filters( 'bp_get_messages_form_action', trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' . bp_action_variable( 0 ) ) );
     983         * @param string $url The form action.
     984         */
     985        return apply_filters( 'bp_get_messages_form_action',$url );
    984986    }
    985987
     
    22992301     */
    23002302    function bp_get_the_thread_delete_link() {
     2303        $path_chunks = bp_members_get_path_chunks( array( bp_get_messages_slug(), 'inbox', 'delete', bp_get_the_thread_id() ) );
     2304        $url         = wp_nonce_url( bp_displayed_user_url( $path_chunks ), 'messages_delete_thread' );
    23012305
    23022306        /**
     
    23052309         * @since 1.0.0
    23062310         *
    2307          * @param string $value URL for deleting the current thread.
    2308          * @param string $value Text indicating action being executed.
    2309          */
    2310         return apply_filters( 'bp_get_message_thread_delete_link', wp_nonce_url( bp_displayed_user_domain() . bp_get_messages_slug() . '/inbox/delete/' . bp_get_the_thread_id(), 'messages_delete_thread' ) );
     2311         * @param string $url URL for deleting the current thread.
     2312         */
     2313        return apply_filters( 'bp_get_message_thread_delete_link', $url );
    23112314    }
    23122315
     
    23272330     */
    23282331    function bp_get_the_thread_exit_link() {
     2332        $path_chunks = bp_members_get_path_chunks( array( bp_get_messages_slug(), 'inbox', 'exit', bp_get_the_thread_id() ) );
     2333        $url         = wp_nonce_url( bp_displayed_user_url( $path_chunks ), 'bp_messages_exit_thread' );
    23292334
    23302335        /**
    23312336         * Filters the URL to exit the current thread.
    23322337         *
    2333          * @since 1.0.0
    2334          *
    2335          * @param string $value URL to exit the current thread.
    2336          * @param string $value Text indicating action being executed.
    2337          */
    2338         return apply_filters( 'bp_get_the_thread_exit_link', wp_nonce_url( bp_displayed_user_domain() . bp_get_messages_slug() . '/inbox/exit/' . bp_get_the_thread_id(), 'bp_messages_exit_thread' ) );
     2338         * @since 10.0.0
     2339         *
     2340         * @param string $url URL to exit the current thread.
     2341         */
     2342        return apply_filters( 'bp_get_the_thread_exit_link', $url );
    23392343    }
    23402344
Note: See TracChangeset for help on using the changeset viewer.