HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.

MarkAllRead

This discussion is related to the MarkAllRead addon.
edited May 2007 in Vanilla 1.0 Help
MarkAllRead
«1

Comments

  • I found an error in the extension. After line 47, the following needs to be added:$sql->AddWhere('c', 'Deleted', '',0, '='); because otherwise you will get CheckRead() returning 0 for discussions where the lum_userdiscussionwatch number is higher than the number of undeleted comments, which leads to the extensions trying to insert a record where one already exists (which of course leads to a fatal error).

    Perhaps also replace the last line of CheckRead() with if ($rows == $rows2['CountComments'] || $rows2['CountComments'] > $rows) return 2; to catch those discussions which already have a too high number.

    And finally, the error it gave when trying to insert the duplicate records was "An error occurred while logging your IP address.", perhaps that could be changed to "An error occurred while trying to insert data." or something along those lines, because it doesn't really log any IP addresses.
  • bump
  • Can these changes be migrated into the extension? I'm migrating a forum from phpbb and my users would really appreciate this extension.
  • lechlech Chicagoland
    I haven't seen hutstein on here in a while. Maybe its time someone takes over this extension for him if it requires a needed update.
  • All that needs to be done is really adding $sql->AddWhere('c', 'Deleted', '',0, '='); after line 47, that's it. That and a slightly incresed version number for update checks of course.
  • Uploaded version 1.0.1 of MarkAllRead.
  • Thank you, Lussumo Bot, you're the best!
  • This plug-in isn't accurately marking all read. It marks all the threads on the current page read, but nothing else. An easy way to test this is to flag a thread on a previous page SINK and then have someone else post to it so it doesn't move to the current page. Then click mark all read and then click new discussions, you will see it still shows.
  • You're right in that it doesn't mark everything read by default, it marks all discussions where the DateLastActive field is within the time range set (2 weeks by default, I think). Discussions that are sunk won't get their DateLastActive updated, because that would bump them up. So what you're experiencing sounds pretty much like expected behaviour to me.

    If you want the extension to mark a bigger range as read, you can change the $Configuration["MARKALLREAD_LIMIT"] value to something bigger.
  • See, Mark All Read to me is just that, Mark All Read. Applying a threshold to it when the documentation states it markes all read and is even the name of the addon to me doesn't make sense. If there is a reason you'd only want to mark a specific time frame read then it should be documented and allow the user to set the MARKALLREAD_LIMIT to something like 0 for everything no matter what the age is.

    I do appreciate the reply :)
  • Yeah but if you consider the load on the server and database of adding a record for every single user and every single discussion for what is in most cases unnecessary then it would be madness. You're welcome to make the markallreadlimit huge but for most users it's fine without and reduces strain on their systems.
    On this forum to mark every single discussion read it would need to insert approximately 36,914,966 new rows...that's a lot. And even based on a query time of 0.0001 seconds, which is pretty darn quick, would still take over an hour to complete. By which time you'd probably have got bored. And your server would have crashed.
  • It would actually be worse, because you have to check for every user/discussion combination if a record exists first, to decide if you have to update a record, or insert a new one.
  • That makes sense now. I've just up'd the threshold a bit since our forum is relatively small. Thanks so much for the response.
  • I'm getting this error when attempting to mark all read after changing the default from 2d to 4w. I also tried 6d and got the same error:


    Affected Elements
    Insert.MakeRead();

    The error occurred on or near: Duplicate entry '1-475' for key 1
  • hi all! how about storing a read-timestamp in the user table? if a user klicks "mark all read" this timestamp gets set to now(). the "is discussion read" check has to be altered to take the maximum of the user-read-timestamp and the LUM_UserDiscussionWatch-timestamp. to improve this, on "mark all read" can also delete all LUM_UserDiscussionWatch older than now().
  • @mydigitvoid

    I'm getting the same error as you, and looking at my LUM_iphistory table in the DB, I've noticed a lot of duplicate entries. I'm thinking this might be somehow related? If I start deleting duplicate entries, will this cause other things to break?
  • Oh, yeah. That second line of code really was needed after all. Without actually checking, but looking at what caused the error before, try replacing the last line of the CheckRead() function with if ($rows == $rows2['CountComments'] || $rows2['CountComments'] > $rows) return 2;


    Edit: The error doesn't have anything to do with IP history, it's that it's trying to insert records into the database for discussions where records already exist. And in that case it should update the records, not insert.
  • i am still getting the error even when i replace the last line back.
  • I'm having the same problem as mydigitalvoid, even after taking all of bjrn's advice. Any ideas here?
  • since i changed the last line of checkread() to

    if ($rows == $rows2['CountComments']) return 2;

    It works for me
Sign In or Register to comment.