2 member typed different registration permission
-
Hi,
I’ve got 2 member types. Is it possible that I become an admin request for the member registration from type 1, but type 2 can registrate without the admin permission?
Thanks for reply.
-
What sort of data or information would be present to distinguish between the two types? Just BuddyPress’ core distinctions?
Trying to think of a way to potentially bypass the moderation process conditionally. Right now with the code as is, it’ll probably be a case of either removing the function we assign status in, or programmatically removing the moderation status right away after registration is complete for those specific types.
Thanks for your reply. I’m using buddypress member types. The only difference is that I want for 1 user type, that he needs his phone number. And I want to check his number first, bevore he can register.
I’m assuming at least one of these:
https://codex.buddypress.org/developer/member-types/
https://www.buddyboss.com/product/buddypress-member-types/
The first one may provide some usable info, at least once I know what your two types are. Like after we’ve done our processing, provide you with a 2nd function to run right after that does the member type check and removes our meta data for the appropriate type.
I′m sorry. Can you please explain what you mean with:
“Like after we’ve done our processing, provide you with a 2nd function to run right after that does the member type check and removes our meta data for the appropriate type.”The links from you got no information for my problem.
First link would be if your member types solution/setup/implementation just uses some custom code from someone, while the second link is taking a guess that you maybe used that plugin to set everything up.
Regarding the rest of my comment, the idea I am thinking is have our plugin do its thing, and then shortly after it’s done, run some custom code that I’d help type up that would check if the newly created user has a specific member type, and if they do, remove that pending/moderated status that we just set. Basically mark all the new ones moderated and then immediately, conditionally, mark them approved automatically.
Fine. So can you write this CSS? I′m just at the beginning of a long trip to learn CSS ?? }
No CSS involved, it’d be all PHP. I’ll aim to get it typed up a bit later this afternoon.
Let’s give this an attempt.
You’ll need to change the “type_value” spot to match the membership type you want to not be moderated.
This should go in your active theme’s functions.php, child theme hopefully, or if you’re crafty enough, a custom plugin.
With this code, we hook into the user_register hook, on a priority of 11, which is lower/later than our plugin’s usage. We grab the user’s member type, and if we find a match, set their moderated status to ‘false’. That’ll mean they’re already approved and ready to go. If no member type is found, we simply do nothing, and have them still be moderated. If there’s anywhere that I think this may not work, it’s here, in case the member type isn’t even assigned yet.
function bpro_per_member_type_moderation_override( $user_id ) { $member_type = bp_get_member_type( $user_id ); // No membershipt type found, Let's not do anything. if ( false === $member_type ) { return; } // Should return an array of member types, even if only one type assigned. if ( is_array( $member_type ) ) { if ( in_array( 'type_value', $member_type, true ) ) { bp_registration_set_moderation_status( $user_id, 'false' ); } } } add_action( 'user_register', 'bpro_per_member_type_moderation_override', 11 );
And how does the admin gets with this code a message for a new user registration request?
Yes. I’m using an child theme.
Maybe it will help when I give you my access data?
All of the emails and triggers you receive now, will still be done with this code. As mentioned earlier, my idea was simply to run a little bit extra for you right away after everything, and simply “undo” the moderated status setting that we apply. Think of it as making a tally mark on a piece of paper for everyone, but then immediately going “ah, you’re a student”, and the erasing the tally mark made for that person.
At this point, I’m not requesting or expecting any elevated access to the website. If you need me to make the “type_value” change for you, let me know the member type slug that you want to not be moderated.
Is there any way i send you pictures per PM, oder can you give me an E-Mail address?
[email protected] will reach me
Hi Michael – I also need this solution, and have just tried it with partial success. The member type that requires approval is passing through perfectly, but the member type that does not require approval is acting up. The submit button is not processing on the form for the member type that does not require approval.
I’m using Buddy Press Member Types Pro by BuddyDev.
My 2 member types are: Individual (individual) & Service (service). Only Services require approval. So, individuals that do not aren’t able to submit their registration form.I’ve used your code above, replacing “type_value” with “service”, and placed it in my Child’s function.php.
Thanks in advance,
SamHard to say what may be going on for you with that submit button not processing, since we wouldn’t be interjecting with that at all and the example code above would be run well after the submission process.
Are you experiencing smooth sailing without the code above in place?
I am. I’ll post the functions.php here. Also I’ll email you at the address above a link to my staging site with creds to get past the security screen (so you can see for your self.
Sam
- The topic ‘2 member typed different registration permission’ is closed to new replies.