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

Comment Protection bug?

edited April 2007 in Vanilla 1.0 Help
Here on this forum, blocking a user doesn't seem to stick for me. I can block someone, but eventually they become unblocked. Is blocking just for a session, or a short period, or is it supposed to be permanent?

Comments

  • Options
    I think it's just for session.
  • Options
    MarkMark Vanilla Staff
    It should be permanent, actually. I haven't tested it in a long time, I'll have to check it out. It could have something to do with that account form bug which resets all preferences, though.
  • Options
    Did we ever fix that?
  • Options
    MarkMark Vanilla Staff
    Yes, I've fixed it now in svn.
  • Options
    I've solved the mystery of the disappearing user blocks: The RemoveUserBlock function in the UserManager is using $s->AddFieldNameValue() rather than $s->AddWhere(), which is meaningless when deleting rows. So whenever anyone unblocks a user, the entire contents of the LUM_UserBlock table is deleted.
  • Options
    *bump* Mark, it would be awesome if you would fix this.
  • Options
    Looks like this is still happening. I just tried blocking a_magical_me, Mark and mary. Then I unblocked mary, and suddenly Mark and a_magical_me were unblocked as well.
  • Options
    Sure enough:
    function RemoveUserBlock($UserID) { $s = $this->Context->ObjectFactory->NewContextObject($this->Context, 'SqlBuilder'); $s->SetMainTable('UserBlock', 'b'); $s->AddFieldNameValue('BlockingUserID', $this->Context->Session->UserID); $s->AddFieldNameValue('BlockedUserID', $UserID); // Don't stress over errors (ie. duplicate entries) since this is indexed and duplicates cannot be inserted $this->Context->Database->Delete($s, $this->Name, 'RemoveUserBlock', 'An error occurred while removing the user block.', 0); }

    should probably (untested) be
    function RemoveUserBlock($UserID) { $s = $this->Context->ObjectFactory->NewContextObject($this->Context, 'SqlBuilder'); $s->SetMainTable('UserBlock', 'b'); $s->AddWhere('b', 'BlockingUserID', '', $this->Context->Session->UserID, '='); $s->AddWhere('b', 'BlockedUserID', '', $UserID, '='); $this->Context->Database->Delete($s, $this->Name, 'RemoveUserBlock', 'An error occurred while removing the user block.', 0); }
This discussion has been closed.