Support » Plugin: Local Like And Share » ‘Most Liked’ appears to be stuck

  • Resolved tonycutty

    (@tonycutty)


    Hi Devon

    Loving this plugin. Just one problem: I posted a tribute to my dear late wife and, touchingly, many people (18 at last count!) have ‘liked’ it using your plugin. But in my Widgets area to the right of the main text of the blog post, the ‘Most Liked’ still indicates a ‘lesser’ article with only four ‘likes’.

    The page is here: http://www.flyinginthespirit.cuttys.net/2016/11/01/fiona/

    …and the ‘Most Liked’ is still indicated as ‘Return to Simplicity’ with 4 likes.

    Just wondering if you might know what I can do with this? It’s not a major pain, but I’m afraid I am a bit of a perfectionist….

    Thanks Devon
    Tony

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Devon Ostendorf

    (@devonostendorf)

    Hi Tony,

    First of all, my deepest condolences for your loss; I am terribly sorry to hear of your wife’s passing.

    As for your Most Liked post being stuck, that is definitely annoying (and, especially considering the situation, I feel even worse that the plugin is not working for you as it should be). Is it safe to assume you have the latest version (1.0.5) installed?

    If so, I’d suggest going into Appearance >> Widgets >> Local Like And Share, changing the Time Period to something other than what you have it set to currently, and hitting the Save button. Then change it back to the Time Period you actually want displayed, and hit Save again. Then revisit your site and see if things look better. I won’t bore you with the inner workings of how the counts are calculated as of version 1.0.5, but it is possible that when you updated to 1.0.5 the appropriate population of post meta data did not occur and this changing of time periods will give it a nudge.

    Please let me know if this changes what you see in the widget.

    And, most importantly, hang in there!

    Thanks,
    Devon

    Thread Starter tonycutty

    (@tonycutty)

    Hi Devon

    Thank you for the condolences – that’s much appreciated! 🙂

    I tried what you suggested and that didn’t help; however, I also tried changing some other settings and seeing what happened. It must be difficult for you do diagnose at a distance without access to the controls, so I thought I would gather as much data as possible.

    I’ve left the setup as it is so you can see it. What I’ve done is to change ‘Number of Posts to Show’ to (arbitrarily) 18. Interestingly, Fiona’s page shows up at number 15 with its 18 likes! Whereas my former ‘top likes’ page is still at number 1 with its 5 likes.

    For a genius like you, I have no doubt that this will provide a valuable clue. And hopefully help to refinne the plugin slightly; maybe this is a ‘bug’ nobody had noticed before.

    Oh and yes, I am running v1.0.5. And please don’t feel bad about the plugin misbehaving given the situation. It’s given me something to take my mind off the pain, even if for a little while! 🙂

    Thanks again my friend

    Tony

    • This reply was modified 4 years, 3 months ago by tonycutty.
    Plugin Author Devon Ostendorf

    (@devonostendorf)

    Hi Tony,

    Your change to display up to 18 of the “Most Liked” posts gave me an idea of what the problem was. And then my own liking of Fiona’s page convinced me. I was like #20, which, if you look at your site now, bumped her page up to above all the posts with 2 likes and just below all of those with 3 likes. The problem is that, as of Local Like And Share v1.0.5, when I moved the summarization of the like and share counts to the WordPress postmeta table, to improve database performance, the counts are now stored in a longtext column in that table (not as integer values returned from a SQL COUNT function call, as was the case prior, when they were being selected from the LLAS custom tables for display in the widget). When the widget is rendered, the results selected from the postmeta table are ordered by this longtext column, descending (greatest value to least), BUT the sort performed is a TEXT sort, due to the column type (postmeta is designed to be versatile and store all manners of data), not a numeric sort. SO, as is, like counts are being sorted in the following order:

    5
    3
    20
    2
    19
    1

    I will be releasing Local Like And Share v1.0.6 this evening, containing a single code change, to force a numeric sort such that the sequence, from the example above, will end up as we’d expect it to be:

    20
    19
    5
    3
    2
    1

    In the meantime, if you see this note prior to me getting the new version out, and if you have access to your file server and feel comfortable modifying PHP code, you can open ../plugins/local-like-and-share/includes/class-local-like-and-share-misc.php, go down to line #290, and replace this:

    ORDER BY $count_column DESC

    with this:

    ORDER BY CAST($count_column AS UNSIGNED) DESC

    I appreciate the “genius” comment, though I’m hoping you were being sarcastic :), since this situation was entirely a case of my testing with a dataset insufficient to reveal that this bug was lurking in the code. Thank you so much for bringing attention to it as, indeed, this will make the plugin work better (as in, “correctly!”) for everyone else who uses it!

    Thanks,
    Devon

    Thread Starter tonycutty

    (@tonycutty)

    No, the ‘genius’ comment stands, I’m afraid 😉 I don’t really do sarcasm 😀

    The thing is, I know how to code HTML and to me, that’s comple enough. I have poked my toes into CSS (and even, at one time in the distant past, BASIC) but never SQL. For a person’s mind to wrap itself around these concepts takes a high IQ, I feel, therefore ‘Genius’.

    Sorry, but I like to encourage people!

    And as you may already know, the code now works with the new update. I got to my laptop this mornng with the update notification already there, updated, and it’s working fine now.

    I am absolutely convinced that the more data we can give a programmer, the better his.her chances of finding a fix. What’s happened here is a classic example of cooperation between user and programmer; I wish more of the major software companies did this sort of thing….

    Thanks again for fixing this for me. Fiona’s page is now at the top 🙂

    Cheers bud

    Tony

    Plugin Author Devon Ostendorf

    (@devonostendorf)

    Hi Tony,

    I am delighted to read (and “see”, as I did revisit your blog) that the fix worked for you and that Fiona’s page is finally up at the top, where it belongs!

    You are too kind but I DO sincerely appreciate the encouragement and I applaud your attitude. 🙂 You are 100% correct that users and developers working together cooperatively make software better for everyone. That is why I am such a big fan of open source, in general, and the WordPress community, in particular. The plugins I write are my small attempt at giving back to a world that has provided me with a lot of great stuff over the years.

    Thanks for your continued support and please do let me know if you run into any other situation where the plugin is behaving strangely.

    Take care,
    Devon

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘‘Most Liked’ appears to be stuck’ is closed to new replies.