/** * Check whether a field is editable by the current user, and optionally display an error message * @uses GravityView_Edit_Entry->check_user_cap_edit_field() Check user capabilities * @param array $field Field or field settings array * @param boolean $echo Whether to show error message telling user they aren't allowed * @return boolean True: user can edit the current field; False: nope, they can't. */ private function user_can_edit_field($field, $echo = false) { $error = NULL; if (!$this->check_user_cap_edit_field($field)) { $error = __('You do not have permission to edit this field.', 'gravityview'); } // No errors; everything's fine here! if (empty($error)) { return true; } if ($echo) { echo GVCommon::generate_notice(wpautop(esc_html($error)), 'gv-error error'); } do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error); return false; }