2011-12-18, 10:57 PM
Hiya so i decided to try make a plugin where a user is private messaged when they are quoted. I am very new to publishing plugins so apologies but what hooks would i need or how can i find out? Thanks
~ David
~ David
(2011-12-18, 11:05 PM)pyridine Wrote: [ -> ]Here's a list: http://wiki.mybb.com/index.php/MyBB_Plugin_Hooks
You'd probably use newreply_do_newreply_end.
$plugins->add_hook("newreply_do_newreply_end", "foo_functionname");
function foo_functionname() {
// code here
}
$plugins->add-hook("hook", "function_name");
function function_name() {
//This is what happens with the function.
}
<?php
/**
* PMQuote 1.0
* 2011© PMQuote 1.0 Made by Vernier
* http://www.habfab.com
*/
if(!defined("IN_MYBB"))
{
die("You Cannot Access This File Directly");
}
$plugins->add_hook("newreply_do_newreply_end", "hello");
function pmquote_info()
{
return array(
"name" => "pmquote",
"description"=> "Allows Private messages to be sent to users when they are quoted in posts",
"website" => "http://www.habfab.com",
"author" => "Vernier",
"authorsite" => "http://www.habfab.com",
"version" => "1.0",
"guid" => "",
"compatibility" => "*"
);
}
function pmquote_activate()
{
global $db;
$setting_group = array(
'gid' => 'NULL',
'name' => 'pmquote',
'title' => 'pmquote',
'description' => 'Settings For YourPlugin',
'disporder' => "1",
'isdefault' => 'no',
);
$db->insert_query('settinggroups', $setting_group);
$gid = $db->insert_id();
$pmquote_setting = array(
'sid' => 'NULL',
'name' => 'enabled_pmquote',
'title' => 'Do you want YourPlugin Enabled',
'description' => 'If Yes People Can Use YourPlugin, If No People Cannot Use YourPlugin.',
'optionscode' => 'yesno',
'value' => '1',
'disporder' => 1,
'gid' => intval($gid),
);
$db->insert_query('settings', $pmquote_setting);
rebuild_settings();
}
function pmquote_deactivate()
{
global $db;
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN ('enabled_yourplugin')");
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='yourplugin'");
rebuild_settings();
}
function hello(){
global $mybb;
if ($mybb->settings['enabled_yourplugin'] == 1){
echo "<center><h1>pmquote Works!</h1><br />Try To Disable The Plugin :) You'll See This Text Will Hide..";
}
}
?>
213 parse_quoted_message $quoted_post