• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

As designed  Undefined variable: errorPhraseKey

Onimua

Well-known member
#1
At this line:
PHP:
if (!$this->getInlineModTypeModel()->$functionName($ids, $options, $errorPhraseKey))
It seems XenForo_ControllerPublic_InlineMod_Abstract::executeInlineModAction doesn't define $errorPhraseKey. I added $errorPhraseKey = '' to the end and it seems to stop complaining, though not sure if I should pass it by reference or not but I don't see a difference on the front-end.
 

Kier

XenForo Developer
Staff member
#2
$errorPhraseKey should be passed by reference and defaulted to '' in the function signature for whatever you specify as $functionName - it's created on demand.
PHP:
public function myFunction(array $ids, array $options = array(), &$errorPhraseKey, array $viewingUser = null)
{
}
See functions such as XenForo_Model_Thread::canEditPoll() and XenForo_Model_InlineMod_Post::deletePosts() for examples of this pattern in use.
 

Onimua

Well-known member
#3
I went back and actually did this and now it works, but I'm a bit confused as to what I actually did that wasn't working before. :confused:
I may need to sleep more often...