public static function credUserFormShortcode($atts) { global $post; if (is_null($post)) { return null; } /** * clone post object to revert after form */ $orginal = clone $post; $params = shortcode_atts(array('form' => '', 'post' => ''), $atts); $type = "edit"; if (empty($params['post'])) { $form = get_page_by_title(html_entity_decode($params['form']), OBJECT, CRED_USER_FORMS_CUSTOM_POST_NAME); require_once 'FormData.php'; $formData = new FormData($form->ID, CRED_USER_FORMS_CUSTOM_POST_NAME, false); $fields = $formData->getFields(); $type = $fields['form_settings']->form['type']; } if ($type == 'edit') { if (empty($params['post'])) { $user_id = get_current_user_id(); if ($user_id == 0) { $out = 'You are currently not logged in.'; } else { $params['post'] = $user_id; $out = self::cred_user_form($params['form'], $params['post']); } } else { $out = self::cred_user_form($params['form'], $params['post']); } } else { $out = self::cred_user_form($params['form'], $params['post']); } wp_reset_query(); /** * revert orginal $post */ $post = $orginal; unset($orginal); return $out; }