inciarco |
01-25-2009 04:49 AM |
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.
:)
|