View Full Version : Subscription Expiry Notification on Forumhome
Hack Name: Subscription Expiry Notification on Forumhome
Hack Version: 2.1
Hack Author: Kall
Release: 20 April 2005
Description: Shows date of Subscription Expiry (and days remaining) on Forumhome to members with Active Subscriptions.
Requested by: Mike Warner.
Thanks to: MarcoH64 (big thanks to Marco), Mike Warner and The_Realist for help on day one ironing out the bugs.
Files modified: 1 (root/index.php)
Templates Modified: 1 (FORUMHOME)
New templates: 1 (forumhome_nzb_exprydatebit)
By default, this will show to people with under 30 days remaining on their Subscription and the next 5 subscriptions to expire.
To change the days, change the 30 at the start of the last PHP edit to the number of days you want to show in advance.
To change the number, change the 5 at the end of the sql query.
This is my first hack that includes either a joining of tables or a new template or a template that can be called more than once, so I apologise in advance if a string of runaway queries turns your server into swiss cheese. :)
New features in v2.1: Optimised query to only be run for non-guests and tidied up a lot. (thanks to Marco). To upgrade, simply replace the final index.php edit with the one inside the new .txt file.
Updates - Fixed query thanks to MarcoH64.
Extended message thanks to The_Realist.
Tidied message up, XHTML-wise and gave it a nice little box.
v2.0 Released. Thanks to MarcoH64 for shaming me into making it a bit more functional with his first post.
Marco van Herwaarden
04-19-2005, 12:29 PM
Sorry but if i look at your code, i think you are missing some things:
- If someone have no subscription, it will show a negative days remaining and an end date of 1-1-1970
- If someone have more then 1 subscription, it will only show info for 1 (and this don't need to be the oldest)
- It also runs for guests.
MikeWarner
04-19-2005, 01:10 PM
Thanks for this kall! I'll throw in a few conditionals and it will run perfectly!! :D
The Realist
04-19-2005, 04:46 PM
There needs a few changes to make this code work better, as it is it gives minus info to none subscribed members.
As an example:
Your Subscription Expires on 01-01-1970. You have -12892.74 days Remaining.
Click here to renew.
Laters
Marco van Herwaarden
04-19-2005, 07:23 PM
That is what i described in my first reply Brian.
The Realist
04-19-2005, 07:40 PM
Hi Kall,
Yeh I know but Im hoping the echo would reach the developer faster :)
No harm done.
Laters M8
Sorry but if i look at your code, i think you are missing some things:
- If someone have no subscription, it will show a negative days remaining and an end date of 1-1-1970
- If someone have more then 1 subscription, it will only show info for 1 (and this don't need to be the oldest)
- It also runs for guests.
d'oh!
OK, this should work better:
<if condition="$remaining < 20 AND $expirydate != '1-Jan-1970' AND $bbuserinfo[userid] != '0'"><div align="center">Your Subscription Expires on $expirydate. You have $remaining days Remaining.<br />Click <a href="$vboptions[bburl]/subscriptions.php" title="Renew Subscription">here</a> to renew.</div></if>
*uploads new install file*
The Realist
04-19-2005, 08:27 PM
Tested but it still says for none subscribed members:
Your Subscription Expires on 01-01-1970. You have -12892.89 days Remaining.
Click here to renew.
d'oh!
OK, this should work better:
<if condition="$remaining < 20 AND $expirydate != '1-Jan-1970' AND $bbuserinfo[userid] != '0'"><div align="center">Your Subscription Expires on $expirydate. You have $remaining days Remaining.<br />Click <a href="$vboptions[bburl]/subscriptions.php" title="Renew Subscription">here</a> to renew.</div></if>
*uploads new install file*
Marco van Herwaarden
04-19-2005, 08:27 PM
That would be a way. Multiple subscriptions would still not show.
Oh bugger. It's because of the way we are displaying our dates.
Err...
<if condition="$remaining > 0 AND $remaining < 20 AND $bbuserinfo[userid] != '0'">
How's that?
The Realist
04-19-2005, 09:17 PM
Yep works perfect :)
Oh bugger. It's because of the way we are displaying our dates.
Err...
<if condition="$remaining > 0 AND $remaining < 20 AND $bbuserinfo[userid] != '0'">
How's that?
The Realist
04-19-2005, 09:35 PM
Works great M8 and does what it says on the bottle :)
Edited mine a bit to:
<if condition="$remaining > 0 AND $remaining < 90 AND $bbuserinfo[userid] != '0'">
<div align="center"><font color="#FF0000">$bbuserinfo[username]!</font> Your Subscription
Here Expires On The <font color="#FF0000">$expirydate</font>. You Have $remaining
Days Remaining.<br />Please Click <a href="$vboptions[bburl]/subscriptions.php" title="Renew Subscription">here</a>
And Renew Your Subscription And Continue Your Support Of YOUR FORUMS NAME Forums.</div></if>
Clicks install :)
Sweet!
Nice message....I'll stick that in the install. :)
The Realist
04-19-2005, 10:07 PM
Well thank you. :)
Well thank you. :)
And with a bit of tidying, it's XHTML compliant. :)
MikeGK
04-20-2005, 09:27 AM
can this be done in user's profile as well? thank you
Probably.
It could probably be done on every page, by using the query in php_include_start..
Optimised version will be out later today, thanks to the help of MarcoH64. :)
MikeWarner
05-06-2005, 03:31 PM
Good job with the update.
I want to show this just below the bit that says "You last visited: Today at xx:xx". I can handle the template changes no problem, but the hack is designed to only show on the forumhome (index.php). How would I make it so that it showed on all pages? Do I need to change global.php - if so, how?
Many thanks.
2.1 Update out today.
(Sorry, I don't know about putting it in global.php ... it might work...)
LloydSev
06-01-2005, 10:27 AM
Works like an absolute charm for me. Thanks very much.
oldfan
08-26-2005, 04:20 AM
Will this work with people who were added to Subscription, meaning didn't pay?
edit:
It only works with PAID subscriptions, not added ones.
INSTALLED and thanks
MB Dreamz
08-29-2005, 12:29 AM
Works great. Thanks for the hack.
dgallek
10-11-2005, 03:53 PM
thanks for your reply
PVO_Dave
10-27-2005, 09:14 AM
*BUMP* Any news on this working for VB 3.5?
PVO_Dave
10-27-2005, 10:59 AM
Just tested this, and got no errors, but nothing happened either?!
lordofgun
02-12-2006, 07:35 PM
A 3.5 port would be great!
lordofgun
02-12-2006, 07:36 PM
Or a PM notification would be good too!
Can this be ported for Version 3.6.8? The current version does not work with Version 3.6.8.
SVTCobraLTD
08-05-2008, 05:50 PM
Any updates on this?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.