Support » Plugin: Subscribe To Comments Reloaded » Possible error in add_subscription() and an idea for improment in templates

  • Hello Camu and thank you (again) for this plugin.

    First, I think there’s a typo in the add_subscription() method, but fortunately, doesn’t lead to an error (line 601):

    public function add_subscription($_post_id = 0, $_email = '', $_status = 'Y'){
    	global $wpdb;
    	// Does the post exist?
    	$target_post = get_post($post_id);
    	if (($post_id > 0) && !is_object($target_post))

    In the variables declaration you use $_post_id, but later you use $post_id. I think it’s only a typo and $post_id should be $_post_id (and you use $_post_id later).

    I have a simple idea for a possible improvement in the templates use, and their customization.
    In the method subscribe_reloaded_manage(), add a new filter:

    $stcr_templates_folder = WP_PLUGIN_DIR.'/subscribe-to-comments-reloaded/templates/';
    $templates_folder = trailingslashit(apply_filters('stcr-templates-folder', $stcr_templates_folder));

    And later in the same method:

    // Subscribe without commenting
    if (!empty($action) && ($action == 's') && ($post_ID > 0)){
    	if ( file_exists($templates_folder.'subscribe.php') )
    		$include_post_content = include($templates_folder.'subscribe.php');
    		$include_post_content = include($stcr_templates_folder.'subscribe.php');

    This way we can copy/paste the templates in the current theme, modify them, and add the filter easily.

    Right now I extend the plugin class to use my own templates but it’s not the most efficient way, so I thought about this.

    Have a good day 🙂

Viewing 1 replies (of 1 total)
  • Oh, a bit more.

    In the same method subscribe_reloaded_manage(), right before the “return” at the end, add:

    if ( $manager_page_permalink = get_option('subscribe_reloaded_manager_page', '/comment-subscriptions') )
    	set_query_var('pagename', esc_attr(ltrim($manager_page_permalink, '/')));

    With this, we can create a file “page-whatever-my-manager-setting.php” in the current theme and use it. Alternatively you can set $posts[0][‘post_name’] to this value, the result is the same.

    Cheers 🙂

    Edit: this is far more convenient and less “ugly” than the “create a page and trash it” method I created before ^^

Viewing 1 replies (of 1 total)
  • The topic ‘Possible error in add_subscription() and an idea for improment in templates’ is closed to new replies.