BuddyDev

Search

BP Ajax Registration – Registration form loading on every page

  • Participant
    Level: Initiated
    Posts: 18
    Archaic Guru on #5611

    Hello I tried to reply to the last thread but it is closed, everything looked working but then I noticed the registration form loads on every page, when you scroll down below the content it is visible

    Here is an example

    https://prelaunch.musimony.com/login/

    Do you know why this could be happening? Maybe from the custom code from yesterday?

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #5623

    Hi Archaic,
    I am sorry, I had closed that topic per your last message.

    I can understand it happening. We are forcing the plugin to load on one page, It was not created for that. Here is a temporary solution. I will have better way to handle it in future.

    For now, Please open bp-ajax-register.php and modify this

    
    function bpajaxr_include_form() {
    
    	if ( is_user_logged_in() || ! bp_get_signup_allowed() ) {
    		return;
    	}
    
    	$is_enabled = get_option( 'bp_ajax_use_registration_form', 1 );
    
    	if ( $is_enabled ) {
    		return;
    	}
    
    	$helper = BP_Ajax_Registration_Handler::get_instance();
    
    	BP_Ajax_Registration_Handler::show_form();
    }
    
    

    to this

    
    function bpajaxr_include_form() {
    
    	if ( is_user_logged_in() || ! bp_get_signup_allowed() ||  ! is_page( 'sign-up' ) ) {
    		return;
    	}
    
    	$is_enabled = get_option( 'bp_ajax_use_registration_form', 1 );
    
    	if ( $is_enabled ) {
    		return;
    	}
    
    	$helper = BP_Ajax_Registration_Handler::get_instance();
    
    	BP_Ajax_Registration_Handler::show_form();
    }
    
    

    That will do it.

  • Participant
    Level: Initiated
    Posts: 18
    Archaic Guru on #5650

    that cured it from appearing on every page but now it does not popup anymore, you still have to scroll down to see it. I have customized the code but I tried reverting to a state when it worked and it did not work, any ideas?

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #5651

    Hi Archaic,
    I am sorry for the trouble you had to go through. Please let me update the plugin instead and remove all these dependencies from the last topic and this and I am going to make it simple enough to load on any single page. Please let me do it for couple of hours.

    That will be better as it will avoid any issue for you in future upgrades.

  • Participant
    Level: Initiated
    Posts: 18
    Archaic Guru on #5652

    I am sorry you have to go through so much trouble. I love your plugin so I really think it is a perfect fit for our site there are just a few things that seem to conflict. I changed the /sign-up page to have data in the query string ie) /sign-up/?membership=4 so it is possible that part is causing a conflict somehow, but it really is a nice plugin, so if my pestering you helps turn it into a better plugin for more people to share and better sales I am here to help. if you are going to rebuild it, I would suggest pagination between buddypress xprofile groups that might take it to the next level 🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #5660

    Hi Archaic,
    No problem. I have updated the plugin. The goal of this update was to streamline the loading of form/js/css etc.

    Please Upgrade and then, Please make sure to do the following:-

    Please Visit Dashboard->settings->BuddyPress->Options
    and un check the box that says

    
    Enable Ajax Loading of Form 
    
    

    under the BuddyPress Ajax registration setting

    Once you are done with that, you can put the following code

    
        setTimeout( function () {
            show_reg_form();
        }, 1000 );
    

    In the file wp-content/plugins/bp-ajax-registration/_inc/bp-ajax-register.js
    Just after the line

    
      var magnificPopup = jQuery.magnificPopup.instance;
    

    The above is copied from https://buddydev.com/support/forums/topic/buddypress-ajax-registration-popup-on-pageload/page/2/#post-5588

    And the last thing, remove any php code you are using from my previous post. They are not needed any more. Just add the following code in your bp-custom.php

    
    
    function bpajaxr_only_enable_on_this_page( $load = false ) {
    
    	if (  is_page( 'uploader' ) && ! is_user_logged_in() ) {
    		return true;
    	}
    
    	return false;
    
    }
    
    add_filter( 'bp_ajaxr_is_form_enabled', 'bpajaxr_only_enable_on_this_page');
    
    

    That will do it.

    Since the BuddyPress currently only supports one Profile Group on registration(It will change in future), I haven’t done much on that front. Hoping to push another release in next week or so with the login/password reset feature.

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 18
    Archaic Guru on #5662

    I followed your steps but I must be missing something, the popup does not load on any pages now, I tried changing uploader to sign-up in this part:

    if ( is_page( ‘sign-up’ ) && ! is_user_logged_in() ) {

    but it did not seem to make a difference

  • Participant
    Level: Initiated
    Posts: 18
    Archaic Guru on #5663

    I can send you my modified registration form because I got the multi-group part working, it was a pain in the ass so I am happy to share

  • Participant
    Level: Initiated
    Posts: 18
    Archaic Guru on #5664

    I think I got it workink but its a hack, I used the old bp-ajax-registration.php and ajax-register-form.php files and the popup is working again and I dont notice any strange behavior on the other pages so far so good

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #5668

    Hi Archaic,
    Please do send me the copy of xprofile groups at brajesh@buddydev.com

    About the changes, I will suggest using the latest version and try fiddling with ‘is_page( ‘uploader’ )’ condition instead to see if the form is appearing on all pages on not.

    Yesterday’s change was aimed at unifying the conditions instead of using multiple filters for 3 different kind of loading and is future proof.

You must be logged in to reply to this topic.

This topic is: not resolved