Fork me on GitHub
Please upgrade to 2.1.x here. The 2.0 branch is no longer being updated.
Critical: Update to 2.1.8, released 15 Jan.

Tagging plugin problem with Urls

edited February 2012 in Vanilla 2.0 Help


I've modified the .htaccess and added the following rules:

 RewriteRule ^post/discussion(.*)$ /post/sound$1 [R,L]
 RewriteRule ^sound(.*) index.php\?p=post/discussion$1 [PT,L]

The problem is that the tagging box doesnt apear when someone tryes to create a discussion because it is not the normal URL I think the problem may be here, but I don't know how to fix it:

    * Add the tag input to the discussion form.
    * @param Gdn_Controller $Sender
   public function PostController_BeforeFormButtons_Handler($Sender) {
      if (C('Plugins.Tagging.Enabled') && in_array($Sender->RequestMethod, array('discussion', 'editdiscussion'))) {
         $Discussion = GetValue('Discussion', $Sender->EventArguments);
         if ($Discussion && !$Sender->Form->IsPostBack()) {
            // Load the existing tags.
            $Tags = Gdn::SQL()
               ->From('TagDiscussion td')
               ->Join('Tag t', 'td.TagID = t.TagID')
               ->Where('td.DiscussionID', GetValue('DiscussionID', $Discussion))
               ->Where("coalesce(t.Type, '')", '')

            $Tags = ConsolidateArrayValuesByKey($Tags, 'Name');
            $Sender->Form->SetValue('Tags', implode(' ', $Tags));

         echo $Sender->Form->Label('Tags', 'Tags');
         echo $Sender->Form->TextBox('Tags', array('maxlength' => 255));

I'e fixed the problem with the voting pluggin just changing this:

$VoteUpUrl = '/sound/'.$VoteType.'/'.$ID.'/voteup/'.$Session->TransientKey().'/';
$VoteDownUrl = '/sound/'.$VoteType.'/'.$ID.'/votedown/'.$Session->TransientKey().'/';

But is not the same with this one

Best Answer

  • x00x00 MVP
    edited February 2012 Answer ✓

    try changing

    in_array($Sender->RequestMethod, array('discussion', 'editdiscussion')


    in_array($Sender->RequestMethod, array('sound','discussion', 'editdiscussion')

    what you are doing is precarious, I'm not saying don't do, just you will be fire fighting.

    Ask yourself "is it really worth the hassle?"

    grep is your friend.


Sign In or Register to comment.