11-22-2010, 02:55 AM
Hi Pirata! I have a problem with a plugin!
I want to make a plugin who replace an information , in my case [CP_INFO] with other information like user - number of posts or username. I like to do this before the reply message is inserted into my database. I don`t want to be like a parser message!
This is the code... Can you tell me where is wrong?
Thanks alot!
I want to make a plugin who replace an information , in my case [CP_INFO] with other information like user - number of posts or username. I like to do this before the reply message is inserted into my database. I don`t want to be like a parser message!
This is the code... Can you tell me where is wrong?
PHP Code:
<?php
if(!defined("IN_MYBB"))
{
die("This file cannot be accessed directly.");
}
$plugins->add_hook("newreply_do_newreply_end", "cp_parse");
function cp_info()
{
return array(
"name" => "Contest Parser",
"description" => "Plugin pentru concursuri. Parsare de informatii.",
"author" => "Surdeanu Mihai",
"website" => "http://mybbromania.net",
"version" => "1.0",
"compatibility" => "16*",
"authorsite" => "http://mybbromania.net",
"guid" => ""
);
}
function cp_activate()
{
}
function cp_deactivate()
{
}
function cp_parse($post)
{
global $mybb,$fid;
$username = $mybb->user['username'];
$nr_posturi = $mybb->user['postnum'];
$timp_petrecut = $myb->user['timeonline'];
$hash = md5($username."_".$nr_posturi.$timp_petrecut);
$post['message'] = preg_replace("[CP_INFO]", "<hr>Nume de utilizator : ".$username."<br>Numar de posturi : ".$nr_posturi."<br>Timp petrecut onine : ".$timp_petrecut."<br>Hash : ".$hash."<hr>", $post['message']);
return $post['message'];
}
?>
