New Blog Templates

Hello All,
I have been using the New Blog Template plugin and I want to know if it is possible to allow users to pick from a selection of templates instead of only getting the default?

If it is not currently possible may this post serve as a suggestion for future improvements.

Thanks for your time in replying,
Chris

  • DavidM
    • DEV MAN’s Mascot

    Hi Chris,

    There's not a way to achieve that built into the plugin, but I'm really glad you asked as I'd been meaning to get around to trying the snippet provided by asimetrick in the following thread:
    https://premium.wpmudev.org/forums/topic/template-choice-at-registration

    So basically, that snippet does provide the option when using BuddyPress. However, as noted in that same post, the blog field isn't hidden, but displayed by default, regardless of whether the blog creationg option is ticked or not.

    But it does work, with BuddyPress that is. Perhaps that'll work for you until a permanent solution is included in the plugin?

    Cheers,
    David

  • DavidM
    • DEV MAN’s Mascot

    Hmm, one other thing you might want to check Chris. When I initially installed this, as a plugin as well, I had the <?php ?> tags wrapping both the initial plugin comments as well as the rest of the code, with a line break between the two. It yielded an error message at the top of the admin but still remained activated. If that's how you've got it setup, simply removing the middle ?> <?php tags should sort it.

    Other than that, as asimetrick's alluded, perhaps there's a theme conflict? Perhaps there's also another plugin conflicting as well?

    Cheers,
    David

  • kennibc
    • The Crimson Coder

    Asimetrick,
    I am using the EduClean theme from WPMUDev. The dropdown is not displayed.

    David,
    I will look into how the PHP tags are placed but I didn't get any error messages.

    Thanks. I will try to get this hack working.

    Hopefully someone will add this feature to the original plugin. In my situation this could be very useful because I have teachers who could benefit from a more basic template and those who would benefit from a more advanced template with more interactive WP plugins activated and configured.

    -Chris

  • kennibc
    • The Crimson Coder

    I tried this plugin, but when it creates a new blog it doesn't necessarily add any additional database fields used/created by plugins: http://buddypress.org/community/groups/site-creation-wizard/

    If the New Site Template plugin could incorporate the front end useability of the Site Creation Wizard plugin it would be ideal.

    So that's my feature improvement suggestion for this plugin.

    I am still tinkering with the plugin code but no luck so far.

  • asimetrick
    • Site Builder, Child of Zeus

    I don't know the EduClean theme and I can't test it right now so I can't tell. I just checked the 'bp_after_blog_details_fields' action in the registration page and everything looks all right in the code, exactly the same as the default BuddyPress theme.

    So I must let David take this one, sorry.

  • asimetrick
    • Site Builder, Child of Zeus

    Yes, I downloaded it and took a look at the registration page. That's where I saw everything looked good in the code with the 'bp_after_blog_details_fields' action. I really don't know why it doesn't work. If I had more time, I could troubleshoot it, but the installation process of the theme package looks very heavy for something I'll never use for myself and I'll have to crash or revert just afterwards. That's why I let David help you from this point.

  • kennibc
    • The Crimson Coder

    Ohhh..... on the registration page!

    Is there anyway it can be hooked into the "Create a blog" page where they register the name and site name of a new blog?

    My users register via LDAP and they are not forced to register a blog. They simply login and then proceed to the Create a Blog page where they can create a new blog site.

  • kennibc
    • The Crimson Coder

    In the future for noobs like me here is step by step what you will want to do.

    Open notepad and copy/paste this code into the blank document:

    <?php
      /*
    Plugin Name: Pick a Theme Frontend
    Plugin URI: https://premium.wpmudev.org/project/new-blog-template
    Description: Allows users to select blog templates from the frontend while creating a blog.  This is a hack and requires the New blog Template plugin from WPMUDEV.
    Author: asimetrick
    Author URI: https://premium.wpmudev.org/
    Version: 1
    Network: true
    */
    
    function blog_template_for_bp() {
    	global $blog_templates;
    	if ( is_a( $blog_templates, 'blog_templates' ) ) {
    		$tag_name = 'blog_template';
    		$tag_label = __( 'Template', $blog_templates->localization_domain );
    		echo "<label for=\"$tag_name\">$tag_label</label>";
    		$blog_templates->get_template_dropdown( $tag_name, true );
    	}
    }
    add_action( 'bp_after_blog_details_fields', 'blog_template_for_bp' );
    add_action( 'signup_blogform', 'blog_template_for_bp' );
    ?>

    Save the file as pickatheme.php inside a folder named pickatheme.

    Upload the folder into your plugins directory and activate it network wide.

  • kennibc
    • The Crimson Coder

    Just wondering... How would I add the following code so that it appeared above the Template dropdown menu via the plugin listed in the above post:

    <p><strong>Pick a Template:</strong> <br /> Pick a template to add extra functionality and features to your classroom website.<br /><br /></p>
    <ul>
    <li><strong>Easy Teacher Website</strong> - <a href="http://blog.dearbornschools.org/tmpeasy/" title="Easy Teacher Website" target="_new">Preview</a> - This template is designed for easy editing and a basic website designed using pages.  All editing of the website can be done by simply clicking where you want to make changes and typing your new text.  Basic pages include: Teacher Bio, Class Info, Classroom Links, Class News, and Welcome.  This template also includes an eNewsletter.<br /><br /></li>
    <li><strong>Basic Teacher Website</strong> - <a href="http://blog.dearbornschools.org/default1/" title="Basic Teacher Website" target="_blank">Preview</a> -  Most teachers will want to use this template.  This template features include Polls, Voting, eNewsletters, Translation, custom header images, and much more.</li>
    </ul>

    This adds directions and links to the templates being used so users can better determine what template to choose.

  • asimetrick
    • Site Builder, Child of Zeus

    Hi Chris.

    The recipe is exactly the same:

    function custom_blog_template_help() {
    ?>
    <p>
    	<strong>Pick a Template:</strong><br />
        Pick a template to add extra functionality and features to your classroom website.<br /><br />
    </p>
    <ul>
    	<li><strong>Easy Teacher Website</strong> - <a href="<?php get_blogaddress_by_name( 'tmpeasy' ); ?>" title="Easy Teacher Website" target="_new">Preview</a> - This template is designed for easy editing and a basic website designed using pages.  All editing of the website can be done by simply clicking where you want to make changes and typing your new text.  Basic pages include: Teacher Bio, Class Info, Classroom Links, Class News, and Welcome.  This template also includes an eNewsletter.<br /><br /></li>
    	<li><strong>Basic Teacher Website</strong> - <a href="<?php get_blogaddress_by_name( 'default1' ); ?>" title="Basic Teacher Website" target="_blank">Preview</a> -  Most teachers will want to use this template.  This template features include Polls, Voting, eNewsletters, Translation, custom header images, and much more.</li>
    </ul>
    <?php
    }
    add_action( 'bp_after_blog_details_fields', 'custom_blog_template_help' );
    add_action( 'signup_blogform', 'custom_blog_template_help' );

    If the explanation is displayed below the dropdown, change the last 2 lines by:

    add_action( 'bp_after_blog_details_fields', 'custom_blog_template_help', 9 );
    add_action( 'signup_blogform', 'custom_blog_template_help', 9 );

    You also could use the same function as above to include this additional custom code, but as you requested, that function might be soon integrated in the plugin itself so you can't customize it anymore.

    On the contrary, this solution doesn't prevent your form to be additionally customized by any other plugin you use so "something" might be injected between your explanation and your dropdown. If you don't have such plugins, then everything should be alright.

  • magakrav
    • Design Lord, Child of Thor

    Awesome hack! exactly what I was looking for.

    Initial results on a MultiDB 256 config - I am able to create a template site upon signup which copies ALL content - problem is the test user that created the new site is not the site admin of the new site. The site admin of the new site is the network admin upon checking the back end.

    Will test this on another server with a fresh install of 4096 MultiDB and no other plugins.

  • magakrav
    • Design Lord, Child of Thor

    Update.

    My mistake on the previous post- all I had to do was uncheck the "users" setting on the blog template and it was good to go.

    New problems though. When I create a site, no matter what template I use, it always creates the default template, and when I remove the default template option, it creates the default wordpress twentyeleven template.

    Any ideas on why I am getting this behavior on both the 256 and the 4096 MultiDB setups?

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.