SimplePortal

Customization => Blocks and Modifications => Topic started by: tanks on May 09, 2009, 12:03:26 PM

Title: Paid Subscription Status
Post by: tanks on May 09, 2009, 12:03:26 PM
Hello fellas

First i want to thank you for this nice portal software.

I was unable to start a new topic in the correct forum so i will start it here and then you can move my topic.

On my forum i have Paid subscriptions and i like to show members if their subscription is active or not. With this code i can show it on the front page. Notice my member group for subscribers is 12. Yours might be a different ID so change it to suit your forum.

On my forum Paid Subscription are called Partnerships. You can also change this to suit your needs.

Cheers,

Tanks

Code: [Select]
global $user_info, $scripturl;

if (in_array(12, $user_info['groups']))
{
echo '<b>Partnership: <font color="green">Active</font></b><br />';
}
else
{
echo '<b>Partnership: <font color="red">Inactive</font></b><br /><a href="' . $scripturl . '?action=profile;area=subscriptions">Join Partnership</a>';
}

Examples:

(http://img8.imageshack.us/img8/1255/sshot3y.jpg)

Or

(http://img12.imageshack.us/img12/2254/sshot4e.jpg)
Title: Re: Paid Subscription Status
Post by: Blue on May 09, 2009, 12:17:33 PM
Hi Tanks,

It's a really nice mod. But,  you can replace this:
Code: [Select]
<a href="http://www.YOURSITE.com/index.php?action=profile;area=subscriptions">
to this:
Code: [Select]
<a href="' . $scripturl . '?action=profile;area=subscriptions">
and

Code: [Select]
global $user_info;
to:
Code: [Select]
global $user_info, $scripturl;
Doing this, members don't need to change the url ;) They only need to change the id of the membergroup.

Great block and Congrats ;)
Title: Re: Paid Subscription Status
Post by: tanks on May 09, 2009, 12:26:54 PM
I Updated the code - Thanks.

It's a code i got from back in the days when i was using TP.
Title: Re: Paid Subscription Status
Post by: Nathaniel on May 16, 2009, 10:30:10 PM
Moved to the Blocks and Modifications board. Sorry about the wait.

Looks good. :D
Title: Re: Paid Subscription Status
Post by: qtime on October 04, 2009, 01:24:52 PM
Great code, is it possible to show the end date of the subscription?
Title: Re: Paid Subscription Status
Post by: marshallstan on April 19, 2010, 04:26:38 AM
hi, is it possible to put this into the user blok?
and how i do that  :D
thx already.
i would like to put it under updated topics
Title: Re: Paid Subscription Status
Post by: andy on November 28, 2011, 11:34:43 PM
A useful thing is showing how much time they have left on their subscription ... people are lazy and dont check= more work for admin.
I know 1 email reminder can be sent out but having the time left displayed when they log in would be a good reminder  :D
Title: Re: Paid Subscription Status
Post by: mrnuke7175 on June 01, 2014, 03:31:52 PM
Any updates with this? I've tried it , but I have 4 different subscription groups. Is there a way to have it check for all four?

Thanks
Title: Re: Paid Subscription Status
Post by: mrnuke7175 on June 20, 2014, 11:52:05 PM
I tried my hand at it :

Code: [Select]
global $viewsub, $scripturl;

if (in_array(6, $viewsub['sid']))
{
echo '<b>Paid Membership: <font color="green">Active</font></b><br />';
}
else
{
echo '<b>Paid Membership: <font color="red">Inactive</font></b><br /><a href="' . $scripturl . '?action=profile;area=subscriptions">Become a supporter</a>';
}


It does not work. Any insight?
Title: Re: Paid Subscription Status
Post by: phantomm on June 22, 2014, 02:20:10 PM
I have no idea where did you get $viewsub.

Code from first message works fine, I think that if you need to add multiple subscriptions you would need to add it like this:
Code: [Select]
global $user_info, $scripturl;

//For subscription that gives group ID 12
if (in_array(12, $user_info['groups']))
{
echo '<b>Partnership: <font color="green">Active</font></b><br />';
}
else
{
echo '<b>Partnership: <font color="red">Inactive</font></b><br /><a href="' . $scripturl . '?action=profile;area=subscriptions">Join Partnership</a>';
}

//For subscription that gives group ID 13
if (in_array(13, $user_info['groups']))
{
echo '<b>Partnership: <font color="green">Active</font></b><br />';
}
else
{
echo '<b>Partnership: <font color="red">Inactive</font></b><br /><a href="' . $scripturl . '?action=profile;area=subscriptions">Join Partnership</a>';
}
Title: Re: Paid Subscription Status
Post by: mrnuke7175 on July 01, 2014, 11:47:07 PM
Thanks, I modified your code a bit to properly format it, but it works now.

I got all confused with the variables during testing and that's why I had that there.

Thanks.
Title: Re: Paid Subscription Status
Post by: SteveW on January 02, 2015, 08:19:01 AM
Hi - does anyone know whether you could add expiry date into this as well? I'll see if I can code it but I'm not very good..
Title: Re: Paid Subscription Status
Post by: mrnuke7175 on January 30, 2015, 10:03:43 PM
Hi - does anyone know whether you could add expiry date into this as well? I'll see if I can code it but I'm not very good..

Goo idea!