Forums

[resolved] Subscribe to Comments Reloaded: Problem in subscriptions page (11 posts)

  1. blogjunkie
    Member
    Posted 1 year ago #

    When I try to subscribe to a comment without commenting, the Manage subscriptions page has got a problem - Javascript source is showing. Screenshot:

    https://skitch.com/blogjunkie/rjxmq/manage-subscriptions-adventures-of-a-blogjunkie

    Here's the source code: http://pastebin.com/EScFWt1F

    I'm hoping the plugin author sees this and fixes the problem :)

  2. camu
    Member
    Posted 1 year ago #

    Hi there,

    unfortunately it's not a problem with my plugin. You have some other plugin that is reactivating 'wpautop', a WordPress function that causes that behavior. If you check the source code, my plugin disables it properly, but of course cannot prevent other plugins from re-enabling it. What other plugins are you using?

    Camu

  3. blogjunkie
    Member
    Posted 1 year ago #

    Hi camu, thanks for your response. You were right about something else reactivating wpautop. This bit of code in my functions.php file was the culprit:

    function my_formatter($content) {
    	$new_content = '';
    	$pattern_full = '{(\[raw\].*?\[/raw\])}is';
    	$pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
    	$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
    
    	foreach ($pieces as $piece) {
    		if (preg_match($pattern_contents, $piece, $matches)) {
    			$new_content .= $matches[1];
    		} else {
    			$new_content .= wptexturize(wpautop($piece));
    		}
    	}
    	return $new_content;
    }
    remove_filter('the_content', 'wpautop');
    remove_filter('the_content', 'wptexturize');
    
    add_filter('the_content', 'my_formatter', 99);

    Source: http://www.wprecipes.com/disable-wordpress-automatic-formatting-on-posts-using-a-shortcode

    Now that you pointed that out, I realized that it's been messing up some other plugins too. Would you know how to modify this so that it works with your plugin? Appreciate your help.

  4. blogjunkie
    Member
    Posted 1 year ago #

    I tried re-writing the code above with the shortcode API, but it doesn't work. Here's what I got so far:

    function raw_html($atts, $content = null) {
    	remove_filter('the_content', 'wpautop');
    	remove_filter('the_content', 'wptexturize');
    	return $content;
    }
    add_shortcode('raw', 'raw_html');

    Any ideas?

  5. camu
    Member
    Posted 1 year ago #

    If I understand what you're trying to do, you want to use a shortcode called [raw] that shouldn't be parsed by wpautop, right? Not sure add_shortcode works that way. You may want to ask on the official mailing lists to the core developers for some specific help.

    In the meanwhile, I'd like to ask you to mark this request as resolved and to vote for my plugin :)

    Thanks,
    Camu

  6. blogjunkie
    Member
    Posted 1 year ago #

    Voted!

  7. camu
    Member
    Posted 1 year ago #

    Thank you, I appreciate it :)

  8. webnik
    Member
    Posted 1 year ago #

    Thanks for that Sherlock Holmes work blogjunkie. Had same issue and only spend 2 hours on it thanks to you :)

    I was under the impression that shortcodes only kicked in when activated. Apparently not so with this RAW one.

  9. camu
    Member
    Posted 1 year ago #

    So, what was your problem?

  10. webnik
    Member
    Posted 1 year ago #

    Same as blogjunkies, javascript showing up at managing page. Nothing at comment area it self. Removing that RAW shortcode snippet he link to fixes problem. Which is a bit weird since shortcode is not activated. When clicking "You can manage the subscriptions of this entry." I saw

    onsubmit=”return confirm(‘Please remember: this operation cannot be undone. Are you sure you want to proceed?’)”>

    not in source but in my face, on the page.

    Comment out RAW shortcode in functions.php and it is gone. I guess shortcode must be broken.

    You should be able to reproduce error though I would consider it fixed unless there is more ;)

  11. camu
    Member
    Posted 1 year ago #

    Interesting. Thank you for elaborating on the issue! Hopefully other users will find it useful!

    Camu

Topic Closed

This topic has been closed to new replies.

About this Topic