BuddyDev

Search

Possible bug exposed via BP Member Types Pro & BP Registrations Options plugin

  • Participant
    Level: Enlightened
    Posts: 25
    Sam Morris on #22309

    Hi Brajesh – My apologies in advance if I am incorrect in my assumption that there may be any issue with your plugin. Basically, the author of the other plugin is saying that the issue I’m having cannot be as a result of his plugin. It’s pretty easy for me to explain, and I will give you a link showing you the support thread of the issue I’m having as well as the browser errors being caused.

    So, this plugin (BP Registrations Options) allows for the approval of new users, and some additional code he wrote for the functions.php allows for specifying which member role this approval requirement will apply for. I have two member roles (Individuals & Services providers). I don’t want or need to approve member role of Individuals (which have no conditional fields), but I do want to approve the member role for Service providers so that I can verify the conditional fields they’re submitting (via Member Types Pro). The only issue is about the submit button not submitting when the conditional fields are hidden (Individual member role) and this other plugin is active. However, everything works fine when the other plugin is deactivated. So like I said, I’m weary of casting any blame here! But as it seems to relate to the hidden conditional fields, I thought it appropriate to take a stab here.

    Here’s the original support thread (I’m “beekoff”) where he publishes the extra code for someone else, then I chime in later and tell him it’s having an issue. The browser errors I’m getting are in there too. I can give you a link to test yourself if you can make this private. I’ll have to give you .htpasswd login to get past security screen.

    https://wordpress.org/support/topic/2-member-typed-different-registration-permission/

    Much thanks,
    Sam

    P.S. I wish you would takeover this guy’s plugin, and build on top of it! It’s very useful and could use many more features.

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #22314

    Hi Sam,
    Thank you for the topic and sharing the details.
    Please allow me 1 -2 hour to check and get back to you.

    I have a question though:-
    Do you have any required field marked as conditional? Specially in base profile field group? A hidden required field may stop the submit button. I have mentioned in on our conditional section to avoid this issue.

    As of the code provided by Michael. It gives us the idea how to exclude certain type. Please allow me to look at it and see if it can cause the issue(That code snippet can not cause the issue, the plugin may do it).
    I will be writing back in 2 hours.

    PS:- About forking the plugin. Thank you for the suggestion and I appreciate it. It seems Michael has been managing and supporting it sincerely for so many years, It will be unfair for us to fork the plugin. We do hope that we can contribute to the plugin if you share your ideas with us.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #22316

    Hi Sam,
    Here is the slightly modified code from the example you linked

    
    
    function bpro_custom_per_member_type_moderation_override( $user_id ) {
    	$member_types = bp_get_member_type( $user_id, false );// get an array of member types.
    
    	if( empty( $member_types) ) {
    		return;
    	}
    
    	$non_moderated_member_type = "student"; //please change it.
    	if ( in_array( $non_moderated_member_type, $member_types, true ) ) {
    		bp_registration_set_moderation_status( $user_id, 'false' );// disable moderation.
    	}
    
    }
    add_action( 'bp_core_activated_user', 'bpro_custom_per_member_type_moderation_override', 9 );
    
    

    Please make sure to change the non moderated member type and it should work.

    Also, For the disabling of the submit, Please look for the field marked as required in the Base/Frist profile field group.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 25
    Sam Morris on #22330

    Hi Brajesh – Thank you for your code tweak. Unfortunately after trying every combination of solutions, and I’m still getting the same issue each time:

    jquery-migrate.min.js?ver=1.4.1:2 JQMIGRATE: Migrate is installed, version 1.4.1
    (index):1 An invalid form control with name=’field_2′ is not focusable.
    (index):1 An invalid form control with name=’field_15′ is not focusable.
    (index):1 An invalid form control with name=’field_4′ is not focusable.
    (index):1 An invalid form control with name=’field_6′ is not focusable.
    (index):1 An invalid form control with name=’field_13′ is not focusable.
    (index):1 An invalid form control with name=’field_7′ is not focusable.
    (index):1 An invalid form control with name=’field_14′ is not focusable.
    (index):1 Unchecked runtime.lastError: The message port closed before a response was received.

    But I CAN say that I don’t believe it’s in your or Michael’s code tweak. They both seem to be doing their job. I suspect, like you perhaps, that the issue lies somewhere around the conditionals (or the old ones). I deactivated your BP Conditionals plugin after you mentioned it wasn’t necessary any longer after changes you made to BP Member Types. So, I reactivated it and added a HIDE of each field “not focusable” above, but no difference. I did notice after reactivation that one of the fields had retained an earlier conditional. I have changed each to N/A, but still no luck. Is it possible that old conditional settings are still attached in the database, and that it could be somehow related?

    I’m almost certain that my settings are correct, according to your Member Type documentation. Would you like login credentials to check?

    I’ll keep trying until I get this!

    Thanks,
    Sam

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #22333

    Hi Sam,
    It is most probably an issue with how the Conditional fields work in conjunction with required fields.

    Please visit Dashboard->Users->Profile Fields and click on the First field group.

    Please share me a screenshot of the fields list there. I am assuming it is caused by Member Types pro(conditional registration).

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 25
    Sam Morris on #22341

    Brajesh – Here’s a gif video link: http://recordit.co/OMjqOGFC8W

    I had BP Conditionals plugin active during the vid, but every field was set to N/A, so it’s probably not affecting anything (I’m assuming). I’ve tried it both ways.

    Thanks,
    Sam

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #22342

    Hi Sam,
    Thank you for sharing.

    The problem is related to Member Types Pro. We have the conditional field option in Member Types pro. It hides a field if it is not needed by a member type.

    Since the field is present on page and BuddyPress adds html “required” attribute to the page, It browsers do not allow submitting.

    You can either disable conditional registration field(as shown below) or mark the fields from the Primary field as non required.
    https://i.imgur.com/bDsr4WR.png

    Any field which might be invisible due to condition should not be marked as required.

    Please see my hilighted note in point 4 here. We were expecting this issue
    https://buddydev.com/docs/buddypress-member-types-pro/conditional-buddypress-registration-fields-based-on-buddypress-member-types/

    Sorry for the inconvenience.
    If you have suggestions on how can we make the docs on this better, Please help me make it better and avoid such issue for others in future.

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 25
    Sam Morris on #22343

    Hi Brajesh – Ugggh!

    That really sucks, as it invalidates my whole registration process. I need to conditionally hide required fields. Absolutely need to. And seems pretty normal to me. So I am thinking of posting a bug report on BuddyPress support. It seems like a bug to me. The idea that the BP registration process doesn’t account for conditionally hiding required fields must be an oversight (or else that it doesn’t allow plugins to override this). Do you agree about this being a Buddypress oversight/bug? Just curious.

    Thanks,
    Sam

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #22354

    Hi Sam,
    I do agree that there should be a simple way for developres to mark a field as non required(in html attributes).

    It is still doable but too complex at the moment. Please do report it.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 25
    Sam Morris on #22400

    Hi Brajesh – I’ve got a few responses on Buddypress support from @Ventutius (moderator). He has posted a solution that I can’t get to work yet. Maybe you want to jump in, as it’s likely a workaround solution you can add to your documentation. Like I said, I can’t get it to work yet, but he seems to think it should. Hope you can take a look! Please let me know if you see any errors in proposed snippet.

    https://buddypress.org/support/topic/bypass-email-requirement-2/#post-305046

    Thank you!
    Sam

    P.S. Here’s my original post: https://buddypress.org/support/topic/ability-to-conditionally-hide-required-xprofile-fields/

You must be logged in to reply to this topic.

This topic is: not resolved