MyBB Community Forums

Full Version: DNT Announcements (index page only)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi there,

i've installed this plugin and run good, but the announcement displayed all pages on the forum. How can i do, if is possible, to display the message only on the index page ?

thank you for help me Smile
open the plugin file in editor like notepad++ or through file manager at web host panel

around line 13 find code like below
$plugins->add_hook('global_intermediate', 'dnt_announcements_global');

you can change it like below, save the file & check if it works only on the index
$plugins->add_hook('index_end', 'dnt_announcements_global');
thanks for your reply.

need i to access the server for open the plugin file ou can i do it by the admin panel ? be cause i have not access to the server.

even i want another page (like portal, getnew ant getdaily pages), is it possible ? i'm sorry but i don't know php langage (i recently replace the administrator who not time for continue maintenance on my forum).

thank you
access to files is required (ftp or web host panel)

if you want to show the plugin output on specific pages then you can try using
template conditionals plugin. however installing plugins requires files access.
i understand. i must demand acces of the server of the forum for continue.

thank you for informations.

hello

i spoke with the ancien administrator. then i can display the announcement for all pages i want. for make this, he put the code below on the plug-in file
global $announcements;
eval("\$announcements = \"".$templates->get("announcements",1,0)."\";");

and created an announcements template for the message and associate html :
<!-- <div class="dnt_announcements_registered">Hi {$mybb->user['username']} this is an announcement for all registered users on the forum !!!</div> -->

afterall, i put the {$announcements} tag after the {$header} tag of all the pages i want.

do you means this method is safe ?
Nope i think that methos is unnecessary due you can only go to your header templates and remove this var.

$dnt_announcements

then add it into index template, but best method is as .m. says to change hook to load only into index Smile

See yah !!!
(2017-07-01, 10:51 AM).m. Wrote: [ -> ]open the plugin file in editor like notepad++ or through file manager at web host panel

around line 13 find code like below
$plugins->add_hook('global_intermediate', 'dnt_announcements_global');

you can change it like below, save the file & check if it works only on the index
$plugins->add_hook('index_end', 'dnt_announcements_global');

this method don't work. we test another combination with 'index_start' too and with the pages 'build_forumbits_forum' and 'memberlist_intermediate'. for all time, the annoucement don't appears. is it a problem form the initialization of the variable ?

thanks
(2017-07-05, 11:15 PM)Caïthness Wrote: [ -> ]
(2017-07-01, 10:51 AM).m. Wrote: [ -> ]open the plugin file in editor like notepad++ or through file manager at web host panel

around line 13 find code like below
$plugins->add_hook('global_intermediate', 'dnt_announcements_global');

you can change it like below, save the file & check if it works only on the index
$plugins->add_hook('index_end', 'dnt_announcements_global');

this method don't work. we test another combination with 'index_start' too and with the pages 'build_forumbits_forum' and 'memberlist_intermediate'. for all time, the annoucement don't appears. is it a problem form the initialization of the variable ?

thanks

That is because you have to use the right var on right template:
Once you have changed that hook to index_end you have to add into your index template:

{$dnt_announcements}

Whenever you wish to display announcements and done !!!

In other ways you have to do

(2017-07-02, 02:52 PM)Dark Neo Wrote: [ -> ]Nope i think that methos is unnecessary due you can only go to your header templates and remove this var.

$dnt_announcements

then add it into index template, but best method is as .m. says to change hook to load only into index Smile

See yah !!!

And have to work fine...

See yah !!!