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.

Forcing Discussions to be Whispered

13»

Comments

  • MarkMark Vanilla Staff
    The discussion isn't passed as a delegate parameter in the GetDiscussionForm method, so you can't access it.

    I've just added a delegate parameter to GetDiscussionForm so you can do it...

    $this->DelegateParameters['Discussion'] = &$Discussion;

    So, now your function should be something like:

    function DiscussionForm_WhisperToMyself(&$DiscussionForm) { $d = &$DiscussionForm->DelegateParameters['Discussion']; $d->WhisperUsername = $DiscussionForm->Context->Session->User->Name; } $Context->AddToDelegate('DiscussionForm', 'DiscussionForm_PreRender', 'DiscussionForm_WhisperToMyself');

    I've committed that delegate parameter to svn.
  • edited August 2006
    Cheers. I thought i must be missing something.
  • So one day I'm gonna get through an extension without referring back to mark for help... Is there actually a method at the moment to allow extensions to add permissions per role or just user preferences? I'm sure one of jazzmans extensions used one but I cant seem to find it.. Otherwise i'll just make my own way.
  • edited August 2006
    Yep and it is very simple:
    $Context->Configuration['PERMISSION_WHATEVER'] = '0'; //Can't do it by default $Context->Dictionary['PERMISSION_WHATEVER'] = 'Can do it'; ... if ( $Context->Session->User->Permission("PERMISSION_WHATEVER") ) Do_It();
  • Hmm. For some reason i get this: Fatal error: Call to a member function on a non-object in C:\Program Files\xampp\htdocs\Vanilla\extensions\ForcedWhispers\default.php on line 19 when trying to access that if statement. (i changed the values obviously). i cant work out why though - i must have the context object instansiated surely?
  • When all else fails... MARK! Mini. I really appreciate the time you are spening on this. It is a great help.
  • It must be a *really* simple thing this time though. It's added the permission the roles fine. It just wont check it.
  • what is in the line 19?
  • edited August 2006
    Just a guest, if you have to add the "if.." inside the DiscussionForm_ForceWhisper fonction, it should look like this:if ( $DiscussionForm->Context->Session->User->Permission("PERMISSION_WHATEVER") ) Do_It();
  • Cheers! Knew it'd be something like that but my usual guess at $this-> didnt work :D
  • Right. I have it so that you can set each role with whether or not they can whisper to other people and it seems to be working fine. I'm just trying to make the whisper box disappear altogether if they dont have the ability but I'll have to keep kicking it for a while. Is there anything else it needs to do?
  • All I need it to do is have the users name filled in by default, so that, by default, all notes are private for them and them only.
  • Sorry nathan i read your post 2 days ago and glossed over it. Here you go: http://lussumo.com/community/discussion/3384/force-whispers/
  • Thanks mini. I won't be able to test it until this afternoon. I'll let you know how it handles.
This discussion has been closed.