vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   [AJAX] Drop Down Message Display / Selector (https://vborg.vbsupport.ru/showthread.php?t=99648)

harmor19 10-29-2005 10:00 PM

[AJAX] Drop Down Message Display / Selector
 
Author: Andrew Harmor
Version: 1.0.2
File Edits: 0
Template Edits: 2
Difficulty: Easy

Breaker has let me me use his site to demo this hack
It's the drop down menu above the shoutbox
Demo

Description
This hack adds a drop down menu underneath your navbar.
When someone selects a value it'll load a table with the contents you put in it (without reloading the page).

I have added a hook to make it possible to do replace on variables
The hook name is ajax_drop_menu_start and is located in "custom_messages.php"
In the product XML I have
PHP Code:

<hookname>ajax_drop_menu_start</hookname>
            <
phpcode><![CDATA[
            
$cm['title'] = str_replace("[you]"$vbulletin->userinfo['username'], "".$cm['title']."");
            
$cm['text'] = str_replace("[you]"$vbulletin->userinfo['username'], "".$cm['text']."");  
            ]]></
phpcode

What this does is replace [you] with the person viewing it username.
so instead of "hey [you]" I would see "hey harmor19".

###########################

If you are recieving this error when you upload the product please follow the directions below the error message
PHP Code:

MySQL Error You have an error in your SQL syntaxCheck the manual that corresponds to your MySQL server version for the right syntax to use near 'Messages = 'a:3:{s:20:\"custom_message_added\";s:46:\"The custo
Error Number : 1064 

Open the product xml in an editor (wordpad will do)

Find
PHP Code:

<phrasetype name="Error Messages" fieldname="Error Messages"

Replace With
PHP Code:

<phrasetype name="Front-End Error Messages" fieldname="Front-End Error Messages"

Save the file and import it.

################
Version 1.0.1
Added BBCode (Thanks to "Breaker" (again haha) )

Version 1.0.2
Added a hook in custom_messages.php

Zachariah 10-30-2005 02:06 AM

I may have a use. Thanks.

harmor19 10-30-2005 02:58 AM

If anyone installs this hack can I use your site as a demo to show it off?

BluPhoenix 10-30-2005 05:51 AM

using this as a "QuickFAQ" for some additional site features. Sorry though it's a closed site, but a very useful hack.. thanks for it.

Breaker 10-30-2005 09:50 AM

can i use variables within the message? useful addon :D


EDIT: no i can't :( theres also no delete message button, that i can find anyway

harmor19 10-30-2005 10:16 AM

There was a bug with the delete feature.
It's hard to explain.

does anyone know how I can have it use bbcodes?

Snake 10-30-2005 10:49 AM

Thanks, works great.

harmor19 10-30-2005 11:02 AM

I'm glad to hear it, please click "install"

I added a demo, thanks to "Breaker".

Gizmo5h1t3 10-30-2005 11:11 AM

as mentioned above, allowing it to use BB codes would be great..the delete issue isnt a problem, as all u have to do is edit a message...not a problem.

excellent addition...installed

harmor19 10-30-2005 11:21 AM

I need a better name for this hack
can somebody give suggestions?

Gizmo5h1t3 10-30-2005 11:44 AM

[AJAX] Drop down message display / selecter

Breaker 10-30-2005 11:44 AM

i have kind of got the bbcode working, although now i get <br /> pasted on every new line.... back to editing this file i guess :D

harmor19 10-30-2005 11:55 AM

Quote:

Originally Posted by Gizmo5h1t3
[AJAX] Drop down message display / selecter

Thanks, I'll use that

Breaker 10-30-2005 12:04 PM

I now have BBCode working on my site :D

harmor19 10-30-2005 02:01 PM

Updated.
I have added a hook, I'm not sure anyone has done this or thought they could.

Please read the information in the block at the top for more information.
If you have any questions on what else it could be used for don't hesitate to ask.

Edit: I just saw the tutorial for adding hooks.

Rich 10-30-2005 02:54 PM

Hello,

Quote:

MySQL Error : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'Messages = 'a:3:{s:20:\"custom_message_added\";s:46:\"The custo
Error Number : 1064
Date : Sunday, October 30th 2005 @ 11:49:46 AM

Breaker 10-30-2005 02:55 PM

where did you recieve that message?



hardcoded it.... but i have my variables working... ish :D

Rich 10-30-2005 02:56 PM

Hello,

I got that when I tried to import the product via the product manager. BTW, I just downloaded this, so if it was upgraded, it was messed up during the upgrade.

harmor19 10-30-2005 03:01 PM

You'll probably using "Front-End Error Message"
open the product xml in an editor (wordpad will do)

Find
PHP Code:

<phrasetype name="Error Messages" fieldname="Error Messages"

Replace With
PHP Code:

<phrasetype name="Font-End Error Messages" fieldname="Font-End Error Messages"


Rich 10-30-2005 03:37 PM

Hello,

That corrected the error. Thank you. (edit the "replace" to read Front, and not Font). Others may encounter this problem as well.

harmor19 10-30-2005 03:39 PM

I didn't notice that, thanks for pointing that out.

Rich 10-30-2005 04:12 PM

Hello,

I am assuming that the messages are stored in the database. If that is the case, can a delete button be added using a drop call to the db? Of course this could only be done by super admins because of permissions, but it would at least remove out dated info, etc.

Breaker 10-30-2005 05:22 PM

Current Suggested features for you to consider man:

Delete button (Think we all want this)
Variables (So i don't need to hardcode stuff)
Ability to reorder the messages (Tidy up the display)

harmor19 10-30-2005 08:24 PM

I'll make it so people can order the entries soon.

Floris 10-31-2005 05:03 PM

Nice stuff, tnx for sharing :)

Reeve of shinra 10-31-2005 05:30 PM

I can see this as being a very handy hack to have around. Good stuff.

donBLACK 11-01-2005 02:04 AM

the you option doesnt work

donBLACK 11-01-2005 02:07 AM

nvm fixed it

harmor19 11-01-2005 03:42 AM

@Floris & Reeve of shinra
I'm glad you like it
and Floris, thanks for giving me publicity, :D

Breaker 11-03-2005 09:19 PM

Quote:

Originally Posted by harmor19
I'll make it so people can order the entries soon.

any update on this?

silurius 11-05-2005 01:40 AM

This question may seem very silly, but where exactly do I create the content for the dropdown? Directly in the database? Could you include a note at the top of this thread with a quick explanation for that? Also a nice feature request might be an admincp tool allowing for easy content creation. Otherwise, great hack!

Breaker 11-05-2005 08:09 AM

theres an option on the ACP sidebar

Gizmo5h1t3 11-05-2005 08:18 AM

Quote:

Originally Posted by silurius
This question may seem very silly, but where exactly do I create the content for the dropdown? Directly in the database? Could you include a note at the top of this thread with a quick explanation for that? Also a nice feature request might be an admincp tool allowing for easy content creation. Otherwise, great hack!

there IS an ACP option m8

silurius 11-12-2005 04:19 AM

Thank you! Forgot I had Kirby's Admincp mod installed. :)

All right. I have had this hidden on my forums for a week and have been dying to find a reason to use it. So far I haven't come up with anything that would work perfectly for my forums. I'd love to see a list of some great uses for this very nifty hack.

AshokForums.com 11-14-2005 05:11 AM

I get this error :(

Database error in vBulletin 3.5.0:

Invalid SQL:
SELECT * FROM custom_messages WHERE display_order='1';

MySQL Error : Table 'aforums.custom_messages' doesn't exist
Error Number : 1146
Date : Monday, November 14th 2005 @ 12:44:47 PM
Script : http://AshokForums.com/----/custom_m...isplay_order=1
Referrer : http://AshokForums.com/----/showthread.php?p=9

Please help..

Thanks in advance


All times are GMT. The time now is 02:45 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.01203 seconds
  • Memory Usage 1,792KB
  • 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
  • (6)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (35)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