News:

Welcome to the Unofficial Help Forum



Author Topic: SMF Likes Plus  (Read 277543 times)

Offline frostybore

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: SMF Likes Plus
« Reply #45 on: April 10, 2013, 07:06:17 PM »
Sometimes a Like isn't shown correctly, causing an eval error to show up.

e.g.

Sometimes it will show

[LIKE IMG] (no name displayed), User 1, User 2 Likes this

or

[LIKE IMG] (no name displayed) and User 1 Likes this

Whereas it should say

[LIKE IMG] User 1, User 2, User 3 Likes this

Is there a particular reason for this? It's not causing any issues performance wise, but it causes a ton of errors to appear in the log if it happens on an active thread. The issue seems to be that it tries to count the array, but since there's no "0" it can't start there?

Code: [Select]
8: Undefined index: 0

File: /var/www/vhosts/WEBSITE/httpdocs/forum/Themes/default/Display.template.php (main sub template - eval?)
Line: 657

Code: [Select]
// First, names
$names = array();
foreach ($context['post_likes'][$message['id']] as $liker)
{
$names[] = '<a href="' . $scripturl . '?action=profile;u=' . $liker . '">' . $user_profile[$liker]['real_name'] . '</a>';
if (count($names) >= 5)
break;
}

tl;dr - sometimes names don't show up as a Like, and it causes errors in the log


edit:

A look in my database shows that these broken likes have a member_id of 0 -- clearly that's incorrect. Why does it show up 0?

I've fixed the issue by changing this value to a correct one.
« Last Edit: April 10, 2013, 07:31:15 PM by frostybore »

Offline Illori

  • Administrator
  • *
  • Posts: 337
    • View Profile
Re: SMF Likes Plus
« Reply #46 on: April 11, 2013, 05:43:28 AM »
under server settings in admin disable evaluation of templates and post the actual error message without eval in it.

Offline frostybore

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: SMF Likes Plus
« Reply #47 on: April 11, 2013, 10:03:38 AM »
Ok, next time it happens I'll post it here. I cleaned my log after I manually solved the issue so I don't have it available.

Offline Illori

  • Administrator
  • *
  • Posts: 337
    • View Profile
Re: SMF Likes Plus
« Reply #48 on: April 11, 2013, 10:27:37 AM »
also for some reason have you somehow given guests the ability to like posts [should not be able to do this by default]?

Offline frostybore

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: SMF Likes Plus
« Reply #49 on: April 11, 2013, 06:30:48 PM »
I thought that too, but no it does not show up as a guest.

Offline Illori

  • Administrator
  • *
  • Posts: 337
    • View Profile
Re: SMF Likes Plus
« Reply #50 on: April 12, 2013, 05:44:16 AM »
it would not show up as a guest as the name, check your permissions to see if guest some how got the permission to like posts.

also do you know if the user may have deleted their account by chance?

Offline frostybore

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: SMF Likes Plus
« Reply #51 on: April 12, 2013, 01:42:42 PM »
I'm checking under "Permissions" for Guest but I do not even see the option to enable/disable liking posts, whereas it shows up for Regular Members (under "Moderate the Board"). Am I looking in the right spot?

I don't believe any members have been deleted, either (deleting accounts is only an admin priviledge).

Offline Illori

  • Administrator
  • *
  • Posts: 337
    • View Profile
Re: SMF Likes Plus
« Reply #52 on: April 12, 2013, 02:29:50 PM »
ok that is all good. then it sounds like what happened should not be able to happen.

Offline frostybore

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: SMF Likes Plus
« Reply #53 on: April 15, 2013, 04:34:19 PM »
It happened again, this is what it says in error log:

Code: [Select]

8: Undefined index: 0

File: /var/www/vhosts/WEBSITE/httpdocs/forum/Themes/default/Display.template.php
 Line: 657


Which is the same code as the one posted earlier. I think it has to do with when the Like is posted - maybe some sort of timeout occurs and it can't capture the member ID, defaulting to the 0 hard-coded instead?

Here's a photo of what it looks like


Offline Illori

  • Administrator
  • *
  • Posts: 337
    • View Profile
Re: SMF Likes Plus
« Reply #54 on: April 16, 2013, 05:42:12 AM »
since you have modified your display.template.php for the area to show this mod that may be related can you attach your display.template.php to your next post?

Offline frostybore

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: SMF Likes Plus
« Reply #55 on: April 16, 2013, 07:18:03 AM »
Ok, attached

Offline Illori

  • Administrator
  • *
  • Posts: 337
    • View Profile
Re: SMF Likes Plus
« Reply #56 on: April 17, 2013, 05:49:22 AM »
do you know which user on your forum is triggering this to happen? since no one else is reporting this issue i think it is an issue with your forum only.

Offline frostybore

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: SMF Likes Plus
« Reply #57 on: April 17, 2013, 02:03:46 PM »
I have no idea how to pinpoint if a specific person is doing it. Can I just change the "default" that the post does to my own user ID, so if it does error, it just puts in my ID as a default and everyone is none the wiser?

Offline Illori

  • Administrator
  • *
  • Posts: 337
    • View Profile
Re: SMF Likes Plus
« Reply #58 on: April 17, 2013, 05:31:30 PM »
i dont think that would be smart and i think over time people may pick up on it.

why not ask your users if they notice the issue after they have liked a post?

Offline Illori

  • Administrator
  • *
  • Posts: 337
    • View Profile
Re: SMF Likes Plus
« Reply #59 on: April 18, 2013, 09:26:01 AM »
problem fixed in new package in first post. only real change is in the likes.php file so you can just extract that file and override the existing file.

there is a query if you install the whole package to remove the 0 user id likes.

 

anything