2023-09-22, 08:24 PM
I've got a plugin where I've hooked into global_start for all variables I need globally.
In the plugin where I declare these variables using the global_start hook this is how they are fetched.
These variables work literally everywhere but the postbits and I'm confused why? I'm using this in combination with the php in templates/template conditionals plugin.
Example in welcomeblock:
Example in member profile:
Example in postbit: (this one does not work)
also tried the below which throws no errors but also doesn't work
Not sure why its not able to fetch the information to be used in an array with postbits?
In the plugin where I declare these variables using the global_start hook this is how they are fetched.
$global_icgroups_query = $db->simple_select("settings", "*", "name='icvsooc_icgroups'");
$global_icgroups_fetch = $db->fetch_field($global_icgroups_query, "value");
$global_icgroups = explode(',', $global_icgroups_fetch);
These variables work literally everywhere but the postbits and I'm confused why? I'm using this in combination with the php in templates/template conditionals plugin.
Example in welcomeblock:
<if in_array($mybb->user['usergroup'], $global_icgroups) then>stuff here</if>
Example in member profile:
<if in_array($memprofile['usergroup'], $global_icgroups) then>stuff here</if>
Example in postbit: (this one does not work)
<if in_array($post['usergroup'], $global_icgroups) then>test</if>
^ error thrown: in_array() expects parameter 2 to be array, null givenalso tried the below which throws no errors but also doesn't work
<if in_array($post['usergroup'], array($mybb->settings['icvsooc_icgroups'])) then>test</if>
where $mybb->settings['icvsooc_icgroups'] outputs = 2,9,10,12Not sure why its not able to fetch the information to be used in an array with postbits?