With the Jamroom Module API, it's fairly easy to create your own Menu in the Jamroom Control Panel - however, there may be an instance where you want to add a new Menu Item to an existing Jamroom Control Panel Menu. This is done similarly to creating your own Control Panel Menu, but it is important that the NAME of the PHP script in your module/cp sub directory be named properly so Jamroom knows which Jamroom Control Panel menu to add your item to.
As an example, we'll add a new menu item to the "Videos" Jamroom Control Panel menu. We'll continue to use our jrYouTube module as an example, and we'll add a new Menu Item to create a new YouTube video.
Identifying the proper Control Panel Menu
The first step is to find the proper Control Panel menu name - in the case of the Videos section, it is called "section_video". You can find the proper name by logging in to the Control Panel, and holding your mouse over one of the Control Panel menu links - you'll see the "s" parameter, which indicates the Control Panel "section" - the menu. A list of available (default) Menus can be found at the bottom of this page.
Creating the Control Panel button script
Once we have identified the proper Control Panel menu to add our entry to, the next step is to create the small PHP script that wil do the actual button addition. It is important that the PHP script be named the SAME as the Control Panel menu (section) you want to add the button to. In our example, it is called "section_video", so our script would be called "section_video.php", and be located in the "cp" sub directory of our module:
The full contents of our example file would be:
<?php
/**
* Jamroom jrYouTube Control Panel menu button example
* @copyright 2009 by Talldude Networks LLC.
* @author Brian Johnson - bigguy@jamroom.net
*/
defined('IN_JAMROOM') or exit();
function jrYouTube_section_video(&$_user_info)
{
global $language;
if ($_user_info['quota_jryoutube_access'] == 'yes') {
jmButton($language['jrYouTube'][2],'jrYouTube.php?mode=create','youtube_create');
}
return(true);
}
?>
As you can see it is VERY simple. We:
- Create a function named MODULE_SECTIONNAME, so we get "jrYouTube_section_video" - this is the function Jamroom will execute, and will contain your code that you want added to the menu.
- Make SURE we do NOT include any jmTextBanner() or jmTextBannerEnd() function calls - it is important that we do NOT use these 2 functions inside your custom function, otherwise the menu will BREAK.
That's it however - the new button will show up at the bottom of the "Videos" menu.
Valid (default) Jamroom Control Panel menu names
The following Control Panel menu names are valid for a default Jamroom install:
- section_admin_options
- section_admin_support
- section_admin_cluster
- section_admin_content
- section_admin_users
- section_admin_blog
- section_admin_radio
- section_admin_channel
- section_admin_comment
- section_admin_guestbook
- section_admin_extra
- section_admin_menus
- section_extra
- section_site
- section_artist
- section_song
- section_video
- section_photo
- section_event
- section_vault
- section_blog
- section_store
- section_content
- section_radio
- section_channel
- section_tools
- section_menus
- section_member
- section_content
Note that while all of these menu names are valid in Jamroom 4, whether or not they show may be dependent on the Jamroom Add-ons installed, as well as the features enabled in the Profile's Jamroom Quota.
|