Nickeh32
05-17-2005, 11:53 PM
Hello,
I would like to add a Alert function for forum staff.
I did some of it myself, it just inserts a 1 into a field in the database called alert.
Others may not do this, but i'm quite new to PHP
// Is it a Moderator Alert?
if(can_moderate( ) && substr(strtolower($message), 0, 6) == "/alert" && preg_match("/\/alert \[(.+?)\]/i",$message)){
// Lets assume you typed in the correct username or a valid one
$msg_user = preg_replace("/\/alert \[(.*)\](.*)/i", "$1", $message);
// Strip The Message
$message = preg_replace("/\/alert \[(.*)\](.*)/i", "$2", $message);
$msg_user = trim(addslashes(htmlspecialchars_uni($msg_user)));
// Verify User Exists
if($verf_user = $DB->query_first("select userid,vbchat_pref_auto_on,vbchat_pref_auto_msg from ".TABLE_PREFIX."user where username='{$msg_user}'")){
$Special = $verf_user['userid'];
$alert = "1";
}
}
And then it inserts the value 1 into the alert field, this all works fine and isn't a problem it's showing the correct template that's the problem.
It's showing the template I created to format the text that is the problem, I have done it near the code for send a message to a specific user.
Here is what I tried:
if($ThisMSG['s_foruser'] > 0 AND $ThisMSG['alert'] = "1"){
if($ThisMSG['s_foruser'] == $bbuserinfo['userid']){ // This message is for you only, arn't you special! Not.
if($ThisMSG['alert'] = "1" AND $ThisMSG['s_foruser'] > 0) { eval('$chat_page .= "' . fetch_template('chat_row_alert') . '";'); } else if($ThisMSG['alert'] = "0" AND $ThisMSG['s_foruser'] > 0){ eval('$chat_page .= "' . fetch_template('chat_row_special_recieved') . '";'); }
} else if($ThisMSG['s_postby'] == $bbuserinfo['userid']){ // You sent this message to someone, lets show its sent. Bit of flirting eh?
I really need help with this, so can someone help please?
I would like to add a Alert function for forum staff.
I did some of it myself, it just inserts a 1 into a field in the database called alert.
Others may not do this, but i'm quite new to PHP
// Is it a Moderator Alert?
if(can_moderate( ) && substr(strtolower($message), 0, 6) == "/alert" && preg_match("/\/alert \[(.+?)\]/i",$message)){
// Lets assume you typed in the correct username or a valid one
$msg_user = preg_replace("/\/alert \[(.*)\](.*)/i", "$1", $message);
// Strip The Message
$message = preg_replace("/\/alert \[(.*)\](.*)/i", "$2", $message);
$msg_user = trim(addslashes(htmlspecialchars_uni($msg_user)));
// Verify User Exists
if($verf_user = $DB->query_first("select userid,vbchat_pref_auto_on,vbchat_pref_auto_msg from ".TABLE_PREFIX."user where username='{$msg_user}'")){
$Special = $verf_user['userid'];
$alert = "1";
}
}
And then it inserts the value 1 into the alert field, this all works fine and isn't a problem it's showing the correct template that's the problem.
It's showing the template I created to format the text that is the problem, I have done it near the code for send a message to a specific user.
Here is what I tried:
if($ThisMSG['s_foruser'] > 0 AND $ThisMSG['alert'] = "1"){
if($ThisMSG['s_foruser'] == $bbuserinfo['userid']){ // This message is for you only, arn't you special! Not.
if($ThisMSG['alert'] = "1" AND $ThisMSG['s_foruser'] > 0) { eval('$chat_page .= "' . fetch_template('chat_row_alert') . '";'); } else if($ThisMSG['alert'] = "0" AND $ThisMSG['s_foruser'] > 0){ eval('$chat_page .= "' . fetch_template('chat_row_special_recieved') . '";'); }
} else if($ThisMSG['s_postby'] == $bbuserinfo['userid']){ // You sent this message to someone, lets show its sent. Bit of flirting eh?
I really need help with this, so can someone help please?