Forums

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

  1. algous
    Member
    Posted 7 months 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 7 months 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. mitchoyoshitaka
    Member
    Posted 7 months ago #

    @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 7 months ago #

    > Does the new code fix your feed?
    Yes.

  5. mitchoyoshitaka
    Member
    Posted 7 months ago #

    Thanks @algous. I've released 2.1.3.

  6. adijaffe
    Member
    Posted 7 months ago #

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

  7. mitchoyoshitaka
    Member
    Posted 7 months ago #

    @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 7 months 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. mitchoyoshitaka
    Member
    Posted 7 months ago #

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

  10. adijaffe
    Member
    Posted 7 months ago #

    i'm getting the "No related posts" message

  11. mitchoyoshitaka
    Member
    Posted 7 months ago #

    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 7 months ago #

    the address is 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. mitchoyoshitaka
    Member
    Posted 7 months ago #

    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. mitchoyoshitaka
    Member
    Posted 7 months ago #

    @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.

Reply

You must log in to post.

About this Topic