Thread: Profile Enhancements - Countdown Timer in signature
View Single Post
  #109  
Old 01-25-2009, 04:49 AM
inciarco's Avatar
inciarco inciarco is offline
 
Join Date: Mar 2007
Posts: 758
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This Mod Can be Used as a Reminder for an Event of the User.


I'd Like to Share the Inclusion of the CountDown on the User Profile (If Someone knows a Better Way to do This would be Nice to Share it. ):


Step 1: Edit File plugins_usercountd.php and after that Upload it on the "includes" Folder, Overwriting the Existing File, (the one you Uploaded when Installed this Mod).

Include at the end of the File, before the Code ?> the Following Code:

Code:
// ********************************************************************** \\

if ( $THIS_HOOK == "member_profileblock_fetch_unwrapped" )
{
    $cdfield = "field" . $vbulletin->options["countdownfield"];
    $query = $vbulletin->db->query_read( "SELECT $cdfield FROM " . TABLE_PREFIX . "userfield WHERE userid='" . $userinfo["userid"] . "';" );
    $result = mysql_fetch_array( $query );
  
    $cddata = unserialize( str_replace( """, '"', $result[$cdfield] ) );
  
    if ( $cddata["enabled"] == "Yes" )
	{

	  require_once( "./includes/class_bbcode.php" );
	  require_once( "./includes/functions_newpost.php" );
	  $vbulletin->cdbbcode_parse =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
	  
	  $eta = mktime ( intval( $cddata["hour"] ), intval( $cddata["minute"] ), 0, intval( $cddata["month"] ), intval( $cddata["day"] ), intval( $cddata["year"] ) );
	  $tremain = $eta - time();
	  if ( $tremain > 0 )
	  {
	    $t = $tremain;
	    $remain["days"] = intval ( $t / 86400 );
		$t = $t - ( $remain["days"] * 86400 );
		$remain["hours"] = intval ( $t / 3600 );
		$t = $t - ( $remain["hours"] * 3600 );
		$remain["minutes"] = intval ( $t / 60 );
		
		$counter = $remain["minutes"] . $vbphrase["countdown_minutes"];
		
		if ( ( $remain["hours"] != 0 ) OR ( $remain["days"] != 0 ) )
		{
		  $counter = $remain["hours"] . $vbphrase["countdown_hours"] . " " . $counter;
		}
		
		if ( $remain["days"] != 0 )
		{
		  $counter = $remain["days"] . $vbphrase["countdown_days"] . " " . $counter;
		}
	  } else {
	    $counter = $vbulletin->cdbbcode_parse->parse(convert_url_to_bbcode($cddata["overmsg"]), 'nonforum');
	  }
	  $event = $vbulletin->cdbbcode_parse->parse(convert_url_to_bbcode($cddata["event"]), 'nonforum');
	  
	}
}

Step 2: Create Plugin.

On Admin Control Panel (ACP) -> Plugins and Products -> Add New Plugin

Product: vBulletin
Hook Location: member_profileblock_fetch_unwrapped
Title: User CountDown - Block Statistics
Execution Order: 5
Plugin is Active: Yes
Plugin PHP Code:

Code:
$THIS_HOOK = "member_profileblock_fetch_unwrapped";

require( "./includes/plugins_usercountd.php" );
Click the "Save" Button to Save New Plugin.


Step 3: Edit Template "memberinfo_block_statistics"

Find at the End of the Template

$template_hook[profile_stats_last]

Before that Add:

Code:
<!-- Start User Countdown memberinfo_block_statistics -->

<if condition="$counter">

<fieldset class="fieldset">
<legend>$vbphrase[countdown_title]</legend>

<strong>$vbphrase[countdown_counting_down_to]:</strong> $event <br />
<em>$counter</em>

</fieldset>

</if>

<!-- End User Countdown memberinfo_block_statistics -->
Step 4: ENJOY! That's It


My Best Regards.

Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01368 seconds
  • Memory Usage 1,784KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete