Pro Sites extending through GForms - How to(?)

Hi there!
(wow this topic got posted before I entered content after hitting the No:slight_frown: button...

I've recently brought you guys the following plugin, just activate it on your main blog or put it into your theme's functions.php file so a user can get a Pro Sites subscription right through your Gravity Forms signup form!

All that's required is the following plugin:

This is the plugin I've written, note that you'll have to edit the numbers according to your own Gravity Forms layout - Feel free to ask any questions about this in this topic:

/* Gforms Pro Sites Creation */
function enter_pro_site_level($site_id, $user_id, $entry, $config, $user_pass) {
	global $wpdb,$psts;

	$pstslevel =  strstr($entry['8'], '|', true);

	$getperiod =  strstr($entry['9'], '|', true);
	$getperiod .=  strstr($entry['10'], '|', true);
	$getperiod .=  strstr($entry['11'], '|', true);

	if ($getperiod == "termmonth") {
		$pststime = strtotime("+1 month");
	else if ($getperiod == "term3months") {
		$pststime = strtotime("+3 month");
	else if ($getperiod == "termyear") {
		$pststime = strtotime("+1 year");
	else {
		$pststime = time();

	$pstsgateway = 'GFormRegister';
	$pststerm = '';
	$pstsamount = '';

		$update_level = $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->base_prefix . "pro_sites (blog_ID, level, expire, gateway, term) VALUES ('$site_id', '$pstslevel', '$pststime', '$pstsgateway', '$pststerm')", $site_id, $pstslevel));

	$psts->record_stat($site_id, 'upgrade');
	$psts->log_action($site_id, __("GFormsRegister changed Pro-Sites level to Level ID {$level}.") );	


add_action("gform_site_created", "enter_pro_site_level", 10, 5);

This is the result:

This is entry 8:
This is entry 9, 10 and 11:

For all I know, this plugin hasn't failed me once in all my testing!

NOW, I want to EXTEND or UPGRADE or DOWNGRADE the Pro Sites.
But before I get to programming it, I first want to know the following:
1. What happens when a user extends? I think the existing Pro Site's time gets pulled and the extended time gets added and put back into the database?
2. What happens when a user DOWNGRADES? This is kind of blowing my mind.
3. What happens when a user UPGRADES? Will it take immediate effect? What happens to the remaining time on the current subscription?

If that's answered I'll provide you with a working code within 3 days :slight_smile:

Have a great week everyone!