News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Adding a button in Admin.php

Started by Krashsite, June 06, 2013, 05:47:11 PM

Previous topic - Next topic

Sir Osis of Liver


Trying to add a button to the Paid Subscriptions page to open a popup that displays a new php/html script.  The button is easy in Admin.php -



'paidsubscribe' => array(
'label' => $txt['paid_subscriptions'],
'enabled' => in_array('ps', $context['admin_features']),
'file' => 'ManagePaid.php',
'icon' => 'paid.gif',
'function' => 'ManagePaidSubscriptions',
'permission' => 'admin_forum',
'subsections' => array(
'view' => array($txt['paid_subs_view']),
'settings' => array($txt['settings']),

/// Add pick button
'pick' => array('Random Pick'),

),



... but haven't been able to make it do anything.  It appears the buttons in this subsection call functions from ManagePaid.php, so a new function would be needed, but can't get it, and am unable to do anything inline in Admin.php.  Just want to call a new php script and load it into a popup.

How to do this?

When in Emor, do as the Snamors.
                              - D. Lister

Antechinus

Hard code button in template. :P

If a screwdriver wont work, use an axe. :)

Sir Osis of Liver


That's what I set out to do, but haven't been able to find it in the template.   >:(

When in Emor, do as the Snamors.
                              - D. Lister

IchBin™

You can always include your file in one of the hooks that has your needed function to call.
IchBin™        TinyPortal

Sir Osis of Liver


Finally found it in GenericMenu.template.php

Some day I'll have to learn about hooks and functions, but not tonight.



When in Emor, do as the Snamors.
                              - D. Lister

Advertisement: