Activate User in Code (BuddyPress+bbpress)


It’s insane, but my client wants to suppress the activation email that BuddyPress sends out for activation – she feels that the double-optin that the mass email service sends is ‘enough’ – that was easy enough to do by setting the email to draft mode without touching any code.

My plugin does an API to hand the just-enrolled (WP user regiatration) email to the mass email service and that’s working fine. The mass email service double-optin email is going out fine to the new email address.

But after I’ve handed off the email address, I need to move the new user from the Pending page in Users to the main Users page with a wp role/capability of ‘Subscriber’ and a BuddyPres/bbpress capability/role of ‘Participant’ without the client having to go in and activate the user by hand. I’ve been searching WP codex and BuddyPress codex for hints toward an action or filter hook that will do this, but no luck so far. I’ve even gone so far as to try some direct sql mods ti the wp_users and wp_usermeta tables, but no luck, although mods to other items like display_name, etc worked fine.

I know the dangers of this and have explained them carefully to the client, but she still wants to crash ahead with this. She’ll just have to get the lesson the hard way when her forum fills up with porn. I do plan on implementing this so it’s easily reversible, but she just has to walk thru that dark valley.

Any help on some code that I can fire from my plugin that will fully activate a user as described above? Thanks for your kind help – no example code here to share because 6-8 methods I tried were all dismal failures.

, Ron Robinson 3 years 2020-03-25T16:52:20-05:00 0 Answers 109 views 0

Leave an answer