Prosites - Skip Payment Information During First Month

Hello! I'm trying to find out which functions Prosites calls when a new user creates a paid blog. I'd like to bypass the paid activation for the first month so my users can activate their account without entering their payment information. Some people get uncomfortable with entering their information before they need to pay for something :slight_smile: Is there a recommended way to do this automatically without a plugin?

So far I've found out that the function wpmu_new_user() is called right after the user is created in the database, but I can't seem to get the respective activation key. I'm assuming the key is created in a different function that is called afterwards. If I can get the key, I think I can use activate_user_blog() to do the rest (please correct me if I'm wrong).

Here's what I have so far:

add_action( 'wpmu_new_user', 'my_new_user', 10, 3 );
function my_new_user( $user_id ) {

global $wpdb;

$user = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE ID = %s", $user_id ) );

$signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signup WHERE user_login = %s", $user->user_login ) );

// activate_user_blog() stuff goes here after retrieving the activation_key

}

Thank you for any help you can provide :slight_smile:

  • Dimitris

    Hello there Urbano,

    hope you're doing good today and thanks for reaching us! :slight_smile:

    There are already hooks in ProSites, so along with some JS this may be possible.
    Can't promise anything, but I've escalated this in our Second Level Support team for further investigation. Me or another colleague of mine will keep you posted here, as soon as we've got some valuable insights. Your patience on this is highly appreciated!

    Warm regards,
    Dimitris

  • Panos

    Hi Urbano ,

    Pro Sites uses the Trial feature that the gateways offer. So even if member inserts their card info, they won't get charged until trial is over.

    Currently the above filter would work only if you the Allow multiple blogs is NOT enabled. You can use it as following:

    add_action( 'wpmu_new_user', function( $user_id ){
    
    	global $wpdb, $psts;
    
    	$user = get_user_by( 'ID', $user_id );
    	$activation_key = $wpdb->get_var(
    		$wpdb->prepare(
    			"SELECT activation_key FROM {$wpdb->signups} WHERE user_email='%s'", $user->user_email
    		)
    	);
    
    	$custom_period_days 	= 30;
    	$site_details 			= ProSites_Helper_Registration::activate_blog( $activation_key, false, $custom_period_days, $_POST['level'] );
    
    }, 20 );

    If you have the "Allow multiple blogs" active we would need to plant a new action hook to use. This of course would mean that it should be repeated after each update, or perhaps we could add it in a future version.

    Cheers!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.