GetSimple Support Forum

Full Version: load.php --> just my opinion
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok,

I'm creating a plugin and go to this url:
admin/load.php?id=pluginname

The page loads correctly, but the highlighted tab at the top is THEME, and therefore shows the THEME sidebar.
I believe this should default to the PLUGINS tab and show that plugins' additional pages on the right.

Thoughts?
Hey, dude pretty sure thats in the register plugin array
Code:
register_plugin(
    $thisfile,                     # ID of plugin, should be filename minus php
    'fooBar Plugin',                            # Title of plugin
    '1.0',                     # Version of plugin
    'Jamie Whiskers',            # Author of plugin
    'http://www.example.net',     # Author URL
    'The all mighty FooBar Plugin',     # Plugin Description
    'plugins',                     # Page type of plugin
    'foo'                          # Function that displays content
);

Page type Plugin I think is what you need to change.
Duh!! Big Grin

One of those days.

Anyway, I've got the options.php file setup and displaying only when the plugin is displayed, but what about the other plugins, could I hide them when I display the selected plugin so I can show off my other options in the sidebar?
We need to update the docs...

This variable is so it knows which sidebar to include and which Main tab to make “current”. The available ones are what is before the sidebar-*.php files in the /admin/template directory

Mike
Honestly i dont think so. I mean there might be a way, you would have to override the other plugins-sidebar actions. I would just make so it shows up in your content section, a nice added menu at the top.
^ I thought about that, I just don't know what the best approach would be. I'm not sure if the dev's want individual menu structures that are written and different each time, or if they want a menu structure that doesn't change from plugin to plugin.
You might want to use an adaption of the following code to add items to the sidebar of choice:

Code:
# hook
add_action('support-sidebar','gssr_sidelink');

# functions
function gssr_sidelink(){
    if(get_filename_id()==='salt-regeneration') { $current = 'class="current"'; } else { $current = null; }
    echo '<li><a href="'.$_SERVER['PHP_SELF'] . '?regen" '.$current.' >Regenerate Security Salt</a></li>';
}
(Stolen from Chris’ salt regeneration plugin.)

Just throw an if-clause around the add_action() that checks whether they are on one of your plugin pages. That way you won’t be filling up the sidebar when the user doesn’t want all your options there.