I want to restrict new registered users on my WordPress site from writing comments until 3 days passed their registration date. What solution do you recommend? thanks in advanced.
I want to restrict new registered users on my WordPress site from writing comments until 3 days passed their registration date. What solution do you recommend? thanks in advanced.
Share Improve this question edited Sep 29, 2019 at 10:01 Salah asked Sep 29, 2019 at 8:31 SalahSalah 11 2- Is your site hosted on wordpress? If so: did you ask their support? – fuxia ♦ Commented Sep 29, 2019 at 9:22
- no my cms is wordpress. – Salah Commented Sep 29, 2019 at 10:02
1 Answer
Reset to default 0The comments_open() boolean function return is filtered by 'comments_open'. Untested, pseudo code as a guide:
add_filter( 'comments_open', function( $open ) {
$user = wp_get_current_user();
$open = $open && $user && time() - mysql2date( 'U', $user->user_registered ) > 3 * DAY_IN_SECONDS;
return $open;
} );
No guest users will be able to comment either, and I guess that is also what you want.