function getUserObj($pid = null) { if ($pid != null) { $user = get_userdata($pid); } else { $user = wp_get_current_user(); } $userMeta = get_user_meta($user->ID); /*foreach ($userMeta as $key => $value) { echo $key . ':' ; print_r( $value ) ; echo '<br />' ; } print_r($user) ; foreach ($user as $key => $value) { echo $key . ':' ; print_r( $value ) ; echo '</ br>' ; } $op = unserialize( $userMeta['gwpm_physical'][0] ); // get_user_option('gwpm_physical') ; print_r($op) ; **/ $_keys = getDynamicFieldKeys(); $userObj = new GwpmProfileVO($userMeta, $_keys); $userObj->userId = $user->ID; $userObj->user_email = $user->user_email; $userObj->gender = 'Male'; $userObj->gwpm_physical = unserialize($userObj->gwpm_physical[0]); $userObj->gwpm_address = unserialize($userObj->gwpm_address[0]); $userObj->gwpm_education = unserialize($userObj->gwpm_education[0]); $userObj->gwpm_work = unserialize($userObj->gwpm_work[0]); $userObj->gwpm_tmasvs = unserialize($userObj->gwpm_tmasvs[0]); $userObj->gwpm_profile_photo = unserialize($userObj->gwpm_profile_photo[0]); foreach ($_keys as $key) { $tempValObj = $userObj->{$key}; $tempVal = $tempValObj[0]; $userObj->{$key} = $tempVal; } /*foreach (array_keys(get_class_vars(get_class($userObj))) as $key) { $value = $userObj-> $key; echo $key . ' - ' ; print_r($value) ; echo '</br>' ; }*/ $totalCount = get_option(GWPM_DYNA_FIELD_COUNT); if (!isset($totalCount) || $totalCount == null) { $totalCount = 0; } $userObj->gwpm_dynamic_field_count = $totalCount; $inval = $userObj->validate(); //print_r($inval) ; return $userObj; }
function update() { $_keys = getDynamicFieldKeys(); $profileObj = new GwpmProfileVO($_POST, $_keys); $profileObj->gwpm_profile_photo = $_FILES["gwpm_profile_photo"]; $validateObj = $profileObj->validate(); if (sizeof($validateObj) == 0) { $this->_model->updateUser($profileObj); $this->set('success_message', 'Profile updated successfully!!'); } else { $this->set('error_messages', $validateObj); $this->set('warn_message', 'Please correct the below fields'); } }
$gwpm_education['qualification'] = "" . rand(1, 4); $gwpm_education['qualification_other'] = "" . 'Other'; $gwpm_education['specialization'] = "" . rand(1, 4); $gwpm_education['status'] = "" . rand(1, 4); $_POST['gwpm_education'] = $gwpm_education; $dynaKeys = getDynamicFieldKeys(); foreach ($dynaKeys as $__keys) { echo "<br /> Dyna: " . $__keys; $_POST[$__keys] = "" . rand(1, 3); } $abt = createDateRangeArray('1980-10-01', '1985-10-05'); $newdata = $abt[0]; echo $newdata . "<br />"; $_POST['gwpm_dob'] = $newdata; // $profileObj = new GwpmProfileVO($_POST); $profileObj = new GwpmProfileVO($_POST, $dynaKeys); $profileObj->gwpm_profile_photo = $_FILES["gwpm_profile_photo"]; $validateObj = $profileObj->validate(); if (sizeof($validateObj) == 0) { $mymodel->updateUser($profileObj); echo __('success_message', 'Profile updated successfully!!' . '<br />'); } else { echo __('Please correct the below fields: ' . '<br />'); print_r($validateObj); echo "<>br />"; } } if (sizeof($userIdList) > 0) { global $wpdb; $table_name = $wpdb->prefix . "usermeta"; $column_name = $wpdb->prefix . 'user_level';