Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Event Views Counter Details »»
Event Views Counter
Version: 1.00, by robert_2004 robert_2004 is offline
Developer Last Online: Aug 2008 Show Printable Version Email this Page

Version: 3.5.4 Rating:
Released: 09-03-2006 Last Update: Never Installs: 3
DB Changes Template Edits
Code Changes  
No support by the author.

This addon allows you to display the number of hits/views a calendar event has received.
It also inserts the eventid into the user's session, so they cannot refresh multiple times to boost the view count.

Thanks to tnguy3n with his post here

STEP 1 - MySQL modification:
Code:
ALTER TABLE event ADD hits INT(7) NOT NULL;
STEP 2 - calendar.php
FIND [line 134]
PHP Code:
($hook vBulletinHook::fetch_hook('calendar_start')) ? eval($hook) : false;

if (
$vbulletin->GPC['week'])
{
    
$_REQUEST['do'] = 'displayweek';

BELOW, ADD:
PHP Code:
// Event Views Counter - by Robert_2004
// https://vborg.vbsupport.ru/showthread.php?t=1067471

    /*
     * Comparision done between the host info in the session object.
     * If the eventid is not stored in the session, that means the 
     * event hasn't been visited and therefore add it as a hit 
     * and update the table.
      */

$_SESSION['eventidsvisited'] = isset($_SESSION['eventidsvisited'])?$_SESSION['eventidsvisited']:array();
$eventids_exists array_search($vbulletin->GPC['eventid'], $_SESSION['eventidsvisited']);

if ( 
$eventids_exists == 0) {
    
$_SESSION['eventidsvisited'][] = $vbulletin->GPC['eventid'];
    
$db->query_write("
             UPDATE " 
TABLE_PREFIX "event 
              SET hits=hits+1
              WHERE eventid=" 
$vbulletin->GPC['eventid']);          

Save and upload.


STEP 3 - template modification
edit template "calendar_showeventsbit"

FIND:
Code:
    </td>
</tr>
</table>

</form>

</div>
$spacer_close
BEFORE THIS, ADD:
Code:
    </td>
</tr>
<tr>
    <td>
    <!-- // Event Views Counter - by Robert_2004 -->
    <!-- // https://vborg.vbsupport.ru/showthread.php?t=1067471 -->
    <strong>Viewed</strong>: $eventinfo[hits] times
so it should look like:
Code:
    </td>
</tr>
<tr>
    <td>
    <strong>Viewed</strong>: $eventinfo[hits] times    
    </td>
</tr>
</table>

</form>

</div>
$spacer_close
and that *should* be everything - i can't think of anything else that was needed.

if you use - please click INSTALL

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 09-04-2006, 10:41 AM
hugh_ hugh_ is offline
 
Join Date: Mar 2005
Location: Netherlands
Posts: 368
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can we see a screenshot or example?

Thanks...

hugh
Reply With Quote
  #3  
Old 09-05-2006, 03:13 AM
robert_2004 robert_2004 is offline
 
Join Date: Sep 2004
Posts: 126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

screenshot added to orginal post.
It doesn't help much - as my event listing template is modified a great deal.
Reply With Quote
  #4  
Old 09-06-2006, 06:17 AM
finn snor finn snor is offline
 
Join Date: Jan 2006
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great have been looking for this for a long time..Can it be made conditional so only admin can see views ?
Reply With Quote
  #5  
Old 09-06-2006, 04:08 PM
robert_2004 robert_2004 is offline
 
Join Date: Sep 2004
Posts: 126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, to only allow certain usergroups, use the following code:

usergroups 6 and 5 are admin and super moderators, respectively.


Code:
<if condition="is_member_of($bbuserinfo, 6, 5) OR $show['admincplink']">
<tr>
	<td>
	<strong>Viewed</strong>: $eventinfo[hits] times	
	</td>
</tr>
</if>
Reply With Quote
  #6  
Old 11-26-2013, 03:06 AM
snowname snowname is offline
 
Join Date: Oct 2008
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The database function works on 4.1.3.
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 10:42 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03699 seconds
  • Memory Usage 2,258KB
  • Queries Executed 19 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (5)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete