Skip to:
Content
Pages
Categories
Search
Top
Bottom

Removing content filter on registration page


  • Cameron Jones
    Participant

    @cameronjonesweb

    I am building a site that requires a complex registration form. The form has been built in Gravity Forms and embedded in the page content of the registration page. I then had the below code hooked onto template_redirect:

    function remove_buddypress_registration_form() {
    
    		$bp_pages = get_option( 'bp-pages' );
    
    		if( is_page( $bp_pages['register'] ) ) {
    		
    			remove_filter( 'bp_template_include', 'bp_template_include_theme_compat', 4 );
    
    		}
    
    	}

    And it worked. The BP registration form was removed and the post content was displayed. But now that doesn’t work and I can’t really figure out why that would be. Even when I revert to the commit that I set it all up, it still doesn’t work. Obviously the ID of the page is being nuked by BP_Registration_Theme_Compat::dummy_post, but I guess my real question is why BP wouldn’t be running that before and now it is. There hasn’t even been an update since I wrote that code

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

  • Cameron Jones
    Participant

    @cameronjonesweb

    Clearing the register page option in the BP options and setting it again seems to fix this issue at least temporarily. No indication as to what will set it off though, feels like a ticking time bomb now


    Henry Wright
    Moderator

    @henrywright

    @cameronjonesweb

    Why are you unhooking the reg form from the content? I think the BuddyPress template hierarchy can help you here.

    Template Hierarchy

    You can just nuke the reg form from your-child-theme/buddypress/members/register.php and then add your custom form.


    Cameron Jones
    Participant

    @cameronjonesweb

    Why are you unhooking the reg form from the content?

    Cause this does exactly what I need it to? Cause using hooks is more sustainable and less likely to have conflicts in the future?

    Doesn’t explain why BP is nuking the post object one day and not the next


    Henry Wright
    Moderator

    @henrywright

    Cause using hooks is more sustainable and less likely to have conflicts in the future?

    Possibly but the template hierarchy is integral to BuddyPress and use is encouraged. If you find a water-tight alternative way of doing it then by all means use that approach instead.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar