PDA

View Full Version : Admin-controlled (only) random quote hack for header/homepage


KuraFire
05-06-2002, 10:00 PM
What does this hack do?
It adds a quote and the quoter to your board, either in your header/footer (hack global.php) or on your forumhome page (hack root/index.php).

What's the additional server load of this hack?
It adds 1 query to each page you have a quote show up on. If you add it to global.php it'll add 1 query to ALL pages, if you add it to root/index.php it'll only add 1 query to your forumhome, but you won't be able to show the quotes anywhere else.

Why should we use your hack and not one of the two other quote hacks?
Mine is extremely easy (_I_ made it, and I'm a n00b!) but, more importantly, it doesn't allow your users to enter quotes nor does it put it on two silly lines (no offense Lesane, but that aspect, I found absolutely horrid). This is useful if you have a lot of users and don't feel like spending 4 hours a day moderating all new quote-submissions your members made. Or, if you just want full control. :)

Instructions:
Step 1: run this query on your vBulletin database (I suggest in phpMyAdmin):

CREATE TABLE quotes (
quote text NOT NULL,
name text,
letter tinytext,
id int(11) NOT NULL auto_increment,
PRIMARY KEY (id)
)

Step 2 a: if you want it to appear in your header/footer on ALL pages, open global.php and find this line:

// ###################### Start templates #######################

Add ABOVE that, this code:

// quotes hack by KuraFire
$quot=$DB_site->query_first("SELECT quote,name FROM quotes ORDER BY rand() LIMIT 1");
$thequote = $quot['quote'];
$thequoter = $quot['name'];

Step 3 a: save global.php and edit your header/footer template. Put in $thequote for the quote, and $thequoter for the quote's quoter, ie. the person who said the quote.


Step 2 b: if you want this to appear only on your forumhome, open root/index.php and find this line:

// get total posts

Add ABOVE that, the following:

// quotes hack by KuraFire
$quot=$DB_site->query_first("SELECT quote,name FROM quotes ORDER BY rand() LIMIT 1");
$thequote = $quot['quote'];
$thequoter = $quot['name'];

Step 3 b: save your root/index.php and edit your forumhome template (won't work on forumhome_whatever or so, only on your main forumhome template). Add $thequote for the quote, and $thequoter for the quote's quoter, ie. person who said the quote.

That's it. I left it up to you entirely where and how you add the quote and quoter, seeing as how people will place it in different places entirely.

Attached is a small selection of my own quotes database. Not all of it, for a: it'd be quite a lot, and b: it took me a lot of work to get those quotes together and into a database, neatly, and I'm not done processing my entire collection yet so I'm not making my entire quotes database publicly available.
To add these 100 quotes to your database, run the contents of 100quotes.sql as a query in phpMyAdmin on your database.

In the second post, I will add a screenshot.

This hack is really basic, Kura, I'm sure you can do more with this! What's your plan, my man?
Self-imployed vote of confidence, woohoo!
*cough* anyway, yeah this is actually just the first part of a rather big hack I have in mind, though not yet in true development. What I'm Planning to create, is a quote index very similar to the memberlist, but then about quotes. You'll have noticed that the structure of the `quotes` table that this hack adds, includes a "letter" column. This is solely for the purpose of making the quotes table searchable by letter, later on. Like, when you click on members, you'll have the option to select all members by a single letter. Same with the quotes list I am working on (in my mind mostly, thus far).

(edit: this quotes listing is now done. Contact me if you want an early release)

UPDATE IN POST #20: Admin Panel Addition for easy Quotes adding!


* KuraFire awaits response again...

Edit: credit goes out to Lesane for being the first one to have made a quote hack, of course, but this one is different, and I think it's good for people to be able to have a choice.

KuraFire
05-07-2002, 09:56 PM
A screenshot of how it looks on my own (new, not publicly available) board.

Note that I can't include the entire header, since I'm keeping that a secret until all is done. This screenie is just how it looks if you add it between the header and content-table, using the global.php edition of the hack.


Oh and if you find the ID's on the 100quotes attachment rather odd: that's due to the auto_increment, and the fact that I didn't want to give you guys 100 Letter A quotes. :)

dimitr|
05-08-2002, 07:27 AM
Shouldn't the $quote and $quoter that you put into the template be $thequote and $thequoter ?

TECK
05-08-2002, 07:50 AM
i'm not sure, but this was done also by lesane.

KuraFire
05-08-2002, 08:37 AM
dimitr| ~ sheize, you're right, my mistake!

*edits the first post*

nakkid, like my first post says, yes Lesane made a random quote hack too, but I don't like it. It splits quotes into two short lines, it doesn't give out the Quoter information, rather it tells who submitted the quote, and as is clear from the last sentence, it lets members submit quotes, which this hack doesn't. This is useful for big boards where you don't want to sift through 500 submitted quotes a day. :)

Lesane
05-08-2002, 08:45 AM
I think that every member from a board likes to contribute on his favorite board by adding quotes. My members loved it to contribute to the forum by adding quotes. Adding quotes of their favorite artist/actor or their own quotes. Why would u take this ability away from them?

In my eyes it's like making a new store hack but then let only admins buy things ;)

KuraFire
05-08-2002, 09:07 AM
Like I said, there's the obvious reason if you run a very big board - who wants to moderate hundreds of quotes all the time? You can bet your ass on it that users will be submitting quotes that already exist in your database. I don't have the time to even moderate my board if I'd let my users submit quotes, and I have about 50 really active people and 150 ones that drop by every so often.

Second of all, your hack lists quotes in two small lines. I totally don't like that, looked ugly as hell, so that was one more reason for me to make my own hack.

Thirdly, this hack will, one day, incorporate a Quotes listing similar to memberlist.php and will be searchable and orderable by letter. Is your quotes table structured for that? (just wondering :))

Lastly, your hack (last I checked) didn't display the Quoter, only the member who submitted a quote. That's just taking credit away from ALL those people who made the quotes! :(

KuraFire
05-08-2002, 09:10 AM
besides, Lesane, why not let your users contribute by donating to The Cause (tm) of your board, eh? ;)

Floris
05-08-2002, 10:20 AM
Originally posted by nakkid
i'm not sure, but this was done also by lesane.
Do you ever read the content of a thread, or just reply to the title of a thread? Geez. Kura already mentioned this.

Besides that, this one differs too much from the one lesane made. As the thread title implies, admin only .. One person invented the wheel, the rest uses it and sometimes even improves it, if we didn't. Your bmw would be running with rocks instead of rubber.

John
05-08-2002, 02:54 PM
Very basic hack, but it's brilliant - gives us n00bs a chance to figure out how this stuff works :D

ZiRu$
05-08-2002, 03:21 PM
Originally posted by Lesane
I think that every member from a board likes to contribute on his favorite board by adding quotes. My members loved it to contribute to the forum by adding quotes. Adding quotes of their favorite artist/actor or their own quotes. Why would u take this ability away from them?

In my eyes it's like making a new store hack but then let only admins buy things ;)

lol...i'll stick to lesanes ;)

Lesane
05-08-2002, 06:53 PM
Originally posted by KuraFire
Second of all, your hack lists quotes in two small lines. I totally don't like that, looked ugly as hell, so that was one more reason for me to make my own hack.

I had it on 1 line but members requested it to have it on 2 lines because of the tables became out of range.

Originally posted by KuraFire
Thirdly, this hack will, one day, incorporate a Quotes listing similar to memberlist.php and will be searchable and orderable by letter. Is your quotes table structured for that? (just wondering :))

Ofcourse

Originally posted by KuraFire
Lastly, your hack (last I checked) didn't display the Quoter, only the member who submitted a quote. That's just taking credit away from ALL those people who made the quotes! :(

It displays the quoter.

Lesane
05-08-2002, 06:55 PM
Originally posted by KuraFire
besides, Lesane, why not let your users contribute by donating to The Cause (tm) of your board, eh? ;)

What are you talking about?

KuraFire
05-08-2002, 09:48 PM
money, donations, that green stuff... ;)

you can't counter my first reason, can you? :p ;)

dimitr|
05-08-2002, 11:35 PM
Man, why argue on this? If I want the function of having my users submit quote I choose Lesane's. If I just want just the quote function I use Kura's. Ironically, the reason I went with this one instead was not because my board was too big but too small. Most of my users are not proactive and just swing by to read anything new. I doubt they would really use it, hell the PM function hardly gets used. But already someone commented on how they liked the quotes. :cool:

Boofo
05-08-2002, 11:58 PM
The main reason I want it is because not all quotes added by users are particually that good or different enough to add to the posting. And how do you tell one user that their post is good enough to add and yet tell another user that theirs isn't without causing a lot of hard feelings along the way? This way, it is up to the Admin to post what THEY like and not have to worry about hurting anyone's feelings ot having to justify themselves.

Just my 2 cents worth. :nervous:

Zarith
05-09-2002, 03:18 AM
would it be possible to make links to 1 like graphic text my just putting the html tag inside of what would be the quote?

Floris
05-09-2002, 07:56 AM
Originally posted by dimitr|
Man, why argue on this? If I want the function of having my users submit quote I choose Lesane's. If I just want just the quote function I use Kura's. Ironically, the reason I went with this one instead was not because my board was too big but too small. Most of my users are not proactive and just swing by to read anything new. I doubt they would really use it, hell the PM function hardly gets used. But already someone commented on how they liked the quotes. :cool:

I second that.

KuraFire
05-09-2002, 08:27 AM
Zarith, I'm not quite sure I follow you. What exactly do you want?? :confused:

KuraFire
05-10-2002, 10:15 AM
How to add quotes easily through your Admin Panel
(also known as Hack Update to version 1.0.5 :D)

Step 1: open your admin/index.php and find this line:

makenavselect("Options","<hr>");

Add ABOVE that, this line:

makenavoption("Add quote","quotes.php?action=add","<br />");

Save your admin/index.php and upload the attached quotes.php to your Admin directory (thus, admin/quotes.php is what it should become).

Done. :)

zootsuit
05-10-2002, 09:51 PM
I have Lesane's quote hack on my site and I love it...

...as for the author of the quote not being mentioned, that's BS...it's offered now, and my members LOVE it.

Looks awesome as well...fits in perfectly.

KuraFire
05-10-2002, 09:58 PM
Yes, well, I have the Quotes List hack fully functional now, similar to the member list but for my quotes, and it works like a charm. Does Lesane's hack include that yet? :)

Boofo
05-10-2002, 10:02 PM
Is there any way to add a function to edit the quotes in case I want to add the quoters name to quotes if I don't already have them? And, also it might be nice to be able to edit spelling and things like that if we missed it when entering them and things like that.

I guess I don't get the lettering part of it. I just went through the alphabet when entering them and started back at "a" when I hit 27 quotes. Does that copy over the first one if I reuse the alphabet again?

KuraFire
05-10-2002, 10:05 PM
Boofo, I totally don't get what you mean by the second part... :/

Hmm, edit function... I'll see about adding that before I release the whole thing as the Ultimate Quote Hack. It'll be a bit more difficult but I'll have it done with that UQH release. You'll have to wait a bit for it, though....

Lesane
05-10-2002, 10:07 PM
Yes, well, I have the Quotes List hack fully functional now, similar to the member list but for my quotes, and it works like a charm. Does Lesane's hack include that yet?

Mine don't includes that and it will never include that. Mine will never include any addon u make for your hack. It's not a race or something.

KuraFire
05-10-2002, 10:17 PM
Boofo: btw, you can edit your quotes in phpMyAdmin though, and if you don't have that, it's a Big loss and you should try getting it installed on your webhost cos it makes your vB-management life So much easier. :)

Lesane: I know, but a quotes list is simply an extremely useful feature.
It's not a race indeed, but why did you say "Ofcourse" (above, post #12) in response to my question about your hack having a Quotes list that's sortable, orderable and searchable, if you're now saying you'll never have that?

Boofo
05-10-2002, 10:20 PM
I'm referring to the letters that the quote.php asks for at the bottom of the screen.

Quote
Name
Letter

I entered "a" thru "z" for 26 quotes and then started over at "a" when I hit 27 quotes. What do the letters represent? And do I need to use them for each quote entered?

Boofo
05-10-2002, 10:22 PM
Still, a quote editor in the admin cp would be easier and nicer. :)

Lesane
05-10-2002, 10:26 PM
Originally posted by KuraFire
Lesane: I know, but a quotes list is simply an extremely useful feature.
It's not a race indeed, but why did you say "Ofcourse" (above, post #12) in response to my question about your hack having a Quotes list that's sortable, orderable and searchable, if you're now saying you'll never have that?

The only question you asked me about that is: "Is your quotes table structured for that?" and yes i replied with "yes" on that question. And look:
http://www.lesane-crooks.com/board/userquote.php

And yes i know yours will be different with searchable features blah blah. I ain't telling you that my quote hack already have an editing feature etc etc. So... could u plz stop with finding another comparing with my hack? I'm glad yours is different otherwise this thread was useless!

KuraFire
05-10-2002, 10:27 PM
Boofo: the Letter is for the search index in the upcoming Quote List hack.

Quote:
The optimist thinks that this is the best of all possible worlds, and the pessimist knows it.

Name:
J. Robert Oppenheimer

Letter:
O

(as in, Oppenheimer)

---

Quote:
Woman was God's second mistake.

Name:
Friedrich Nietzsche

Letter:
N


See how it works, now? In the upcoming Quotes List, people can click on a letter (ie. `N`) and it will display all quotes made by people whose last names start with an N. Since you can't index it through the name column (try doing a reg.ex on "Sir General S. Patton" for instance. :p) the Letter column is for the search index.
I am guessing you'll now have to fix 27+ quotes in your database? :)

KuraFire
05-10-2002, 10:34 PM
Boofo: the edit quote feature will be made, but just not _yet_. I can't make that in 10 minutes, my knowledge on vB's structure is far too limited for that, so it'll take time. And since my UQH is pretty much entirely finished, I'm gonna let it coincide with that. Just be patient and use phpMyAdmin for the time being :p

Lesane, that's what I said in the first post already, but then came the people 'attacking' me cos you already made a quote hack. I'm in the defense here, y'know. I can drop the subject easily if other people will stop coming in here going "bah, Lesane already made this, blah blah blah, I'm using Lesane's, blah blah blah". That annoys me, I don't care who uses whose hack, I made this available for people to have a choice and because I was feeling very generous (sharing things of my new board before my board itself is done yet, successfully diminishing the `impressiveness` by a bit...). I just don't like to be talked down for that, I get in my rather hot-tempered debating stance then. :)
(no hard feelings, right? :))

Lesane
05-10-2002, 10:51 PM
Originally posted by KuraFire
Lesane, that's what I said in the first post already, but then came the people 'attacking' me cos you already made a quote hack. I'm in the defense here, y'know. I can drop the subject easily if other people will stop coming in here going "bah, Lesane already made this, blah blah blah, I'm using Lesane's, blah blah blah". That annoys me, I don't care who uses whose hack, I made this available for people to have a choice and because I was feeling very generous (sharing things of my new board before my board itself is done yet, successfully diminishing the `impressiveness` by a bit...). I just don't like to be talked down for that, I get in my rather hot-tempered debating stance then. :)
(no hard feelings, right? :))

I fully understand but i'm not the one that's attacking you and/or your hack so it's not really fair if you attack my hack. Attack those people that attacks you instead of attacking an innocent hacker ;):D

KuraFire
05-10-2002, 10:57 PM
Yeah but those bastards (;)) didn't make any hacks (and if so, I ain't using 'm nor even know about 'm). :p

;)

zootsuit
05-10-2002, 11:02 PM
Call me ethical or something but it seems that Lesane already made the hack and most of us like it...people usually check to see if a hack has already been done so we don't have 8,000 versions of the same hack floating around.

It looked to me like you were trying to 'one up' him while you where replying to your thread...if not, cool...

KuraFire
05-10-2002, 11:12 PM
Call me ethical or something but it seems that Lesane already made the hack and most of us like it...people usually check to see if a hack has already been done so we don't have 8,000 versions of the same hack floating around.

Thank you CAPTAIN OBVIOUS. That was said only 5 times already, we really needed to be told about it again. :rolleyes:

Seriously, you deserved this slander, my first post already says that I know Lesane made a quote hack, and it also says that this one is different and therefore will appear to a different audience. Also, this hack will soon be joined up with a much bigger, comprehensive hack that has features Lesane's doesn't have (because he doesn't want them, and I needed it for my own board so... :)) so people will have even more options to choose from, pretty soon. It's totally not "the same hack" - there's several very distinct, different features. And our hacks combined provide the vB-community with a whole set of options, successfully making sure that if they want SOME sort of quote hack, they will be able to get it, easily. :)

zootsuit
05-10-2002, 11:14 PM
Calm down, Mr. Ad Hominem...I was just clarifying myself.

Lesane
05-10-2002, 11:23 PM
Originally posted by KuraFire


Thank you CAPTAIN OBVIOUS. That was said only 5 times already, we really needed to be told about it again. :rolleyes:

Seriously, you deserved this slander, my first post already says that I know Lesane made a quote hack, and it also says that this one is different and therefore will appear to a different audience. Also, this hack will soon be joined up with a much bigger, comprehensive hack that has features Lesane's doesn't have (because he doesn't want them, and I needed it for my own board so... :)) so people will have even more options to choose from, pretty soon. It's totally not "the same hack" - there's several very distinct, different features. And our hacks combined provide the vB-community with a whole set of options, successfully making sure that if they want SOME sort of quote hack, they will be able to get it, easily. :)

This post is good, now u attack that person instead of mine hack. Thumbs up. j/p ;):D

Boofo
05-10-2002, 11:23 PM
Kurafire,

You are right, it looks as though I will have to do some editing somehow. :-) What do I do for the quotes who don't have a quoter (because I'm not sure who originally said them)? How would I index those?

Let em see if I get this right...I only need to use letters if I am going to index them, right? If I enter them without letters, they will display randomly and just fine? Am I close? :)

KuraFire
05-10-2002, 11:30 PM
Boofo: if you don't know who said a certain quote, use

Unknown

as the name, and

U

as the letter.
(and later on, if you find out who said the quote, you edit it again :))

And no, if you don't enter a Letter, those quotes won't be listed at all in the letter-specific index, in the Quotes List hack. They will only display in your header (or wherever you've placed them) and in the Quotes List when searching, or looking at it in default view. But not when browsing the list through letters, so you really ought to set a Letter entry for EVERY quote in your database.

Consistency is the key to success :)

Boofo
05-11-2002, 12:14 AM
Ok, I understand now. But I CAN use the same letter over and over for different quotes right? It will just index those quotes under that letter, right? (E-gad, I think I might be catching on. DOH!!!) :)

I have been putting a letter in for each quote. I've just been doing it with the first letter the quote started with is all. And thanks for a great hack! Exactly what I was looking for. :)

KuraFire
05-11-2002, 09:33 AM
Yes, you're supposed to use the same Letters many times. 5 quotes by Nietzsche should all have the letter N, two quotes by Ambrose Bierce should both have the letter B. And so forth and so forth.. :)

Glad you like it. :)

Sketch
05-13-2002, 12:53 PM
Kura, I don't find an issue with you creating this hack (even if I did the same one before you! ;)). Lesane's is a beautiful hack for those wanting to empower their users to contribute in such a fashion. Others, like yourself and me and others, have other reasons to use the methods we have used. I, for one, am secure in my use of my quote hack over Lesane's that when the attacks came, as they did for you, I just ignored them and carried on with what I'm doing. Kudo's to those who understand that there is more than one way to skin a cat and if it works for you - great! If Lesane's works for you - great!

Thanks for the contribution and let's see some more hacks. :)

Sketch

KuraFire
05-20-2002, 04:09 PM
Thx Sketch. :)


Okay, I finished the edit & delete functions for the Admin Panel (man, that was 4,3 KB of a now 5 KB quotes.php file!). If anyone wants them before I release it with the Quotes List hack (in a 'package'), contact me by mail or PM.


Also, is anyone interested in me adding support for users to add their quotes and have them under moderation, like Lesane's? (but without the weird complexity of Lesane's hack (I looked at the files, eww) and with the benefit of users not likely to submit a quote that already exists in your database)

If there is a desire for such an add-on ('s really easy, but I'll keep it as an add-on, don't feel like making it an option in the AP > vBulletin Options page) let me know, and I'll write it. I probably will, anyhow, for my own board, but it won't be default in the hack!

Mathiau
06-24-2002, 11:08 PM
haha

had the wrong global..lol!!

Mathiau
06-25-2002, 01:03 AM
Installed and working GREAT!

but i need to find a nice place to put it in the header..lol :)

KuraFire
06-25-2002, 06:22 PM
you should really check out

https://vborg.vbsupport.ru/showthread.php?s=&threadid=38906

instead, Mat. :)

Mathiau
06-28-2002, 10:35 PM
Originally posted by KuraFire
you should really check out

https://vborg.vbsupport.ru/showthread.php?s=&threadid=38906

instead, Mat. :)

am checking it out now, and i found a place for my quotes, i put it in a table at the top:

https://vborg.vbsupport.ru/

and no i am not keeping my log like that :D

CdaKnight
07-22-2002, 02:34 PM
Well I had a quesiton for KuraFire, or anybody else who wants to answer... how would I make the Admin panel extension of this hack (Which is -not- obsolete in my opinion, this is exactly what we were looking for) continually update row id 1 instead of creating a new row every time, and having it randomly choose it? WE have a weekly saying, and we're only doing it one row to keep it the same.

Help is apreciated!

KuraFire
07-22-2002, 06:50 PM
Erm, how would you want to randomly choose from something that is just 1 row?

I'm having a hard time what exactly you want - if you have only 1 quote that you change weekly, isn't it easier to just toss that in a template and change that, weekly? Cos using a whole quotes system for just 1 quote seems kinda silly, to me...
And if you want multiple quotes, then why do you want to only use the first row???

CdaKnight
07-22-2002, 10:00 PM
I used your quote hack, because it's easier for me. I don't really understand the templating system well enough to create templates, nor do I know enough about php/mysql. I know bits and pieces for this kind of stuff.

My main question, is how do I change your admin panel extension to update the same row, over and over again, instead of creating a new quote everytime? (Instead of making new rows, over write the old one every time)

Still looking for help,
Chris

nnjj.net
02-02-2003, 03:47 PM
hi
I installed the hack and it's great
but how I can modify the Quote from CP. there is only adding !

thanx

KuraFire
02-03-2003, 07:50 AM
nnj.net: use my Ultimate Quote Hack instead. See my sig for the link

nnjj.net
02-03-2003, 03:02 PM
thanx buddy I'll try to do it :)