Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

In this Discussion

Tagging plugin problem with Urls

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 Don't PM about development, I'm not currently taking on clients MVP
    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?"

    Don't PM about development, I'm not currently taking on clients.

    grep is your friend.

Answers

Sign In or Register to comment.