Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/15/2023 08:16:46 AM (21 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-notifications/bp-notifications-template.php

    r13433 r13436  
    6161        if ( 0 === $user_id ) {
    6262            $user_id = bp_loggedin_user_id();
    63             $domain  = bp_loggedin_user_domain();
    64         } else {
    65             $domain = bp_members_get_user_url( (int) $user_id );
    6663        }
    6764
    68         $retval = trailingslashit( $domain . bp_get_notifications_slug() );
     65        $retval = bp_members_get_user_url(
     66            $user_id,
     67            array(
     68                'single_item_component' => bp_rewrites_get_slug( 'members', 'member_notifications', bp_get_notifications_slug() ),
     69            )
     70        );
    6971
    7072        /**
     
    102104        if ( 0 === $user_id ) {
    103105            $user_id = bp_loggedin_user_id();
    104             $domain  = bp_loggedin_user_domain();
    105         } else {
    106             $domain = bp_members_get_user_url( (int) $user_id );
    107106        }
    108107
    109         $retval = trailingslashit( $domain . bp_get_notifications_slug() . '/unread' );
     108        $retval = bp_members_get_user_url(
     109            $user_id,
     110            array(
     111                'single_item_component' => bp_rewrites_get_slug( 'members', 'member_notifications', bp_get_notifications_slug() ),
     112                'single_item_action'    => bp_rewrites_get_slug( 'members', 'member_notifications_unread', 'unread' ),
     113            )
     114        );
    110115
    111116        /**
     
    142147        if ( 0 === $user_id ) {
    143148            $user_id = bp_loggedin_user_id();
    144             $domain  = bp_loggedin_user_domain();
    145         } else {
    146             $domain = bp_members_get_user_url( (int) $user_id );
    147149        }
    148150
    149         $retval = trailingslashit( $domain . bp_get_notifications_slug() . '/read' );
     151        $retval = bp_members_get_user_url(
     152            $user_id,
     153            array(
     154                'single_item_component' => bp_rewrites_get_slug( 'members', 'member_notifications', bp_get_notifications_slug() ),
     155                'single_item_action'    => bp_rewrites_get_slug( 'members', 'member_notifications_read', 'read' ),
     156            )
     157        );
    150158
    151159        /**
Note: See TracChangeset for help on using the changeset viewer.