Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/15/2023 08:16:46 AM (13 months ago)
Author:
imath
Message:

Make more BuddyPress generated links ready for BP Rewrites

  • Improve the Members component adding permastructs and custom rewrite

rules for registration and activation pages.

  • Improve the Blogs component adding custom rewrite rule to handle the

Blogs create page.

  • Make a huge progress about replacing all occurrences of

bp_get_root_domain() (45 replacements were performed).

  • Deprecate bp_groups_directory_permalink(),

bp_get_groups_directory_permalink(), bp_blogs_directory_permalink() &
bp_get_blogs_directory_permalink() and replace them with these new
functions: bp_groups_directory_url(), bp_get_groups_directory_url(),
bp_blogs_directory_url() & bp_get_blogs_directory_url().

  • Although bp_loggedin_user_domain() & bp_displayed_user_domain()

should also be deprecated, we're leaving them as aliases of the right
functions to use. Plugin authors shouldn't use them to build other links
than member's profile home url.

NB: these deprecations are required because these functions were used
to build BuddyPress URLs concatenating URL chunks. Once the BP Classic
plugin will be built we will adapt the code to remove these deprecation
notices.

Props r-a-y, johnjamesjacoby, boonebgorges

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

File:
1 edited

Legend:

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

    r13433 r13436  
    8787     */
    8888    function bp_get_activity_directory_permalink() {
     89        $url = bp_rewrites_get_url(
     90            array(
     91                'component_id' => 'activity',
     92            )
     93        );
    8994
    9095        /**
     
    95100         * @param string $url Permalink url for the activity directory.
    96101         */
    97         return apply_filters( 'bp_get_activity_directory_permalink', trailingslashit( bp_get_root_domain() . '/' . bp_get_activity_root_slug() ) );
     102        return apply_filters( 'bp_get_activity_directory_permalink', $url );
    98103    }
    99104
     
    23932398     */
    23942399    function bp_get_activity_comment_delete_link() {
    2395         $link = wp_nonce_url( trailingslashit( bp_get_activity_directory_permalink() . 'delete/' . bp_get_activity_comment_id() ) . '?cid=' . bp_get_activity_comment_id(), 'bp_activity_delete_link' );
     2400        $url  = bp_rewrites_get_url(
     2401            array(
     2402                'component_id'                 => 'activity',
     2403                'single_item_action'           => 'delete',
     2404                'single_item_action_variables' => array( bp_get_activity_comment_id() ),
     2405            )
     2406        );
     2407        $link = wp_nonce_url( add_query_arg( 'cid', bp_get_activity_comment_id(), $url ), 'bp_activity_delete_link' );
    23962408
    23972409        /**
     
    29923004        }
    29933005
    2994         $url = trailingslashit( bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/delete/' . $activity_id );
     3006        $url = bp_rewrites_get_url(
     3007            array(
     3008                'component_id'                 => 'activity',
     3009                'single_item_action'           => 'delete',
     3010                'single_item_action_variables' => array( $activity_id ),
     3011            )
     3012        );
    29953013
    29963014        // Determine if we're on a single activity page, and customize accordingly.
     
    38703888     */
    38713889    function bp_get_sitewide_activity_feed_link() {
     3890        $url  = bp_rewrites_get_url(
     3891            array(
     3892                'component_id'       => 'activity',
     3893                'single_item_action' => 'feed',
     3894            )
     3895        );
    38723896
    38733897        /**
     
    38763900         * @since 1.0.0
    38773901         *
    3878          * @param string $value The feed link for sitewide activity.
    3879          */
    3880         return apply_filters( 'bp_get_sitewide_activity_feed_link', bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/feed/' );
     3902         * @param string $url The feed link for sitewide activity.
     3903         */
     3904        return apply_filters( 'bp_get_sitewide_activity_feed_link', $url );
    38813905    }
    38823906
Note: See TracChangeset for help on using the changeset viewer.