If like me, you want a banner to be displayed to people who have a paid subscription which is about to expire, you can achieve it with the following.
(Please note I am not a PHP coder and haven't written a vB Plugin before so if someone more knowledgeable could check the following for me I would be most grateful.)
Firstly create a global phrase named "welcome_soontoexpire" containing the message you want displayed. I chose the following...
Code:
<center><strong>Your Club Membership will expire in {1} days.</strong><br /><br />We hope you will choose to stay with us!</center>
...which will tell them their paid subscription is about to run out, plus it will tell them the number of days they have left.
Next edit the "welcome_headers" template and add...
Code:
<if condition="$headerexpiremembership != 0">
<!-- / membership nearly expired -->
<br />
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="alt1" style="background-color:#FF0000;">
<phrase 1="$headerexpiremembership">$vbphrase[welcome_soontoexpire]</phrase>
</td>
</tr>
</table>
<!-- / membership nearly expired -->
<else />
...before this line of code.
Code:
<if condition="$headerstime - 1209600 > $bbuserinfo[lastpost]">
Also add the following to the very end of the template.
Finally create a plugin for the "Welcome Headers" product with a hook location of "global_start". Set the title to "Soon to expire memberships", and add the following as the PHP plugin code.
PHP Code:
$subscriptions_reminders = $vbulletin->db->query_read("
SELECT subscriptionid, expirydate
FROM " . TABLE_PREFIX . "subscriptionlog AS subscriptionlog
WHERE expirydate <= " . (TIMENOW + (86400 * 14)) . "
AND status = 1
AND userid = " . $vbulletin->userinfo['userid'] . "
");
while ($subscriptions_reminder = $vbulletin->db->fetch_array($subscriptions_reminders))
{
$headerexpiremembership = round((($subscriptions_reminder['expirydate'] - TIMENOW) / 86400),1);
}
That's it! It is hard coded to display the banner when the paid subscription has 14 days or less remaining. You can change the 14 on the following line to be however many days notice you want.
PHP Code:
WHERE expirydate <= " . (TIMENOW + (86400 * 14)) . "