public function get_entry_edit_form() { $current_user = wp_get_current_user(); if (current_user_can('update_entry') || $current_user->ID === 1) { $args = array('success' => true, 'message' => awpd_ha_3_get_form_html(absint($_POST['post_id']))); } else { $args = array('success' => false, 'message' => 'You are not allowed to edit entries'); } wp_send_json_success($args); }
/** * This gives us the form for adding entries. * * @since 1.0 * @author Heather Anderson * @access public * * @uses current_user_can() Returns true if current user has given cap * @uses $this->get_form_html() Returns our form HTML * @return string $html Our HTML form */ public function add_entry_form() { $html = ''; $current_user = wp_get_current_user(); // This is also a hack to be fixed if (current_user_can('create_entry') || current_user_can('update_entry') || $current_user->ID === 1 || $current_user->ID === 2) { $html .= awpd_ha_3_get_form_html(); } else { $html .= 'Sorry you are not allowed to add journal entries'; } return $html; }