@3Di I know that's why I asked...
I don't know, I guess I was thinking too "creatively"?
I was hoping that
$variable
would be populated by the result of the functions within the condition.
Code: Select all
($this->request->variable('something', '') || $this->request->variable('something_else', ''))
So I would get the result of
$this->request->variable('something', '')
OR the result of
$this->request->variable('something_else', '')
.
Like I said don't ask why, I was probably high on tee...
Then I realized 2 things...
1st The variable that I am requesting is from a submit
button
and the
value=
of it is just the translation
{ lang('SUBMIT') }
for the button. So I don't get the value of
id=
thus it makes it unusable.
2nd and most important of course the result of the condition (of course) is
BOOL
and NOT the result of functions with it.
(again, stupid me. High and weird expectations).
Anyway.
I used
$this->request->is_set()
instead of
$this->request->variable()
and after that in the
if(){ HERE }
I used them again to execute what is needed.
Unfortunately I haven't uploaded the ext to the github yet so I can't really show it to you to see the whole picture.
But here is the if thing...
Code: Select all
if (($this->request->is_set('secretsanta_reset') || $this->request->is_set('secretsanta_reset_pair')) && $secret_santas_info['secretsanta_organizer'])
{
$requested = '';
$user_ids = array_column($secretsantas['participants'], 'user_id');
if ($this->request->is_set('secretsanta_reset'))
{
// reset participants
$requested = 'secretsanta_reset';
}
if ($this->request->is_set('secretsanta_reset_pair')){
// reset pairs
$requested = 'secretsanta_reset_pair';
}
$this->reset_function($requested, $user_ids);
}
I couldn't think anything shorter than that.