SimplePortal
Customization => Blocks and Modifications => Topic started 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
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)
-
Hi Tanks,
It's a really nice mod. But, you can replace this:
<a href="http://www.YOURSITE.com/index.php?action=profile;area=subscriptions">
to this:
<a href="' . $scripturl . '?action=profile;area=subscriptions">
and
global $user_info;
to:
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 ;)
-
I Updated the code - Thanks.
It's a code i got from back in the days when i was using TP.
-
Moved to the Blocks and Modifications board. Sorry about the wait.
Looks good. :D
-
Great code, is it possible to show the end date of the subscription?
-
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
-
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
-
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
-
I tried my hand at it :
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?
-
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:
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>';
}
-
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.
-
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..
-
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!