/** * @since 2.0.8 * @return boolean */ public static function user_can_submit_form($form) { $admin_entry = FrmAppHelper::is_admin(); $can_submit = true; if ($form->options['single_entry_type'] == 'cookie' && isset($_COOKIE['frm_form' . $form->id . '_' . COOKIEHASH])) { $can_submit = $admin_entry ? true : false; } else { if ($form->options['single_entry_type'] == 'ip') { if (!$admin_entry) { $prev_entry = FrmEntry::getAll(array('it.form_id' => $form->id, 'it.ip' => FrmAppHelper::get_ip_address()), '', 1); if ($prev_entry) { $can_submit = false; } } } else { if (($form->options['single_entry_type'] == 'user' || isset($form->options['save_draft']) && $form->options['save_draft'] == 1) && !$form->editable) { $user_ID = get_current_user_id(); if ($user_ID) { $meta = FrmProEntriesHelper::check_for_user_entry($user_ID, $form, $form->options['single_entry_type'] != 'user'); if ($meta) { $can_submit = false; } } } } } return $can_submit; }