2015-01-12, 01:08 PM
I am completely new in making your own plugins, so I started with a very simple one. This plugin removes the forum jump menu at the bottom of the forum display and thread display pages.
It works, the templates are changed and the forum jump menu is disappeared from the pages. However, after installing I get the following screen:
[attachment=33497]
So it seems to be installed (and it is, the templates have been changed), but there is no uninstall (or deactivate) link. Hence, I cannot uninstall the plugin. When I reverse the templates to their original state and I press install, the templates are changed again.
I suppose something went wrong in the first try, when there was still an error, but I can't remember what that was. Is there a way to restore a "normal" situation in which I can activate and deactivate this plugin?
Below the listing:
Thanks in advance!!
It works, the templates are changed and the forum jump menu is disappeared from the pages. However, after installing I get the following screen:
[attachment=33497]
So it seems to be installed (and it is, the templates have been changed), but there is no uninstall (or deactivate) link. Hence, I cannot uninstall the plugin. When I reverse the templates to their original state and I press install, the templates are changed again.
I suppose something went wrong in the first try, when there was still an error, but I can't remember what that was. Is there a way to restore a "normal" situation in which I can activate and deactivate this plugin?
Below the listing:
<?php
/**
* Disallow direct access to this file for security reasons
*
*/
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
/**
* Standard MyBB info function
*
*/
function WMOforum_info()
{
global $lang;
return Array(
'name' => "WMOforum",
'description' => "Wijzigingen van WMO forum ten opzichte van het standaard MyBB 1.8.3 forum",
'website' => '',
'author' => 'Ad Bakker',
'authorsite' => '',
'version' => '1.0',
'guid' => '',
'compatibility' => '18*',
);
}
/**
* Install function
*
*/
function WMOforum_install()
{
// Deactivate forum jump menu in templates showthread and forumdisplay_threadlist
require_once(MYBB_ROOT . '/inc/adminfunctions_templates.php');
find_replace_templatesets('showthread', '#' . preg_quote('{$forumjump}') . '#', '<!--Here was the forumjump menu-->');
find_replace_templatesets('forumdisplay_threadlist', '#' . preg_quote('{$forumjump}') . '#', '<!--Here was the forumjump menu-->');
// WMOforum_uninstall();
}
/**
* Function that checks whether plugin is installed
*
*/
function WMOforum_is_installed()
{
global $db;
if($db->table_exists("WMOforum"))
{
return true;
}
return false;
}
/**
* Uninstall function
*
*/
function WMOforum_uninstall()
{
// Reactivate forum jump menu in templates showthread and forumdisplay_threadlist
require_once(MYBB_ROOT . '/inc/adminfunctions_templates.php');
find_replace_templatesets('showthread', '#' . preg_quote('<!--Here was the forumjump menu-->') . '#', '{$forumjump}');
find_replace_templatesets('forumdisplay_threadlist', '#' . preg_quote('<!--Here was the forumjump menu-->') . '#', '{$forumjump}');
}
?>
Thanks in advance!!