2011-12-02, 02:06 PM
(This post was last modified: 2011-12-02, 03:02 PM by MyBB Tuneup.)
I want to know how can I make a hiperlink in a plugin to call a certain function in Admin CP.
My function:
What I should to put instead "xxx" to call "myfunction()" when I click on "Say Hello !" ?
-------------------
// LATER EDIT:
Before you ask me why I need that, I will give you more details.
I try to develop a plugin (for fun) called "TuneUp".
Before my plugin is installed (and/or activated) will show to admins a warning message if option "Disable All Plugins" is enabled. In this warning message, i have a link called "Click Here" like this:
I have also this function to check if option is enabled or not:
I want instead of
So... this is what I want: CHANGE DISABLE ALL PLUGINS OPTION FROM YES TO NO WHEN I CLICK ON THIS LINK !
(equivalent with value of $mybb->settings["no_plugins"])
After that, process requested by admin will continue (install or activate).
It is possible ? How ? Also.. it's safe ???
My function:
function myfunction()
{
if(/* permissions */ == true)
{
// run
echo 'Hello.';
}
else 'Access denied !';
}
And the hiperlink:'<a href="index.php?xxx">Click here !</a>';
What I should to put instead "xxx" to call "myfunction()" when I click on "Say Hello !" ?
-------------------
// LATER EDIT:
Before you ask me why I need that, I will give you more details.
I try to develop a plugin (for fun) called "TuneUp".
Before my plugin is installed (and/or activated) will show to admins a warning message if option "Disable All Plugins" is enabled. In this warning message, i have a link called "Click Here" like this:
I have also this function to check if option is enabled or not:
// CHECK ACCESS
function tuneup_check_access()
{
global $mybb, $lang, $plugins;
if(defined("NO_PLUGINS") || ($mybb->settings["no_plugins"] == 1))
{
$lang->load("tuneup", false, true);
$message = $lang->tuneup_warning_install."<br /><small><a href=\"index.php?module=config-settings&action=change&gid=7#row_setting_no_plugins\" />".$lang->tuneup_click_here."</a> ".$lang->tuneup_warning_install_try_again."</small>";
if(tuneup_is_installed())
$message = $lang->tuneup_warning_activate."<br /><small><a href=\"index.php?module=config-settings&action=change&gid=7#row_setting_no_plugins\" />".$lang->tuneup_click_here."</a> ".$lang->tuneup_warning_activate_try_again."</small>";
flash_message($message, "error");
admin_redirect("index.php?module=config-plugins");
}
}
I want instead of
$message = $lang->tuneup_warning_install."<br /><small><a href=\"index.php?module=config-settings&action=change&gid=7#row_setting_no_plugins\" />".$lang->tuneup_click_here."</a> ".$lang->tuneup_warning_install_try_again."</small>";
to have this: $message = $lang->tuneup_warning_install."<br /><small><a href=\"/*CHANGE DISABLE ALL PLUGINS OPTION FROM YES TO NO WHEN I CLICK ON THIS LINK !*/" />".$lang->tuneup_click_here."</a> ".$lang->tuneup_warning_install_try_again."</small>";
So... this is what I want: CHANGE DISABLE ALL PLUGINS OPTION FROM YES TO NO WHEN I CLICK ON THIS LINK !
(equivalent with value of $mybb->settings["no_plugins"])
After that, process requested by admin will continue (install or activate).
It is possible ? How ? Also.. it's safe ???