Support » Fixing WordPress » rewrite rules problem. Cannot add URI starting with "members"

  • I’m desperate after having googled and digged through core files all day, and I am no wiser on this.

    I’m porting an existing site to WP and have added a lot of rules to the rewrite_rules array of $wp_rewrite through a function called by the ‘rewrite_rules_array’ filter.

    Sometimes I have to remove existing rules from the array before I add my own, in order to avoid conflicts. So far so good.

    But when I try adding URI’s starting with “members”, such as “members/register”, they just don’t work and instead cause a redirect to the site root.

    What confuses me is that if I print out the contents of the $wp_rewrite->rewrite_rules array in a template (at which time all rules should be added) there are no other rules starting with “members” than my own?!

    So…

    1) Why doesn’t my rules work, if there are no conflicting ones?

    2) I know that Buddypress has some URI’s starting with “members”. They work fine. But where do buddypress tell wordpress rewriting system about these URL’s???! – They don’t show up in the rewrite array..

Viewing 5 replies - 1 through 5 (of 5 total)
  • Paul Gibbs

    (@djpaul)

    BuddyPress Lead Developer

    BuddyPress currently doesn’t use the rewrite rules system. We literally intercept the relevant URLs. If you can’t/don’t want to change your rewrites, you’ll need to rename the appropriate BuddyPress slug to avoid this conflict. For example, in your wp-config.php, add:

    define ( 'BP_MEMBERS_SLUG', 'users' );

    Mr Brother Gibb,
    I installed buddypress twice – once to an existing multi-site installation and once to a brand new one and guess what? NEITHER WORK! BY BUDDYPRESS IS BROKEN.

    So please let the world know what the big dark secret is to stopping anything after /members from redirecting to the home page. We know you are sitting on the secret.

    I have seen posts about this going back over a year so obviously this is a problem with a solution. But I haven’t seen the solution posted anywhere!

    Thank you!

    Ha ha I figured out the problem.
    There is an undocumented solution buried deep.

    Come on brother Gibb, fess!
    Tell everyone how easy it is to eliminate the problem. Reveal the big secret.

    Big hint. It’s sitting in the middle of this page-
    http://codex.buddypress.org/extending-buddypress/changing-internal-configuration-settings/ and contains 37 characters.

    Hi Paul

    I know that I can change the default slugs in the config file, but as my pages that uses “members” should logically be placed under BP, I’d like to use that slug for both BP and my own pages. My pages are i.e. a custom registration page and som members club stuff.

    So if BP doesn’t use WP’s rewrite array, could you instead direct me to the place in the BP code where the URI’s starting with “members” are intercepted?

    I’m sure I can hook in somewhere and make the neccesary modifications.

    For further notice, I think it should be a goal to sometime in the future make BP use WP’s rewrite system, so that conflicts like this will not occur.

    Thanks 🙂

    bump

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘rewrite rules problem. Cannot add URI starting with "members"’ is closed to new replies.