Support » Plugin: Frontend Reset Password » Template Files In Child Theme Not Found

  • Resolved _p_

    (@_p_)


    Hi

    I’m using the plugin with a Child-Theme and want to override the Template-Files. So I copied the plugin-folder “templates” to the Child-Theme and renamed it to “somfrp-templates”. But this is not working!

    The Plugin does not load the template files in the Child-Theme cause it is only looking for files in the (Main-Theme).

    You can fix this easily by chaning one line in one file.
    “includes/somfrp-functions.php”
    Line 560
    Search:
    $theme_path = get_template_directory();
    Replace:
    $theme_path = get_stylesheet_directory();

    Please fix this in the next release!

    Thanks and bye – Peter

    • This topic was modified 4 months, 4 weeks ago by _p_.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi

    You can place this in your child theme functions. I also had the same problem. See https://wordpress.org/support/topic/great-plugin-shame-form-templates-cant-be-overridden-in-theme/

    // filter frontend password reset template for child-theme
    function filter_somfrp_get_templates($templates) {
    	if (get_template_directory() === get_stylesheet_directory()) {
    		// parent theme;
    		$theme_path = get_template_directory();
    	} else { 
    		//child theme; 
    		$theme_path = get_stylesheet_directory();
    	}
    	$templates = array(
    		'lost-form' => array(
    			'path' => SOMFRP_PATH . 'templates/lost_password_form.php',
    			'custom_path' => $theme_path . '/somfrp-templates/lost_password_form.php'
    			),
    		'reset-form' => array(
    			'path' => SOMFRP_PATH . 'templates/lost_password_reset_form.php',
    			'custom_path' => $theme_path . '/somfrp-templates/lost_password_reset_form.php'
    			),
    		'form-complete' => array(
    			'path' => SOMFRP_PATH . 'templates/lost_password_reset_complete.php',
    			'custom_path' => $theme_path . '/somfrp-templates/lost_password_reset_complete.php'
    			)
    	);
    	return $templates;
    }
    add_filter( 'somfrp_get_templates', 'filter_somfrp_get_templates', 10, 1 );

    I think the dev was gonna add this in but seems to have been missed. Maybe @rwebster85 could update on next release?

    Hope this helps.

    Plugin Author Richard Webster

    (@rwebster85)

    It will be in the next release very soon. The latest update was a priority security fix that needed to be sorted 🙂

    Nice one @rwebster85. Would be a good addition 😉

    Plugin Author Richard Webster

    (@rwebster85)

    Version 1.1.91 now includes this 🙂

    @rwebster85 Many thanks for adding that in. Works like a charm 🙂

    Plugin Author Richard Webster

    (@rwebster85)

    Great stuff 🙂 if you haven’t already I’d appreciate it if you could leave a quick review.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.