You can do it using get_user_meta
and update_user_meta
:
$value = get_user_meta($user_id, 'form_submission', true);
if (!$value) {$value = 1;} else {$value = $value + 1;}
if ($value < 11) {
update_user_meta($user_id, 'form_submission', $value);
} else {
// too many form submissions
}
You could also expand on this to store the submission month too if you don’t want to use a cron job.
$month = get_user_meta($user_id, 'submission_month', true);
$value = get_user_meta($user_id, 'form_submission', true);
if ($month && ($month != date('m',time())) ) {
update_user_meta($user_id, 'submission_month', date('m', time());
$newmonth = true;
} else {$newmonth = false;}
if (!$value || $newmonth) {$value = 1;} else {$value = $value + 1;}
if ($value < 11) {
update_user_meta($user_id, 'form_submission', $value);
} else {
// too many form submissions
}