public static function maybe_prepopulate_form($form) { $config = GFUserData::get_update_feed($form['id']); // if no feed, return form unmodified if (!$config) { return $form; } else { // if the user is not logged in, add action to hide form and display error message if (!is_user_logged_in()) { add_action('gform_get_form_filter_' . $form['id'], array('GFUser', 'hide_form')); return $form; } else { // prepopulate the form $form = GFUser::prepopulate_form($form, $config); } } return $form; }