vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB Chat (https://vborg.vbsupport.ru/forumdisplay.php?f=107)
-   -   / Alert Function - Mods Only (https://vborg.vbsupport.ru/showthread.php?t=81652)

Nickeh32 05-17-2005 11:53 PM

/ Alert Function - Mods Only
 
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
PHP Code:

                        // Is it a Moderator Alert?
            
if(can_moderate(  ) && substr(strtolower($message), 06) == "/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:
PHP Code:

if($ThisMSG['s_foruser'] > 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?


All times are GMT. The time now is 05:54 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00958 seconds
  • Memory Usage 1,726KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete