Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom Permalink and Rewrite Rules for Buddypress?

  • Hi, the standard permalink structure is:

    site.com/groups/uk-chess-group

    But I would like to achieve

    site.com/uk-chess-group-g9

    (Where 9 is the id for the group)

    I can do this with a standard WordPress install using $wp_rewrite->add_rule and $wp_rewrite->add_permastruct along with hooking into the post_type_link filter.

    Can anyone suggest a way achieving this with a BP install?

Viewing 4 replies - 1 through 4 (of 4 total)

  • Roger Coathup
    Participant

    @rogercoathup

    A lot of the BP URL processing is done by component — components register their base URL part (in this case ‘groups’), and provide functions to process the URL and screen redirects.

    If you look in bp-groups-loader.php you can see where the slug is set up, and a walk through of the code in bp-groups-screen.php will show you how the screens are being called.

    I’m fairly sure but can’t remember for certain, that BP is grabbing the URLs and processing them, before passing any ‘non-BP’ urls to the standard WP URL rewrite arrays for processing.

    [Edit: You may be able to hook in before this happens, and do your group processing]. We’ve done this on one of our sites, but I can’t remember the details off the top of my head.

    However, how are you going to recognise the endpoint as a group, as opposed to a standard WP page or post? Are you planning to have a test that gets the endpoint and checks whether it is a group name?

    p.s. uk-chess-group? Are you going to be at the British in next couple of weeks?

    Thanks for shedding some light. I’ve been able to re-arrange the permalink structure correctly, now to look at processing the new format.

    I will have to do a lookup based on group slug in the wp_bp_groups table unless I can see a cleaner way of checking.

    No sorry! Just used chess as an example!


    samurai
    Participant

    @samurai

    I’ve achieved the same by hooking into “bp_uri” and “bp_get_group_permalink”


    alishoja
    Participant

    @alishoja

    i have the same problem, please share your solution!
    thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom Permalink and Rewrite Rules for Buddypress?’ is closed to new replies.
Skip to toolbar