how to check whether the user is admin?
i wrote plugin, and i won't to inform the user how something happens, saying that I mean an event (call the script php )
how to send pm to user with sender='mybb_info' and title='xyz' and content='xyz2' and user who i send its "xy". ??? how can i do these?
i fix that

and second: how to check whether the user is admin?

This will check if they have ACP access, which will work for all admins.
MyReactions - All Plugins

Can you still feel the butterflies?

Free never tasted like pudding.
sorry, i mean my script for pm is work, but in a separate file works, but as it tries to add it to the main jumping bugs

Fatal error: Call to a member function simple_select() on a non-object in /home/ptmclan/public_html/inc/functions.php on line 4534

my pm code
//Configuration Section...
$fromid = 324; // Set the ID of the user the message should be sent from
$PMsubject = "Użytkownik wyzwał Cię na bitwę."; //Subject of the PM
$PMmessage = "Cześć, wyzywam Cię na bitwę pt.\"\". Wygra ten kto zdobędzie więcej głosów. Czas trwania bitwy to x dni, masz 2dni na zaakceptowanie bitwy.";
//Set to the message you want to be sent in the pm


$pm2 = array(
"subject" => $PMsubject,
"message" => $PMmessage,
"icon" => "-1",
"toid" => Array($toid),
"fromid" => $fromid,
"do" => '',
"pmid" => ''
$pm2['options'] = array(
"signature" => "0",
"disablesmilies" => "0",
"savecopy" => "0",
"readreceipt" => "0"


$pminfo2 = $pmhandler2->insert_pm();
// }


You can use the function is_super_admin()


Regarding to your error: make sure the $db object is globalized otherwise it will not be available in the function:
function myplugin_hook()
    global $db;
    $query = $db->simple_select("table","*","where clause");
i have included, how to check ?
define("IN_MYBB", 1);
require_once "../global.php";
require_once MYBB_ROOT."inc/datahandlers/pm.php";
global $db, $mybb, $lang;
(2011-01-03, 08:03 PM)Aries-Belgium Wrote: You can use the function is_super_admin()


Apart from the fact that checks if they're a super admin, not a normal admin...
MyReactions - All Plugins

Can you still feel the butterflies?

Free never tasted like pudding.
thanks, i have that, and i need script for pm.
my modyfication stops because i need sending pm. maybe i give code of my script ?

define("IN_MYBB", 1);
require_once "./global.php";
global $db, $mybb, $lang;
$sql = mysql_connect ("localhost","-------","-----")
or die ("Nie można się połączyć z bazą danych");
$db= mysql_select_db("--------", $sql)
or die ("Nie można wybrać bazy danych");
mysql_query('SET CHARACTER SET latin2');

echo "<head><!-- start: headerinclude -->"  ;
echo $headerinclude;

echo "<link rel='stylesheet' href='css/lightbox.css' type='text/css' media='screen' />  ";
echo "<script src='js/prototype.js' type='text/javascript'></script>        ";
echo "<script src='js/scriptaculous.js?load=effects,builder' type='text/javascript'></script> ";
echo "<script src='js/lightbox.js' type='text/javascript'></script>                ";


echo "</head>";

echo $header;


mysql_query(" my query");
echo "<center><big><font color='white'>Pojedynek został dodany pomyślnie czekaj na akceptacje przeciwnika w ciągu 48h</font></big></center>";
echo "<br><br><center> <a href=''>Powróć</a> </center>";

$z12 = mysql_query("SELECT * FROM `mybb_users` WHERE `mybb_users`.`username`='".$hojo."' LIMIT 1");
///////////////////////here i need pm with toid = array($toid);

If you can post your entire code, it would be more helpful as it seems you're incorrectly using some functions somewhere (possibly to do with getting thread link) which is causing the error.

If you do not want to post the code out here you can PM it.
i send U pm
how to connect with other database ? in mybb $db. Best will be two simultaneously
Mybb has no functionality to do that. You will have to connect using normal PHP Smile

Forum Jump:

Users browsing this thread: 1 Guest(s)