I wanna display a icon in Forumbit with plugin , I have already used this declared :
global $db, $mybb
and this is the hook:
$plugins->add_hook("build_forumbits_forum", "addIcon");
and this is function :
function addIcon(&$forum)
{
global $db, $mybb;
$forum['lastposter'] = "blabla";
return $forum;
}
it's work when try to display UID or change it with "$forum['lastposteruid']" but when try to change username with "
$forum['lastposter']" it's not working
the problem
variable : $forum['lastposter'] not working
whole Forumbit not working if i removed it .
maybe i'm wrong
but i thing there is nothing wrong with syntax !!!
because when try to display UID or change it with "$forum['lastposteruid']" it's works fine
Hi Proton, $forum['lastposter'] is set after the execution of the build_forumbits_forum hooks, so your value is overwritten.
Go to the following line:
https://github.com/mybb/mybb/blob/featur...st.php#L60
Paste right after:
echo var_dump($forum);
exit;
Whatever you do to to
$forum
in your
addIcon()
function should be visible there.
I don't understand if
$forum['lastposter']
or
$forum['lastposteruid']
worked for you, but if they didn't work it might be because they are defined or overwritten later in the code.
(2020-05-07, 01:41 PM)Omar G. Wrote: [ -> ]Go to the following line:
https://github.com/mybb/mybb/blob/featur...st.php#L60
Paste right after:
echo var_dump($forum);
exit;
Whatever you do to to $forum
in your addIcon()
function should be visible there.
I don't understand if $forum['lastposter']
or $forum['lastposteruid']
worked for you, but if they didn't work it might be because they are defined or overwritten later in the code.
I added it :
and this is the function :
and I got this error !!!
I'm sure I made a mistake, but I don't know where
This is not an error. The code Omar provided is to print the value of the forum variable so you can check if your variable has been set.
Check my last answer:
(2020-05-07, 01:34 PM)chack1172 Wrote: [ -> ]Hi Proton, $forum['lastposter'] is set after the execution of the build_forumbits_forum hooks, so your value is overwritten.
(2020-05-07, 02:58 PM)chack1172 Wrote: [ -> ]This is not an error. The code Omar provided is to print the value of the forum variable so you can check if your variable has been set.
Check my last answer:
(2020-05-07, 01:34 PM)chack1172 Wrote: [ -> ]Hi Proton, $forum['lastposter'] is set after the execution of the build_forumbits_forum hooks, so your value is overwritten.
I got it
I'm sorry for that and thank you @chack1172 and Omar .
it's works
thank you again