Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Control expired member access to...
Control expired member access to public page
Control expired member access to public page
Hi Stephen,
Im using OSE Membership for my website. Premium members each receive a publicly visible page that needs to be controlled by their subscription status. Eg if their subscription expires the publicly visible page needs to be blocked or redirected to home page. Currently OSE can't control this.
Do you know a way of achieving this with Chameleon?
Thank you in advance,
Re: Control expired member access to public page
I expect that should be possible by detecting when someone arrives on that particular page type, and also a database lookup for the status of the user whose page it is.
Is OSE Membership a commercial component? Is it GPL? If GPL, can you please send me a copy so I can install it and examine the database structure?
Will PM you with my e-mail address.
Cheers,
Stephen
Re: Control expired member access to public page
Ok, here goes. You can use this in the PHP box on the LEFT sode of the Chameleon rule. This detects if the most recent membership has expired, and makes the rule SUCCEED if it has expired. If the user does not have a subscription, or if the subscription has NOT expired, then the rule FAILS.
$member= oseRegistry :: call('member');
$member->instance($user->id, "member_id");
$memberInfo = $member->getOwnMsc('','obj');
if (empty($memberInfo)) {
return false; // no memberships at all - rule fail.
}
$exp = strtotime($memberInfo[0]->expired_date);
if ($exp < time()) return true; // expired - rule succeed
}
return false; // valid and not expired - rule fail.
Hope that helps,
Stephen
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Control expired member access to...
Board Info
- Board Stats:
- Total Topics:
- 1700
- Total Polls:
- 6
- Total Posts:
- 5967
- Total Posts Today:
- 1
- User Info:
- Total Users:
- 8052
- Newest User:
- maarie443
- Members Online:
- 0
- Guests Online:
- 176
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked