MyBB Community Forums

Full Version: I'm trying to write a plugin.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to write a plugin and I guess I am blind. I don't know what most any of these functions do. I know what the hooks do, and thats about it.

I want to make a plugin that adds a bit in the header template to be a link to a spot where they can buy points. I then want to have the page that gives the points to be able to know what userid is invoking the script. I want to then update the database entry of that userid. Just some simple things like this. The only thing I need to show up in the administrator interface is activate and deactivate. I don't need any special options.

Why is it unclear to me as to how to do this?

Here is my code so far.

function buynewpoints_info()
{
return array(
"name"			=> "Buy New Points",
"description"		=> "Ability to buy new points with paypal.",
"website"		=> "http://www.x3dev.com",
"author"		=> "Corey Manshack",
"authorsite"		=> "http://www.x3dev.com",
"version"		=> ".1",
"guid" 			=> "",
"compatibility"	=> "*"
);
}



if(!defined("IN_MYBB"))
	die("This file cannot be accessed directly.");
$plugins->add_hook("global_start", "buynewpoints");	

function buynewpoints_activate()
{

}
function buynewpoints_deactivate(){

}

I've read this... http://wiki.mybboard.net/index.php/Authoring_Plugins
It doesn't tell you anything about the mybb functions. It tells you what is expected in each plugin function.
if you want to know about newpoins plugin function .. refer to mybb-plugins.com by pirata nervo.. thank you
(2009-11-13, 05:08 AM)coreyman Wrote: [ -> ]Why is it unclear to me as to how to do this?...

You might want to start by looking at other plugins to get the general idea.
With many (complex) plugins:
the file ./inc/plugins/new_plugin.php is used to build the admin area options and perhaps some new database tables

then...
the file forum_root/new_plugin.php contains the 'actual, working php code'.

##
Since you mentioned "...to have the page that gives the points...", it sounds like you need a similar file structure.

Welcome to the forum. Smile
Ok thanks I'm going to look into these resources.

It's pretty clear to me about the newpoints function, (btw you have a bug everytime you try to edit a forum rule it edits all values) I'm just trying to make my own.