How can I create new sites using Blog Templates combined with Gravity Forms' User Registration

Hi!

I used the New Blog Templates plugin to use a default Template for every new site:
http://sitegeregeldconversie.sitegeregeld.nl/

It works like a charm :slight_smile:.

Now I want my new users to sign up using a gravity form:
http://sitegeregeld.nl/site-maken/

After filling in the form, my new site is created, but without the Template.

How can I solve this? I can imagine that the solution is a simple hook/filter-thing!

Hope you can help us out :slight_smile:.

Love from Amsterdam,

Sebastiaan van der Lans

  • Vladislav

    Hello,

    If one template suits your needs, you may want to try setting up a default template. However, if this is not good enough for your scenario, you may want to hook up to "blog_templates-blog_template" and select your template based on some other custom condition. The processing function can receive up to 4 parameters - currently active template, blog ID, user ID, and a blogtemplates class instance (in that order).

  • vanons

    Hi Brian and Vladislav,

    Thanks for your respond.
    One default template is good enough (that's how I have configured the plugin already).

    The thing is: if I create new blogs with my gravity form, a new site will be created, but without the default Template.

    Question is: how can I ensure that the new site template will be used when my visitors create a new site w/ the Gravity Form?

    Hope you guys can help us out :slight_smile:

    S.

  • vanons

    Hi B / V,

    I found some more topics about this 'issue', and took some time to puzzle.

    Not my most beautiful solution ever, but I found a workaround!!

    I think I found a solution!

    Gravity Forms:
    _ Add a hidden field called "blog_template", with value 0

    In the file "blog_templates.php" (I'm very sorry for plugin-hacking!!), in the construct I added two lines:

    // Signup: WordPress
    add_action('signup_blogform', array($this, 'registration_template_selection'));
    add_filter('add_signup_meta', array($this, 'registration_template_selection_add_meta'));
    // Signup: BuddyPress
    add_action('bp_after_blog_details_fields', array($this, 'registration_template_selection'));
    add_filter('bp_signup_usermeta', array($this, 'registration_template_selection_add_meta'));
    // Signup: Gravity Forms
    add_filter('gform_user_registration_add_option_section', array($this, 'registration_template_selection_add_meta'));

    Probably it will help you or someone else too :slight_smile:

    Yay!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.