Fork me on GitHub
Current Releases are 2.1 stable (major release) and 2.0.18.11 (security patch for 2.0)
We've also rebooted our GitHub repo, docs, and more!

Tagging plugin problem with Urls

SevMCSevMC
edited February 2012 in Questions

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

Sign In or Register to comment.