Member Log In
Site Navigation
Latest Modifications
- [vB 3.8.4] THX - Hack for VB. 3.8.4
By: bluedog - [vB 3.8.4] Cyb - Chatbox V.2.3
By: bluedog - [vB 4.0.x] PHPKD - Advanced Quick...
By: PHPKD - [vB 3.6.x] StopSpam
By: flappi282 - [vB 3.8.x] vBulletin Chat Addon for...
By: 123flashchat
Latest Template Mods
- [vB 4.0.x] Remove My Profile Link...
By: Ak Worm - [vB 3.8.x] Images DownloadBox...
By: cRs!MP - [vB 3.8.x] Adviertise Mod On Forum...
By: MG4 - [vB 3.8.4] Images PassWordBox...
By: cRs!MP - [vB 3.8.4] Footer Follow Ups
By: Ak Worm
Latest Styles
- [vB 4.0.x] 4.0.3 - VB4STYLE-TWEETA...
By: Belon - [vB 4.0.x] [4.0.3] vbdesigns.de...
By: Belon - [vB 3.8.4] CompletevB - Skylight
By: DreadKnight - [vB 3.8.3] [vB 3.8.4] Barcelona...
By: hoiquantinhoc.com - [vB 3.8.3] Natures Walk by vBSkin...
By: Chri5
Latest Graphics
- [vB ] [anim.]Team Ranks
By: cRs!MP - [vB ] Abstract Circles (3...
By: cRs!MP - [vB ] PlayStation Rank Images
By: cRs!MP - [vB 3.6.12] Heavy Stroked Button...
By: Shelley - [vB ] Minature Ranks.
By: Shelley
vBulletin Modifications »
General vBulletin Section »
vBulletin Modification Tutorials »
[How To] Create forum counters
![]() |
| | #1 |
| |
Status: Offline As requested by lasto. In this example I'll show you how to add a new counter, that you can enable for forums, to count new threads started in there by a member. Everywhere where I use the word Jokes you can replace it with what you want to call it! Run these query's: Code: $db->query_write("ALTER TABLE " . TABLE_PREFIX . "user ADD (jokes VARCHAR(250) NOT NULL DEFAULT '')");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "forum ADD (enable_jokes_counter VARCHAR(250) NOT NULL DEFAULT '')");
Code: print_table_header('Forum Counters');
print_yes_no_row("Enable jokes counter?", 'forum[enable_jokes_counter]', $forum['enable_jokes_counter']);
Code: $this->validfields['enable_jokes_counter'] = array(TYPE_STR, REQ_NO); Code: $usrname = $vbulletin->userinfo['username'];
if($foruminfo['enable_jokes_counter']){
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET jokes = jokes + 1 WHERE username = '$usrname'");
}
Code: print_table_header('Forum Counters');
print_input_row("Jokes", 'user[jokes]', $user['jokes']);
Code: $this->validfields['jokes'] = array(TYPE_STR, REQ_NO); Find: Code: <div> $vbphrase[posts]: $post[posts] </div> Code: <div> Jokes: $post[jokes] </div> Hope it worked for you, if not? Feel free to ask |
|
| | #2 | |||||||||
Location: Anaheim Age: 22 ![]() |
Status: Offline works great, keep up the good work Support will only be offered through forums Michael Biddle / vBHackers.comvBSEO 3.3.0 Gold Released with New "Virtual HTML Display" Feature Available for download now vBSEO Google Sitemap Generator - Version 2.5 Released Crawlability Network: vBulletin SEO | vBulletin Hackers | |||||||||
|
| | #3 | ||||||||
| Coder
![]() |
Status: Offline what can i say m9 Thank you. Believe me i really needed this and what with being on the new vbull throught it would`nt happen.Really appreciate your time on this Niels. Last edited by lasto; 05-17-2006 at 08:07 AM. | ||||||||
|
| | #4 | ||||||||
| Coder
![]() |
Status: Offline An error occurred while attempting to execute your query. The following information was returned. error number: 1064 error desc: 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 '$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user ADD (jok Going though phpmyadmin gives me this error ERROR: Unknown Punctuation String @ 4 STR: -> SQL: $db->query_write("ALTER TABLE " . TABLE_PREFIX . "user ADD (jokes VARCHAR(250) NOT NULL DEFAULT '')") Last edited by lasto; 05-17-2006 at 08:10 AM. | ||||||||
|
| | #5 |
| |
Status: Offline You're supposed to run the queries in a PHP script, not in phpmyadmin :p |
|
| | #6 | ||||||||
| Coder
![]() |
Status: Offline run the queries in a script ??? How anytime i have to run queries i run em through the admin option of Run Query - but cause it failed i ran em directly though PHPmyadmin. So basically i just add the queires above to Index.php and they will be called when the main index page is called is that correct or showthread.php cause thats where they will be seen ?? | ||||||||
|
| | #7 | ||||||||
| vB Newbie
![]() |
Status: Offline This is EXACTLY what I have been looking for but I am stuck on the query bit just like Lasto. How do you run a PHP script with query? Thank you for your contribution and help. | ||||||||
|
| | #8 | ||||||||
| Coder
![]() |
Status: Offline ok suzzed it and it works nice one m8 These plugins are really new to me - ive done it and it all works but i was used to actually hacking the php files - well easier this way ![]() is there anyway i cna set it to auto update for the threads that are already made in that section as its only counting any new ones that are made. Also i would really like an updater cause any threads i delete still leave the counter adding one. I dont mind running the script to update the stats manually say once per week so if u can help id be well happy with this hack. Last edited by lasto; 05-17-2006 at 03:03 PM. | ||||||||
|
| | #9 | |||||||||
| Coder
![]() |
Status: Offline Quote:
all i did was copy the query to a txt file and saved it in the exstension .php test.php then i uploaded it to the forums and ran it - so the tables where added then i deleted the test.php so the tables were not re-added (safe purpose) then just do the rest in admincp | |||||||||
|
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [How To] Run vBulletin On your P.C. | Ken Iovino | vBulletin Modification Tutorials | 83 | 11-02-2009 05:16 AM |
| [How To] Run a Query | Ken Iovino | vBulletin Modification Tutorials | 9 | 07-30-2008 05:29 AM |
| [How to] Add navigation groups to your admincp left panel | Ken Iovino | vBulletin Modification Tutorials | 11 | 07-16-2007 02:59 AM |
| [How To] Add Options per forum | Ken Iovino | vBulletin Modification Tutorials | 10 | 03-03-2007 06:25 PM |
| [How To] Run a vb page outside of the forum directory | Junior | vBulletin Modification Tutorials | 7 | 01-10-2007 10:05 PM |
All times are GMT. The time now is 06:17 AM.
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.















Hope it worked for you, if not? Feel free to ask 










