Altering the WordPress / BuddyPress account activation process

Hi. I'm trying to alter the registration and activation process for a BuddyPress site. At the moment, when someone clicks the activation link in their email they're taken to the activate page but then there's a form with their activation key prefilled and they have to submit that form to activate their account. I'd like them instead to be activated as soon as that page loads, without having to submit the form. Are there hooks or filters that will enable me to alter the functionality to do that, and to take them directly to a page telling them their account is now active and they can login?

  • Adam Czajczyk

    Hi Turnpiece

    I hope you're well today and thank you for your question!

    I'm not aware of any plugin that would be doing this (most of them are removing mail activation entirely) and I couldn't find any hooks for this but I came up with a simple JS workaround that simply submits the form automatically on page load.

    To use it on your site, follow these steps please:

    1. create an empty file with a php extension (e.g. bp-auto-key-activation.php)
    2. copy and paste following code into it using some "clean text" editor such as e.g. Notepadd++, Sublime or similar:

    <?php 
    
    function wpmu_bp_activation_key_auto_submit() {
    	?>
    	<script type="text/javascript">
    	jQuery(document).ready(function(j) {
    		j('#activation-form .submit').remove();
    		j('#activation-form').submit();
    
    	});
    	</script>
    	<?php
    }
    add_action('wp_footer', 'wpmu_bp_activation_key_auto_submit', 99);

    3. Save the file and upload it to your site via FTP or cPanel "File Manager" to the

    /wp-content/mu-plugins folder

    If there's no "mu-plugins" folder right inside "wp-content", just create an empty one.

    Let me know if this worked for you, please.

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.