Hi,
Great plugin. I was wondering about setting time frames for users, i.e. if a user has subscribed or logged in the first time is there a way to only have that username and password valid for 2 weeks or so?
Thanks a lot,
Marie
Hi,
Great plugin. I was wondering about setting time frames for users, i.e. if a user has subscribed or logged in the first time is there a way to only have that username and password valid for 2 weeks or so?
Thanks a lot,
Marie
Yes, but you'd have to get your hands dirty with a bit of code.
There's a few ways you could do this, but here's some pointers:
functions.php file, or as a new plugin. You'd probably want to use the user_register hook.CTXPS_Queries::add_membership_with_expiration() to automatically register new users to a specified group with a specified expiration date (this is located in contexture-page-security/core/model_queries.php.Here's some code right off the top of my head that may do the trick (totally untested) - you'll need to check it to ensure the correct group id and whatnot suit your needs, of course.
add_action('user_register','autoregister_user',10,1);
function autoregister_user($user_id){
$group_id = 3;
$expires = strtotime(date("Y-m-d")) . " +2 week");
$expires = date("Y-m-d",$expires);
CTXPS_Queries::add_membership_with_expiration($user_id,$group_id,$expires);
}
Theoretically, the above will automatically enroll any newly registered user in the group with id 3, and that membership will expire two weeks from the day they registered.
Hope this helps.
This topic has been closed to new replies.