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.

Tagging plugin problem with Urls

SevMCSevMC
edited February 2012 in Vanilla 2.0 - 2.8

Hello!

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()
               ->Select('t.*')
               ->From('TagDiscussion td')
               ->Join('Tag t', 'td.TagID = t.TagID')
               ->Where('td.DiscussionID', GetValue('DiscussionID', $Discussion))
               ->Where("coalesce(t.Type, '')", '')
               ->Get()->ResultArray();

            $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')

    to

    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.

Answers

  • anyone??

  • x00x00 MVP
    edited February 2012 Answer ✓

    try changing

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

    to

    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.

  • Thanks :)

    Well yeah, it maybe doesn't worth it now, but maybe later I will customize a lot the system when the community grows up, in order to make it more "original". As the concept of the project is not realy a "forum", maye I will need to change the URL's later in order to be more accurate with the concept. I know it will be complicated to change the whole system in order to realy change them, but maybe in that moment will worth it.

    Sorry for my bad english, it is not my first language.

  • x00x00 MVP
    edited February 2012

    There is a possible way to do it but it is more complicated than you think, not simple. People rely on Controller, RequestMethod, OrigionalRequestMethod, RequestArgments, and also they may simply not use the supplied methods, an rip it out with hacky php.

    if there is interest in localising the uri , be it categories, and other controllers, plus methods, then feel free to sponsor the project.

    grep is your friend.

  • Thanks for the sugestions :)

Sign In or Register to comment.