MyBB Community Forums

Full Version: first plugin help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i am trying to create my first plugin. And i need major help. im way confused. can someone tell me if this is right so far. (also, i have no idea what to do for the first plugin so if someone can give me an easy idea. its ok if someone else made it, i wont publish it or anything. thanks!)

function sample_info()
	{

	return array(
		"name"		=> "Sample Plugin!",
		"description"		=> "A sample plugin ...",
		"website"		=> "http://www.wizard101society.com",
		"author"		=> "-------",
		"authorsite"		=> "http://www.wizard101society.com",
		"version"		=> "0.1",
		"guid" 			=> "",
		"compatibility"	=> "16*"
		);
	}
	function sample_activate()
		{
			// Things to do when the plugin is activated
		}

	function hello_is_installed()
		{
			global $db;
			if($db->table_exists("sample"))
			{
				return true;
			}
			return false;
		}

		function sample_deactivate()
		{
			// Things to do when the plugin is deactivated
			// ... things like template changes, language changes etc....
		}



If you are not going to use the _install and _uninstall function, you don't need the _is_installed function. You also need to make sure to prefix your function correctly. If your file is called "sample.php" then your function need to be called:
sample_activate
sample_deactivate
sample_install
sample_is_installed
sample_uninstall