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)
-   -   HITCounter - Link Forum Counter (https://vborg.vbsupport.ru/showthread.php?t=93640)

b6gm6n 08-04-2005 10:00 PM

HITCounter - Link Forum Counter
 
This is a port originally By Zajako and Mone.

With kind permission i've updated the mod for vBulletin 3.5, this version comes with an enhancement, i.e via your ACP (forum manager) you can adjust the starting value for any counter.

Installation is done easily via the importing of an xml file.

See screenshots!

Enjoy!

Update : Huge Respect to KirbyDE who really is the genius behind this mod, cheers dude.

Update 1.3 : optimized code - (no more updates to totals) - Thanx KirbyDE

If you use this mod please click Install - cheers!

Boofo 08-05-2005 12:28 AM

Can't you do the file edit via a plug-in?

b6gm6n 08-05-2005 12:37 AM

Quote:

Originally Posted by Boofo
Can't you do the file edit via a plug-in?

would be nice yeah... but how does one edit the forum home template on the fly via a plugin..? - stumped me for now anyways... :)

-b6

Boofo 08-05-2005 12:51 AM

Quote:

Originally Posted by b6gm6n
would be nice yeah... but how does one edit the forum home template on the fly via a plugin..? - stumped me for now anyways... :)

-b6

Oh, template edit. I thought it was a file edit. My mistake, sorry. ;)

Shouldn't this be in plug-ins then?

b6gm6n 08-05-2005 12:59 AM

No need to be sorry your right, there is a file edit in three places within "functions_forumlist.php", everything else gets automagically installed via the xml file settings, template, queries etc...

The file edit merges the new 'linkhits' template into the forum home display, maybe the next version will be free of file edits... which would be great!

-b6

Boofo 08-05-2005 01:01 AM

There should be some hooks you can use for the file edits, though, shouldn't there?

Andreas 08-05-2005 01:39 AM

The Template is not the Problem, can be done with a Plugin.

Hook: forumbit_display
PHP Code:

if ($forum['link'])
{
    
$forum['replycount'] = '';
    
$forum['threadcount'] = '';
    eval(
'$forum[\'lastpostinfo\']  = "' fetch_template('linkhits') . '";');


This kicks off 1 File edit.

However, getting the count doesn't seem to be possible without the File edit.
The other Option would be to use a Query. But this would add 1 Query to Forumhome and every forumdisplay.php call where the Forum being displayed contains sub-forums that are links.
Or the Forumcache would have to be rebuild upon every Hit, which is even worse IMHO.

However, some furhter suggestions:

Your Counter-Update seems to be run every Time smth. is being done in ACP?
I'd suggest to get rid of the Settings and the admin_global Plugin.
Instead, make a new control in Forum Manager that shows the current Value so the User can just input it's own.

Hook: forumdata_start
PHP Code:

$this->validfields['linkhits'] = array(TYPE_UINTREQ_NO); 

Hook: forumadmin_edit_form
PHP Code:

if (trim($forum['link'] != ''))
{
    
$check $db->query_first("SELECT linkhits FROM " TABLE_PREFIX "forum WHERE forumid = $forum[forumid]");
    
print_table_header('Forum Link Hit Counter');
    
print_input_row('Hit Counter Value<dfn>Here you can manually adjust the Hit-Counter for this Forum-Link</dfn>''forum[linkhits]'$check['linkhits']);


The check-query isn't ideal, but necessary as the Forum Manager displays cached Data

Don't execute the Update in Global-Start, as this causes 1 additional Query for every Forum being displayed, no matter if it is a Link or not.

Hook: header_redirect
PHP Code:

global $foruminfo;
if (
trim($foruminfo['link']) != '')
{
    
$vbulletin->db->query("UPDATE " TABLE_PREFIX "forum SET linkhits = linkhits +1 WHERE forumid=$foruminfo[forumid]");


You should also cache the Template on forumdisplay, as it might be shown here too.

Hook: cache_templates
PHP Code:

if (THIS_SCRIPT == 'index' OR THIS_SCRIPT == 'forumdisplay')
{
    
$globaltemplates  array_merge($globaltemplates, array('linkhits'));



b6gm6n 08-05-2005 02:05 AM

Thanx KirbyDE, i'll look into this...cheers

-b6

Boofo 08-05-2005 02:26 AM

There you go! I knew Kirby would be able to help. ;)

FleaBag 08-05-2005 10:58 AM

b6gm6n - is the username Kingpin related?


All times are GMT. The time now is 09:51 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.01679 seconds
  • Memory Usage 1,753KB
  • 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
  • (5)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete