Changeset 14011
- Timestamp:
- 08/29/2024 12:29:00 AM (6 weeks ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-template.php
r13897 r14011 244 244 245 245 /** 246 * Returns the registration page root slug. 247 * 248 * This function is used to set the BP Signup rewrite rule and permastruct. 249 * 250 * @since 15.0.0 251 * 252 * @return string The registration page root slug. 253 */ 254 function bp_get_signup_root_slug() { 255 /** 256 * Filter here to edit the registration page root slug. 257 * 258 * @since 15.0.0 259 * 260 * @param string $register_root_slug The registration page root slug. 261 */ 262 return apply_filters( 'bp_members_register_root_slug', bp_get_signup_slug() ); 263 } 264 265 /** 246 266 * Output the activation slug. 247 267 * … … 275 295 return apply_filters( 'bp_get_activate_slug', $slug ); 276 296 } 297 298 /** 299 * Returns the registration page root slug. 300 * 301 * This function is used to set the BP Signup rewrite rule and permastruct. 302 * 303 * @since 15.0.0 304 * 305 * @return string The registration page root slug. 306 */ 307 function bp_get_activate_root_slug() { 308 /** 309 * Filter here to edit the activation page root slug. 310 * 311 * @since 15.0.0 312 * 313 * @param string $activate_root_slug The activation page root slug. 314 */ 315 return apply_filters( 'bp_members_activate_root_slug', bp_get_activate_slug() ); 316 } 277 317 278 318 /** -
trunk/src/bp-members/classes/class-bp-members-component.php
r13979 r14011 228 228 229 229 // Set-up Extra permastructs for the register and activate pages. 230 $this->register_permastruct = bp_get_signup_ slug() . '/%' . $this->rewrite_ids['member_register'] . '%';231 $this->activate_permastruct = bp_get_activate_ slug() . '/%' . $this->rewrite_ids['member_activate'] . '%';230 $this->register_permastruct = bp_get_signup_root_slug() . '/%' . $this->rewrite_ids['member_register'] . '%'; 231 $this->activate_permastruct = bp_get_activate_root_slug() . '/%' . $this->rewrite_ids['member_activate'] . '%'; 232 232 233 233 // Init the User's ID to use to build the Nav for. … … 726 726 ), 727 727 'member_activate' => array( 728 'regex' => bp_get_activate_ slug() . '/?$',728 'regex' => bp_get_activate_root_slug() . '/?$', 729 729 'order' => 40, 730 730 'query' => 'index.php?' . $this->rewrite_ids['member_activate'] . '=1', 731 731 ), 732 732 'member_activate_key' => array( 733 'regex' => bp_get_activate_ slug() . '/([^/]+)/?$',733 'regex' => bp_get_activate_root_slug() . '/([^/]+)/?$', 734 734 'order' => 30, 735 735 'query' => 'index.php?' . $this->rewrite_ids['member_activate'] . '=1&' . $this->rewrite_ids['member_activate_key'] . '=$matches[1]', 736 736 ), 737 737 'member_register' => array( 738 'regex' => bp_get_signup_ slug() . '/?$',738 'regex' => bp_get_signup_root_slug() . '/?$', 739 739 'order' => 20, 740 740 'query' => 'index.php?' . $this->rewrite_ids['member_register'] . '=1', -
trunk/tests/phpunit/testcases/routing/members.php
r13980 r14011 122 122 $this->assertSame( get_current_user_id(), bp_displayed_user_id() ); 123 123 } 124 125 public function filter_root_slug( $root_slug ) { 126 return 'community/' . $root_slug; 127 } 128 129 /** 130 * @ticket BP9063 131 */ 132 public function test_members_registration_page_filtered() { 133 $this->set_permalink_structure( '/%postname%/' ); 134 135 add_filter( 'bp_members_register_root_slug', array( $this, 'filter_root_slug' ) ); 136 bp_delete_rewrite_rules(); 137 138 // Regenerate rewrite rules. 139 $this->go_to( home_url() ); 140 $bp_registration_url = bp_get_signup_page(); 141 142 remove_filter( 'bp_members_register_root_slug', array( $this, 'filter_root_slug' ) ); 143 144 $this->go_to( $bp_registration_url ); 145 146 $this->assertTrue( false !== strpos( $bp_registration_url, 'community' ) ); 147 $this->assertTrue( bp_is_register_page() ); 148 } 149 150 /** 151 * @ticket BP9063 152 */ 153 public function test_members_registration_page() { 154 $this->set_permalink_structure( '/%postname%/' ); 155 $bp_registration_url = bp_get_signup_page(); 156 157 $this->go_to( $bp_registration_url ); 158 159 $this->assertTrue( false === strpos( $bp_registration_url, 'community' ) ); 160 $this->assertTrue( bp_is_register_page() ); 161 } 162 163 /** 164 * @ticket BP9063 165 */ 166 public function test_members_activation_page_filtered() { 167 $this->set_permalink_structure( '/%postname%/' ); 168 169 add_filter( 'bp_members_activate_root_slug', array( $this, 'filter_root_slug' ) ); 170 bp_delete_rewrite_rules(); 171 172 // Regenerate rewrite rules. 173 $this->go_to( home_url() ); 174 $bp_activation_url = bp_get_activation_page(); 175 176 remove_filter( 'bp_members_activate_root_slug', array( $this, 'filter_root_slug' ) ); 177 178 $this->go_to( $bp_activation_url ); 179 180 $this->assertTrue( false !== strpos( $bp_activation_url, 'community' ) ); 181 $this->assertTrue( bp_is_activation_page() ); 182 } 183 184 /** 185 * @ticket BP9063 186 */ 187 public function test_members_activation_page() { 188 $this->set_permalink_structure( '/%postname%/' ); 189 $bp_activation_url = bp_get_activation_page(); 190 191 $this->go_to( $bp_activation_url ); 192 193 $this->assertTrue( false === strpos( $bp_activation_url, 'community' ) ); 194 $this->assertTrue( bp_is_activation_page() ); 195 } 124 196 }
Note: See TracChangeset
for help on using the changeset viewer.