Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Changing permissions in plugins (Flagging and Quotes) to allow guests access to using them?

edited March 2012 in Vanilla 2.0 - 2.8

I'd like to allow Guests to be able to use Flagging and Quotes, but do not know how to change the permissions to do so. Do I need to change guest account permissions or simply change the permissions in the addon itself? And if so, where would I go about being able to do this?

Answers

  • @KJHenf : Do you see 'Flag' or 'Abuse' report link in your posts? I installed the plugin, but it doesn't show anything.

  • edited March 2012

    When I'm signed in with admin privileges I see both, and both work for me.

    I looked into class.quotes.plugin.php and found starting at line 84:

    protected function AddQuoteButton($Sender) {
    if (!Gdn::Session()->UserID) return;
    
          $Object = !isset($Sender->EventArguments['Comment']) ? $Sender->Data['Discussion'] : $Sender->EventArguments['Comment'];
          $ObjectID = !isset($Sender->EventArguments['Comment']) ? 'Discussion_'.$Sender->Data['Discussion']->DiscussionID : 'Comment_'.$Sender->EventArguments['Comment']->CommentID;
          $QuoteURL = Url("post/quote/{$Object->DiscussionID}/{$ObjectID}",TRUE);
          $QuoteText = T('Quote');
          echo <<<QUOTE
          <span class="CommentQuote"><a href="{$QuoteURL}">{$QuoteText}</a></span>
    QUOTE;
       }
    

    I assumed the first part was an in statement checking to see if the person was a registered user so I simply deleted the if line. This displayed the quote button and allowed me to click it, however when I click the quote button it takes me to a new "post comment" page and will not allow a guest to post; I'm not entirely sure how to make it so that the quote function will retain it's original functionality (allowing the "quote" to simply appear in the reply box at the bottom of the page).

  • edited March 2012

    Okay... I seem to have found a way to enable guests access to seeing both the quote and flag features (meaning the buttons "flag" and "quote"), but I haven't been able to figure out how to actually allow them to make use of these features (for example the "flag" button will not display the pop-up and the quote function will re-direct you to a new post page in which guests do not have the right to post... I want the quote function to simply add the

    <

    blockquote> styling into the post box at the bottom of the page. The site is (deleted) for reference).

  • edited March 2012

    I managed to get Flagging to completely work simply by changing the check for whether or not a user is logged in, but quoting is giving me troubles.

    I changed:

    if (!Gdn::Session()->UserID) return;

    To:

      $Session = Gdn::Session();
        if ($Session->IsValid()) return;
    

    Which enabled the quote button to work, but now I get the error:

    $("span.CommentQuote a").livequery is not a function
    [Break On This Error]   
    
    },this));
    

    At line 16 of quote.js which is (starting at line 8-16):

      Gdn_Quotes.prototype.Prepare = function() {
    
              // Attach quote event to each Quote button, and return false to prevent link follow
              $('span.CommentQuote a').livequery('click', jQuery.proxy(function(event){
                 var QuoteLink = $(event.target);
                 var ObjectID = QuoteLink.attr('href').split('/').pop();
                 this.Quote(ObjectID, QuoteLink);
                 return false;
              },this));
    

    This is making the quote function transfer you to a new page to post a comment, which conflicts with how the anonymouse plugin works. The quote material should simply be transferred to the comment box at the bottom of the page (exactly how this forums quote function works). Any thoughts? Thanks!

  • edited March 2012

    Alright, I've tried enabling/disabling all other plugins and it doesn't help; I still get the same "$("span.CommentQuote a").livequery is not a function" error.

    For now I just removed the if statement altogether, since it didn't seem necessary. I want the quote button added regardless.

Sign In or Register to comment.