Follow vBSEO on Twitter
vBulletin Modifications
  • Forums
  • Add-Ons
  • Template Modifications
  • Styles
  • Graphics
  • Tutorials
  • Support Center
  • Register
  • vBulletin SEO

Member Log In

Site Navigation

  • Register
  • Members List
  • Social Groups
  • Search
  • Today's Posts
  • Mark Forums Read

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
Reply
Page 1 of 6 1 23 > Last »

 

  • Thread Tools
Old 05-17-2006, 06:23 AM   #1
Niels
Advanced Coder

Niels's Avatar

Activity Longevity
0/20 20/20
Today Posts
0/3 ssssss934
Location: NL
Age: 21
Niels is on a distinguished road
Status: Offline Default [How To] Create forum counters
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 '')");
Add a new plugin (hook: forumadmin_edit_form):
Code:
print_table_header('Forum Counters');
print_yes_no_row("Enable jokes counter?", 'forum[enable_jokes_counter]', $forum['enable_jokes_counter']);
Add a new plugin (hook: forumdata_start):
Code:
$this->validfields['enable_jokes_counter'] = array(TYPE_STR, REQ_NO);
Add a new plugin (hook: newthread_post_complete):
Code:
$usrname = $vbulletin->userinfo['username'];
if($foruminfo['enable_jokes_counter']){
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET jokes = jokes + 1 WHERE username = '$usrname'");
}
Add a new plugin (hook: useradmin_edit_column1):
Code:
print_table_header('Forum Counters');
print_input_row("Jokes", 'user[jokes]', $user['jokes']);
Add a new plugin (hook:userdata_start):
Code:
$this->validfields['jokes'] = array(TYPE_STR, REQ_NO);
Edit template postbit and postbit_legacy.
Find:
Code:
<div>
	$vbphrase[posts]: $post[posts]
</div>
Add under:
Code:
<div>
	Jokes: $post[jokes]
</div>
That's it Hope it worked for you, if not? Feel free to ask
Reply With Quote
Old 05-17-2006, 06:59 AM   #2
Michael Biddle
Staff
Michael Biddle's Avatar

Activity Longevity
1/20 18/20
Today Posts
0/3 sssss2818
Location: Anaheim
Age: 22
Michael Biddle is on a distinguished road
Status: Offline Default
works great, keep up the good work
Support will only be offered through forums
Michael Biddle / vBHackers.com
vBSEO 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
Reply With Quote
Old 05-17-2006, 07:42 AM   #3
lasto
Coder

Activity Longevity
0/20 20/20
Today Posts
0/3 ssssss164
lasto is on a distinguished road
Status: Offline Default
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.
Reply With Quote
Old 05-17-2006, 08:07 AM   #4
lasto
Coder

Activity Longevity
0/20 20/20
Today Posts
0/3 ssssss164
lasto is on a distinguished road
Status: Offline Default
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.
Reply With Quote
Old 05-17-2006, 11:37 AM   #5
Arnoud
vBulletin Guru

Arnoud's Avatar

Activity Longevity
0/20 18/20
Today Posts
0/3 sssss3129
Location: Europe, Flanders
Arnoud is on a distinguished road
Send a message via MSN to Arnoud Send a message via Yahoo to Arnoud
Status: Offline Default
You're supposed to run the queries in a PHP script, not in phpmyadmin :p
Reply With Quote
Old 05-17-2006, 01:16 PM   #6
lasto
Coder

Activity Longevity
0/20 20/20
Today Posts
0/3 ssssss164
lasto is on a distinguished road
Status: Offline Default
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 ??
Reply With Quote
Old 05-17-2006, 02:52 PM   #7
Tycoon
vB Newbie

Activity Longevity
0/20 14/20
Today Posts
0/3 sssssss12
Tycoon is on a distinguished road
Status: Offline Default
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.
Reply With Quote
Old 05-17-2006, 02:58 PM   #8
lasto
Coder

Activity Longevity
0/20 20/20
Today Posts
0/3 ssssss164
lasto is on a distinguished road
Status: Offline Default
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.
Reply With Quote
Old 05-17-2006, 02:59 PM   #9
lasto
Coder

Activity Longevity
0/20 20/20
Today Posts
0/3 ssssss164
lasto is on a distinguished road
Status: Offline Default
Quote:
Originally Posted by Tycoon
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.
lo m8

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
Reply With Quote
Old 05-17-2006, 03:00 PM   #10
Tycoon
vB Newbie

Activity Longevity
0/20 14/20
Today Posts
0/3 sssssss12
Tycoon is on a distinguished road
Status: Offline Default
Lasto: Can you tell me how you achieved it? I am still. Thanks.

[EDIT:OOP, you were quicker :P. Thanks Lasto!]
Reply With Quote

Reply
Page 1 of 6 1 23 > Last »

« Sell Fresh Stuffs To All Valid Customers......Never Give Tester Here!!!!!!! | - »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Rules

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.
Transverse Styles
  • Top
  • Archive
  • vBSEO
  • Contact Us
LinkBack
LinkBack URL LinkBack URL
About LinkBacks About LinkBacks
Bookmark & Share
Digg this Thread! Digg this Thread!
Add Thread to del.icio.us Add Thread to del.icio.us
Bookmark in Technorati Bookmark in Technorati
Furl this Thread! Furl this Thread!