Limit access based on last payment
-
Ok I set up a function limiting the acces to certain capabilities (in the example below: edit_posts ). My question is if there is any way to reset the count of these limited capability based on the ‘s2member_last_payment_time’. I mean the count is reset to zero if the member renewed his membership (last_payment_time ley(s say 5 seconds for example) so that the member can access this capability again 5 seconds after the payment. Any ideas or suggestions ?
function check_post_limit(){ if(current_user_can('edit_posts')) { global $userdata; global $post_type; global $wpdb; $item_count = $wpdb->get_var( "SELECT count(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_author = $userdata->ID" ); if(( $item_count >= 2 ) && (current_user_is("s2member_level1")) ) { wp_die( 'Do not create too much posts.','check-limit' ); } return; } }
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Limit access based on last payment’ is closed to new replies.