Add Menu Link
#1
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
Reply
#2
You can use our plugin here for free :

My Custom Navigation Links

Wink

If you prefer help just PM me...
MyBBCodes.com owner/administrator
Cool " It is not what you know that matters, it is what you do or do not do!"
We have currently 175+ MyBB Exclusive Plugins, 80+ MyBB Compatible MyCodes
Reply
#3
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?
Reply
#4
Yes, i can still help you with your problem if you tell me what you did and what did not worked?
MyBBCodes.com owner/administrator
Cool " It is not what you know that matters, it is what you do or do not do!"
We have currently 175+ MyBB Exclusive Plugins, 80+ MyBB Compatible MyCodes
Reply
#5
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.
Reply
#6
We need to know WHERE you want it. Different menus are built in different ways. Do you mean a UserCP Menu? And AdminCP Menu?
Reply
#7
(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
Reply
#8
(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.
Reply
#9
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
[Image: sig.gif]

Contact me in private only if you need paid help with mybb-related issues. Otherwise, please don''t, unless I invite you to. Thanks Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)