Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

Add a template loader

Simple Membership Plugin › Forums › Simple Membership Plugin › Add a template loader

  • This topic has 4 replies, 3 voices, and was last updated 10 years, 8 months ago by mikolai.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • January 30, 2016 at 1:55 pm #5071
    mikolai
    Participant

    Hi,

    I would like to modify the template parts named ‘login.php’, ‘loggedin.php’ etc. and place these modified files in a subfolder of my theme (so that they actually remain when upgrading to a new version of SWPM). The Plugin should then check if a template with the required name exists within a certain folder (e.g. ‘simple-membership-plugin) and if yes, should load this instead of the standard template located in the plugin folder. Basically, it would be like for example ‘bbpress’ does it and a real improvement of your plugin!

    My suggestion would be a function similar to this:

    function load_template( $name ) {
    	$files = array(
    		get_stylesheet_directory() . '/simple-membership/'.$name, //First check inside child theme
    		get_template_directory() . '/simple-membership/'.$name,   //then inside theme folder
    		SIMPLE_WP_MEMBERSHIP_PATH . 'views/'.$name                //otherwise load standard template
    	);
    	foreach ($files as $file) {
    		if ( file_exists( $file ) ) {
    			include ( $file );
    			break;
    		}
    	}
    }

    Inside class.simple-wp-membership.php, you should then change every include('{template}.php') to load_template('{template}.php'). Didn’t test it, but I think it should work 🙂

    Would be great if you could add this feature to the plugin!

    Regards,
    Mikolai

    January 30, 2016 at 9:30 pm #5073
    mbrsolution
    Moderator

    Hi Mikilai, thank you for your code and suggestion. The plugin developers will further test your code and report back.

    Kind regards

    February 2, 2016 at 12:07 pm #5109
    admin
    Keymaster

    This is a good idea. We would like to add something similar to this in the plugin.

    February 26, 2016 at 1:15 pm #5496
    admin
    Keymaster

    This functionality has been added to the plugin.

    https://simple-membership-plugin.com/customizing-the-look-of-the-membership-login-widget/

    March 2, 2016 at 6:52 pm #5599
    mikolai
    Participant

    Hi,

    thank you so much for the implementation, your support is really great!

    I’ve checked the new version out and it works perfectly for login and forgot-password, but it’s not working for the register form. Indead, I searched a bit in the code and I saw it being loaded inside class.swpm-front-registration.php in line 62. It would be great if you could extend the functionality to this class too!

    Regards,
    mikolai

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy