Pro Site Level and Gravity Forms Registration

Howdy all,
I'm looking at using Gravity forms for the registration process as I would like to collect a bit more information from the client and display some other stuff as well. Is there is a hook I can use with a custom field so a pro site level can be selected during registration.

I was thinking letting the user select the package they would like first and then go through the registration process.

I've seen a few posts discussing gravity forms and membership but I'm thinking it works a little differently to pro sites.

I'm may also have a question about the affiliate links but will wait and see how the referal url option works

Cheers,
D

  • dunskii

    Hi Milena,
    I haven't got around to getting the user to choose which package they want to use yet.
    But as for the rest of the registration process it works and looks pretty good.
    One thing I have come across so far is you need to set the sign up user role to Subsciber within Gravity forms, as that role is for access to your site not theirs (I had it as admin and was a complete freak out during alpha testing).
    I've been working on "how to content" (the wpmu video tuts were a great time saver btw so thanks for that guys,) and other stuff like finding themes I'm going to offer. When I get back to the fuctionality side I'll post here how/if I get it working how I want.
    Good luck and happy coding :slight_smile:
    D

  • dunskii

    Ok, well I've finally got around to look into this again and this is where I'm upto.

    I'm guessing this is the function that Phil was pointing me towards

    line 999
    function extend($blog_id, $extend, $gateway = false, $level = 1, $amount = false)

    Though am also think that one of levels function comes into play somewhere too
    line 347
    function get_level_setting($level, $key, $default = null)

    line 352
    function update_level_setting($level, $key, $value)

    Over in the Gravity Form docs I found this Hook/Filter "Gform user registration add option section" that seems to do the work for intergrating their User Registration Addon with multisite.

    Here's a chuck of how it works setting up a site on multisite

    add_action("gform_user_registration_add_option_section", "add_multisite_section", 10, 3);
    function add_multisite_section($config, $form, $is_validation_error) {
    
        get_current_site();
    
        $form_fields = self::get_form_fields($form);
        $multisite_options = $config['meta']['multisite_options'];
        $parent_blog = get_dashboard_blog();
        $current_blog = $GLOBALS['blog_id'];
    
        if($parent_blog->blog_id != $current_blog)
            return;
    
        ?>
    
        <div id="multsite_options" class="multsite_options">
    
            <h3>Multisite Options</h3>
    
            <div class="margin_vertical_10">
                <label class="left_header"><?php _e("Create Site", "gravityformsuserregistration"); ?> <?php gform_tooltip("user_registration_multisite_create_site") ?></label>
                <input type="checkbox" id="gf_user_registration_multisite_create_site" name="gf_user_registration_multisite_create_site" value="1" <?php echo ($multisite_options['create_site'] == 1) ? "checked='checked'" : "" ?> onclick="if(this.checked){jQuery('#multisite_option_items').fadeIn('fast');} else{jQuery('#multisite_option_items').fadeOut('fast');}" />
                <label for="gf_user_registration_multisite_create_site" class="checkbox-label"><?php _e("Create new site when a user registers.", "gravityformsuserregistration"); ?></label>
            </div> <!-- / send email? -->
    
            <div id="multisite_option_items" style="<?php echo ($multisite_options['create_site'] == 1) ? 'display:block;' : 'display:none;'; ?>">
    
                <div class="margin_vertical_10 <?php echo ($is_validation_error && empty($multisite_options['site_address']) ) ? 'user_registration_validation_error' : ''; ?>">
                    <label class="left_header" for="gf_user_registration_multisite_site_address"><?php _e("Site Address", "gravityformsuserregistration"); ?> <span class="description">(required)</span> <?php gform_tooltip("user_registration_multisite_site_address") ?></label>
                    <?php echo self::get_field_drop_down("gf_user_registration_multisite_site_address", $form_fields, $multisite_options['site_address'], "width-1 standard-meta"); ?>
                </div>
    
                <div class="margin_vertical_10 <?php echo ($is_validation_error && empty($multisite_options['site_title']) ) ? 'user_registration_validation_error' : ''; ?>">
                    <label class="left_header" for="gf_user_registration_multisite_site_title"><?php _e("Site Title", "gravityformsuserregistration"); ?>  <span class="description">(required)</span> <?php gform_tooltip("user_registration_multisite_site_title") ?></label>
                    <?php echo self::get_field_drop_down("gf_user_registration_multisite_site_title", $form_fields, $multisite_options['site_title'], "width-1 standard-meta"); ?>
                </div>
    
            </div>
    
        </div> <!-- / multisite options -->

    I'm guessing it would be "easiest" :S (and I use that term loosly) to add the Pro Site level trigger into to this function somewhere.

    Well thats where I'm upto, if anyone can confirm I'm on the right track and/or tell me what to do next that will be awesome :slight_smile:

    Thanks in advance
    D

  • dunskii

    Ok, well after much pondering of whether to go down the GF road I've decide I must.

    I'm pretty sure that my thinking on the above post is correct about where I'll be hooking the prosite functions with gravity forms.

    To simplify things a little I've decided to only offer 2 options to users for the time being. That is Free and Premium. Then add other pro levels later.

    So on the registration page I can offer users Free or Premium 30 Day Free Trial

    So my question now is, with the pro site free site option "Show Option On Signup" what function is that calling?

    So theres the same option as if wp-signup.php is used.

    I'm guessing its in the pro-sites.php file but with 3000+ lines of code to go through it'll probably take me awhile to find by my self.

    Cheers,
    D

  • dunskii

    Ok I think I've had a break though in my sleep deprived state.

    Me needs to give the gf hook gravityformsuserregistration ids and names
    For free trial
    id="psts_signed_up_yes" name="psts_signed_up" value="yes"
    For just a free site
    id="psts_signed_up_no" name="psts_signed_up" value="no"

    And call the signup_output function in there somewhere too :S so pro-sites knows what going on

    Till tomorrow
    D
    PS Just so you know I found it on line 1319 of pro-site.php

    function signup_output() {
    
    	  if ($this->get_setting('show_signup') && !isset($_GET[urlencode($this->get_setting('rebrand'))]) && !isset($_POST['psts_signed_up_override'])) {
    	  ?>
    	  <div class="register-section clear" id="supporter">
    			<label class="label"><?php echo $this->get_setting('rebrand'); ?></label>
    	    <?php echo $this->get_setting('signup_message'); ?>
    
    			<label class="checkbox" for="psts_signed_up_yes">
    				<input type="radio" id="psts_signed_up_yes" name="psts_signed_up" value="yes"<?php echo (!isset($_POST['psts_signed_up']) || $_POST['psts_signed_up']=='yes') ? ' checked="checked"' : ''; ?> />
    				<strong><?php _e( "I'm Interested", 'psts' ); ?></strong>
    			</label>
    			<label class="checkbox" for="psts_signed_up_no">
    				<input type="radio" id="psts_signed_up_no" name="psts_signed_up" value="no"<?php echo (isset($_POST['psts_signed_up']) && $_POST['psts_signed_up']=='no') ? ' checked="checked"' : ''; ?> />
    				<strong><?php _e( "Not Now", 'psts' ); ?></strong>
    			</label>
    		</div>
    
    	  <?php
    	  } else if (isset($_GET[urlencode($this->get_setting('rebrand'))]) || isset($_POST['psts_signed_up_override'])) {
    	    echo '<input type="hidden" name="psts_signed_up" value="yes" />';
    	    echo '<input type="hidden" name="psts_signed_up_override" value="1" />';
    	  }
    
    	}
  • dunskii

    I was given the following advice over on the gravity forms forums.

    I would add a dropdown with the levels you have (fill it manually or use a filter to fill the field). Then hook into the form submission and perform the extend function inside the function you attach to a submission hook.
    I guess I'd use the gform_pre_submission_filter, because that also gives you the option of adding info on the Pro Sites level into the notification.

    I haven't had a chance to look at this for a while but will hopefully have more time soon.

    D

  • russcannizzaro

    @dunskii I'm very interested in the approach you've taken here. Can you share what the user experience will be like?

    We're looking to do something similar with our site & were hoping the WPMUDEV would be able to give us the tools we need. The tools are there, but with major gaps (like this one).

    We don't have a large budget now, but would consider paying for your modifications if they met our needs.

    Please us know how your development goes here!

  • dunskii

    @russcannizzaro, i'm not sure which road I'm going to take once I figure out how to get it working but will either be a drop down, radio button or or a submit button that is used to select, the free or premium option. Once I've got that working then I'm going to try and add a third option to the sign up, eg platinum. But how Pro Sites handles the sign up process this maybe a little tricky.

    @russcannizzaro and @samheyer thanks for the motivation, though when I finally get it working I'll probably just add the solution here as my way of giving back to the community so to speak.

  • samheyer

    @dunskii - much appreciated! I've been playing around with the integration a bit today and think I have it working. I think my integration may be a bit easier as I'm just allowing for one paid level (no free level) and just created ONE order page with forced "hidden" product on it. Doing it this way, there's nothing for a user to select, they just fill out the order page with their info, the set price is at the bottom and it auto-creates everything after payment is confirmed.

    So far in test mode this has worked perfect for me. I have a few more tests to run, but will layout in more detail what I did if this works.

    Next challenge - integrating New Blog Template :slight_smile:

    Sam

  • dunskii

    @sam, I currently have registration working with gravity forms with a single subscription level and all works fine, as the user registration plugin took care of all the standard multisite entries.

    It's the adding/calling the prosite level/free functions that is the tricky bit. I was planning on adding the new blog template once I figure out adding the free option.

    Today I've been reading through userregistration.php to see how they integrate with other plugins like buddypress etc. I found this on line 2479

    public static function add_buddypress_hooks() {
    
            if(is_admin()){
    
                // buddypress admin hooks
                add_action("gform_user_registration_add_option_section", array("GFUser", "add_buddypress_options"), 10, 2);
                add_filter("gform_user_registration_save_config", array("GFUser", "save_buddypress_meta"));
    
            } else {
    
                // buddypress non-admin hooks
                add_action("gform_user_registered", array("GFUser", "prepare_buddypress_data"), 10, 3);
                add_action("gform_user_registered", array("GFUser", "bp_user_signup"));
    
            }
    
        }

    Hope that helps,
    D

  • dunskii

    Hi all,

    Ok I've come full circle and back to where I started.

    A few of questions/confirmations for the devs.

    $_POST['psts_signed_up'] is for if the form has the free trial option on the signup page

    $_POST['psts_signed_up_override'] is for if the link to the signup page like this: wp-signup.php?pro-site=1

    Between $sel_level psts_level and psts_levels which would be used to set the package level.

    And are the values of the package level the same as those displayed through out the ProSite options areas. E.g. 0 - Ads Removed (Upgraded), 1 - Premium, 2 - Platinum

    Cheers
    D

  • dunskii

    Appologies for the bumb, but this is where I keep all my notes, hopelfully it willl also help others.

    Docs for GF side

    http://www.gravityhelp.com/documentation/page/Gform_user_registration_add_option_group

    http://www.gravityhelp.com/documentation/page/Gform_user_registration_add_option_section

    http://www.gravityhelp.com/documentation/page/Gform_user_registration_save_config

    http://www.gravityhelp.com/documentation/page/Gform_user_registration_config_validation

    D

  • dunskii

    Ok, I've had a few people who are interested in what I'm trying to do here so I thought I'd give a basic run down of what I know.

    1. Pro sites and Gravity Forms (GF) user registration works together if you offer 1 or 2 levels with free trial option activated.

    2. If you want to have a pay wall before the user can access the dashboard you need to use the GF paypal addon and the pay to blog options selected. This will only work if you have 1 level, which renders pro sites semi useless

    3. With the latest GF upgrade they have made it simpler to create addons

    4. On the Pro site side
    $_POST['psts_signed_up'] is for if the form has the free trial option on the signup page

    $_POST['psts_signed_up_override'] is for if the link to the signup page like this: wp-signup.php?pro-site=1

    psts_levels_select would be used to set the package level. The variables to use are 0, 1, 2 etc, you can see these numbers on the pro sites settings page

    $psts->extend(...); arguments are for the payment access though I do wonder if using the paypal IPN would simplify this

    5. This is possible and just needs time

    6. Once I (or someone else) get these 2 awesome plugin working together I'll have a big smile on my face

    D

  • Terence

    I wish I were talented as a coder and able to help you at the programmatic level, but I know I am not ~ many failed attempts to prove it! I have to content myself with understanding marketing, SEO and assembling the development handiwork of others.

    As a result I have asked a brilliant young developer over at rocketgenius (Gravity Forms) if he would be willing {for a shilling} to get involved and create a Gravity Forms / Pro-Sites plugin or GF Addon, which would be a complete Pro-Sites registration/sales/configuration funnel ~ which, I imagine, could be sold to recoup the investment.

    I am willing to fund the development work myself, since its either that or give up on Pro-Sites altogether as it doesn't look like ~ despite all the promises over the years ~ that WPMUDEV is actually going to do something about it. Apparently development work ~ as opposed to bug fixes {if this isn't a bug, I don't know what is} ~ is focused on everything else, and from what I read, Pro-Sites {and therefore the needs of Pro-Sites users} comes way down their list.

    However, if anyone is interested in getting involved ~ to be able to contribute their talents to a joint effort, or simply to be sure your specific sign-up/configuration needs are covered ~ you can contact me here at QloudPress which is a brand new Pro-Sites website I am developing, so mind the wet paintwork... 8^)

    The stage I am at now is scoping out the 'needs document', so I can get a good fix on what is possible with GF, what is not, and has to be done by some other method. So if you have a specific need, please let me know via the the above contact form. I want to make sure the initial scope is as broad as possible, before narrowing in on what's do-able or what makes financial sense.

    Terence.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.