WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Yet Another Related Posts Plugin] Bug in YARP 2.1.2 (14 posts)

  1. algous
    Member
    Posted 5 years ago #

    Latest version of YARPP 2.1.2 works incorrectly on blogs with non ascii characters (foe ex. russian utf-8). Related posts are added to the rss feed only if a post contains english words.

    You should make some changes in 'yarpp_extract_keywords' function located in 'keywords.php' source file .

    Old code:

    if (function_exists('mb_split'))
    		$wordlist = mb_split('\s*[^\w]+\s*', strtolower($source));
    	else
    		$wordlist = split('\s*[^\w]+\s*', strtolower($source));

    New code:

    if (function_exists('mb_split'))
    	{
    		mb_regex_encoding(get_option('blog_charset'));
    		$wordlist = mb_split('\s*\W+\s*', strtolower($source));
    	}
    	else
    		$wordlist = split('\s*\W+\s*', strtolower($source));
  2. algous
    Member
    Posted 5 years ago #

    Also you should replace first 'strtolower' to 'mb_strtolower':

    if (function_exists('mb_split'))
    {
    	mb_regex_encoding(get_option('blog_charset'));
    	$wordlist = mb_split('\s*\W+\s*', mb_strtolower($source));
    }
    else
    	$wordlist = split('\s*\W+\s*', strtolower($source));
  3. @algous - thank you for the report and correction! Does the new code fix your feed?

    I've updated the development version with this patch and hope to release this version in the next day or so --I just want to get confirmation on whether this is also the solution to this issue.

    Thank you!
    mitcho

  4. algous
    Member
    Posted 5 years ago #

    > Does the new code fix your feed?
    Yes.

  5. Thanks @algous. I've released 2.1.3.

  6. adijaffe
    Member
    Posted 5 years ago #

    I've downloaded 2.1.3 and now get no related posts shown... Regardless of the threshold.

  7. @adijaffe - was it working for you before with 2.1? Do you have many non-ASCII (non-Latin) characters in your blog entries? Are they not displaying on the blog only or also in the feeds?

    Thanks--

  8. adijaffe
    Member
    Posted 5 years ago #

    It was working for me perfectly before 2.1.2, after that, I started having problems; I'm using almost only ASCII chars except for media, but all tags and categories are ASCII

  9. @adijaffe - are you getting the "No related posts" text? Or are you just not getting any output at all?

  10. adijaffe
    Member
    Posted 5 years ago #

    i'm getting the "No related posts" message

  11. Can you give me a URL where I can see this? Also, please temporarily disable any caching plugin you have.

    I will access the page with ?yarpp_debug=1 at the end of the URL to enable "YARPP debug mode." This will print the MySQL code in an html comment. I would like to check whether it is constructing a valid query or not.

    Thanks!`

  12. adijaffe
    Member
    Posted 5 years ago #

    the address is http://www.allaboutaddiction.com

    I'll turn the plugin back on for 5 hours (it's currently 7:30am pacific time in the US). I've switched to the standard related posts plugin, but I'll go back to yours for the check.

    adi

  13. Perhaps I missed the window, but I wasn't able to use YARPP debug mode and access your site. Do you want to check the SQL query yourself?

  14. @adijaffe - I believe I've resolved a class of issues where no results were being returned (seen here). Please try this development version which has the fix.

Topic Closed

This topic has been closed to new replies.

About this Topic