MyBB Community Forums
Add Menu Link - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Resources (https://community.mybb.com/forum-8.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: Add Menu Link (/thread-62571.html)



Add Menu Link - shaks786 - 01-04-2010

Hi,
im creating a plugin and I want it to add a menu link automatically once its installed and remove it when it is uninstalled/deactivated. Can anyone help me please?

Thank You
anyone? Sad


RE: Add Menu Link - exdiogene - 01-05-2010

You can use our plugin here for free :

My Custom Navigation Links

Wink

If you prefer help just PM me...


RE: Add Menu Link - shaks786 - 01-05-2010

exdiogene, thank you, but Im making a plugin, so i need it to make a menu link automatically once someone installs the plugin on their forums. Get me?


RE: Add Menu Link - exdiogene - 01-05-2010

Yes, i can still help you with your problem if you tell me what you did and what did not worked?


RE: Add Menu Link - shaks786 - 01-05-2010

http://mods.mybboard.net/view/mybb-quran

thats version 1 of the mod.(i made it)
in the next version I want it to add a menu link. I have not done anything because I am a beginner in MyBB coding, and I do not know where to start.


RE: Add Menu Link - Dylan M. - 01-05-2010

We need to know WHERE you want it. Different menus are built in different ways. Do you mean a UserCP Menu? And AdminCP Menu?


RE: Add Menu Link - shaks786 - 01-05-2010

(01-05-2010, 11:34 PM)ralgith Wrote: We need to know WHERE you want it. Different menus are built in different ways. Do you mean a UserCP Menu? And AdminCP Menu?

where it says "Search, Memberlist, Calendar, Help" at the top


RE: Add Menu Link - Dylan M. - 01-06-2010

(01-05-2010, 11:58 PM)shaks786 Wrote:
(01-05-2010, 11:34 PM)ralgith Wrote: We need to know WHERE you want it. Different menus are built in different ways. Do you mean a UserCP Menu? And AdminCP Menu?

where it says "Search, Memberlist, Calendar, Help" at the top

Ok, so a toplink then Smile

This is in the header template
To add it from a plugin you need to use the find_replace_templatesets function in your plugin

For example
PHP Code:
require_once MYBB_ROOT."inc/adminfunctions_templates.php";

find_replace_templatesets("header"'#'.preg_quote('<li><a href="{$mybb->settings[\'bburl\']}/memberlist.php"><img src="{$mybb->settings[\'bburl\']}/{$theme[\'imgdir\']}/toplinks/memberlist.gif" alt="" title="" />{$lang->toplinks_memberlist}</a></li>').'#''<li><a href="{$mybb->settings['bburl']}/memberlist.php"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/memberlist.gif" alt="" title="" />{$lang->toplinks_memberlist}</a></li>WHATEVER YOU WANT TO ADD HERE'); 

Would go into your activate routine and put the link between member list and calendar

While
PHP Code:
require_once MYBB_ROOT."inc/adminfunctions_templates.php";

find_replace_templatesets("header"'#'.preg_quote('<li><a href="{$mybb->settings[\'bburl\']}/memberlist.php"><img src="{$mybb->settings[\'bburl\']}/{$theme[\'imgdir\']}/toplinks/memberlist.gif" alt="" title="" />{$lang->toplinks_memberlist}</a></li>WHATEVER YOU ADDED HERE').'#''<li><a href="{$mybb->settings['bburl']}/memberlist.php"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/memberlist.gif" alt="" title="" />{$lang->toplinks_memberlist}</a></li>'0); 

Would go into your deactivate routine. Now notice how theres an extra field (a 0 for the value) on the removal. Don't forget that or it won't work right.


RE: Add Menu Link - babjusi - 01-09-2010

You can find an easier example at my plugin here. Download it and check out the code I have used.

http://www.forumsecurity.eu/showthread.php?tid=12