vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   [How-To] Add Messages to the Admin Message System (https://vborg.vbsupport.ru/showthread.php?t=127362)

derekivey 09-22-2006 10:00 PM

[How-To] Add Messages to the Admin Message System
 
[How-To] Add Messages to the Admin Message System

This how-to explains how you can insert a message to the new admin message system feature that was introduced in vBulletin 3.6.0 Beta 2.

I wanted to add this to a few of my hacks with a message on what to do when installed, so I looked in vB's files to see how they did it. It is actually done with a simple SQL query.

PHP Code:

$db->hide_errors();
 
$db->query_write("INSERT INTO " TABLE_PREFIX "adminmessage
   (varname, dismissable, script, action, execurl, method, dateline, status)
  VALUES
   ('varname_of_phrase', 1, 'script.php', 'some_action', 'script.php?do=some_action', 'get', " 
TIMENOW ", 'undone')
"
);
 
$db->show_errors(); 

  • varname - varname of the phrase that is to be shown for the message. It looks like vB is using an error phrase for this.
  • dismissable - whether or not to allow the user to dismiss the message without addressing it (1 = yes, 0 = no).
  • script - the script that the user will be redirected to when they address the issue.
  • action - the "do" action that will be used.
  • execurl - the url to the file that the user is redirected to (script.php?do=some_action).
  • method - get or post.
  • dateline - date message was added, you can add the current date/time with the TIMENOW constant.
  • status - status of message (undone, done, dismissed), this should be set to undone most of the time.
You should be able to add the above code into your product install code, just remember that these messages will only show if the user installing your product has at least 3.6.0 beta 2 running.

Hope this helps some people. I know it will definitely be useful for me!

Derek


All times are GMT. The time now is 09:01 AM.

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.01092 seconds
  • Memory Usage 1,711KB
  • 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
  • (1)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