I'm using the EE Discussion module (3.1.8) under EE 2.5.2 and when I submit certain forms, say from the 'Ignore' template for example, the form submits and processes fine, but the returned page shows this error:
Error
The following errors were encountered You are not authorized to perform this action
The form posts to this URL:
http://www.macobserver.com/tmo/forums/do_ignore_member/47211/
There is almost NO documentation for the Discussion Forum module so I'm not sure even what controls the form or the message.
The ignore form template code I'm using is:
{form_declaration}
<div class="fm-header-wrapper">
<h3>{lang:ignore_member_confirmation}</h3>
</div>
<div class="fm-message">
{if member_is_ignored}
<p class="fm-notice">{lang:already_ignored}</p>
{/if}
{if member_not_ignored}
<p>
<label for="fm-ignore-member">
{lang:ignore_member}: <strong>{name}</strong>
</label>
<input type='radio' name='action' value='ignore' checked="checked" id="fm-ignore-member" />
</p>
{/if}
{if member_is_ignored}
<p>
<label for="fm-unignore-member">
{lang:unignore_member}: <strong>{name}</strong>
</label>
<input type='radio' name='action' value='unignore' checked="checked" id="fm-unignore-member" />
</p>
{/if}
<p class="fm-submit">
<input type="submit" name="submit" class="submit" value="{lang:submit}" />
</p>
</div>
</form>
UPDATE I did some more digging on this and it seems that what is adding the duplicate info to the redirected URL is some lines in the /system/expressionengine/modules/forum/mod.forum_core.php code. Specifically in the 'do_ignore_member' function at line 8481
$return = str_replace('/'.$this->trigger, '', $this->EE->session->tracker[2]);
The $this->EE->session->tracker[2] variable is used on the next line and passed to the redirect call using a $this->forum_path($return); call. The forum_path method checks for the site basepath and then adds the URI value if one is passed in.
/**
* Compiles a path string
*/
public function forum_path($uri = '')
{
if ($this->basepath == '')
{
$this->_forum_set_basepath();
}
return $this->EE->functions->remove_double_slashes($this->basepath.$uri.'/');
}
UPDATE #2
So from my testing I think what is going on here is that the 'needle' value on the str_replace() is incorrect. EE adds a beginning slash '/' to the trigger word and then searches the $this->EE->session->tracker[2]
value for that value and removes it. The trouble is, at least from what I can see, is that the $this->EE->session->tracker[2]
value does NOT have a leading '/' so no match is found. I think the fix would be to change the line 8481 in the /system/expressionengine/modules/forum/mod.forum_core.php file from:
$return = str_replace('/'.$this->trigger, '', $this->EE->session->tracker[2]);
to:
$return = str_replace($this->trigger, '', $this->EE->session->tracker[2]);
This seems to fix the trouble for me, but I ask. Is this a truly a bug that needs this fix or am I just missing another configuration setting someplace?
http://dev.macobserver.com/tmo/forums/forums/viewthread/123
The appropriate URL would be:http://dev.macobserver.com/tmo/forums/viewthread/123
Which doesn't return the error. I checked mu setting and for 'FORUM URL' I have '/tmo/forums/' and for Forum Triggering Word it's 'forums'