<label for="billingState">State:</label> <?php echo display_states('billingState', $data['billingState'], 'id="billingState" class="formelement"'); ?> <br class="clear" /> <label for="billingPostcode">Post /ZIP Code:</label> <?php echo @form_input('billingPostcode', set_value('billingPostcode', $data['billingPostcode']), 'id="billingPostcode" class="formelement"'); ?> <br class="clear" /> <label for="billingCountry">Country:</label> <?php echo display_countries('billingCountry', $data['billingCountry'], 'id="billingCountry" class="formelement"'); ?> <br class="clear" /> </div> <br /> <?php } ?> </div> <div id="tab3" class="tab"> <?php
function account($redirect = '') { // get partials $output = $this->partials; // check user is logged in, if not send them away from this controller if (!$this->session->userdata('session_user')) { redirect('/shop/login/' . $this->core->encode($this->uri->uri_string())); } // set object ID $objectID = array('userID' => $this->session->userdata('userID')); // required $this->core->required = array('email' => array('label' => 'Email', 'rules' => 'valid_email|unique[users.email]|required|trim'), 'password' => array('label' => 'Password', 'rules' => 'matches[confirmPassword]'), 'firstName' => array('label' => 'First name', 'rules' => 'required|trim|ucfirst'), 'lastName' => array('label' => 'Last name', 'rules' => 'required|trim|ucfirst'), 'address1' => array('label' => 'Address1', 'rules' => 'required|required|trim|ucfirst'), 'address2' => array('label' => 'Address2', 'rules' => 'trim|ucfirst'), 'address3' => array('label' => 'Address3', 'rules' => 'trim|ucfirst'), 'city' => array('label' => 'City / State', 'rules' => 'required|trim|ucfirst'), 'postcode' => array('label' => 'ZIP/Postcode', 'rules' => 'required|trim|strtoupper'), 'phone' => array('label' => 'Phone', 'rules' => 'required|trim')); // get values $data = $this->core->get_values('users', $objectID); // force postcode to upper case $this->core->set['postcode'] = strtoupper($this->input->post('postcode')); // security check if ($this->input->post('username')) { $this->core->set['username'] = $data['username']; } if ($this->input->post('premium')) { $this->core->set['premium'] = $data['premium']; } if ($this->input->post('siteID')) { $this->core->set['siteID'] = $this->siteID; } if ($this->input->post('userID')) { $this->core->set['userID'] = $data['userID']; } if ($this->input->post('resellerID')) { $this->core->set['resellerID'] = $data['resellerID']; } if ($this->input->post('kudos')) { $this->core->set['kudos'] = $data['kudos']; } if ($this->input->post('posts')) { $this->core->set['posts'] = $data['posts']; } // update if (count($_POST) && $this->core->update('users', $objectID)) { // get updated row session $user = $this->shop->get_user(); // remove the password field unset($user['password']); // set session data $this->session->set_userdata($user); if ($redirect) { redirect('/shop/' . $redirect); } else { $output['message'] = 'Your details have been updated.'; } } // populate template $output['form:email'] = set_value('email', $data['email']); $output['form:displayName'] = set_value('displayName', $data['displayName']); $output['form:firstName'] = set_value('firstName', $data['firstName']); $output['form:lastName'] = set_value('lastName', $data['lastName']); $output['form:phone'] = set_value('phone', $data['phone']); $output['form:address1'] = set_value('address1', $data['address1']); $output['form:address2'] = set_value('address2', $data['address2']); $output['form:address3'] = set_value('address3', $data['address3']); $output['form:city'] = set_value('city', $data['city']); $output['select:state'] = @display_states('state', $data['state'], 'id="state" class="formelement"'); $output['form:postcode'] = set_value('postcode', $data['postcode']); $output['select:country'] = @display_countries('country', set_value('country', $data['country']), 'id="country" class="formelement"'); $output['form:billingAddress1'] = set_value('billingAddress1', $data['billingAddress1']); $output['form:billingAddress2'] = set_value('billingAddress2', $data['billingAddress2']); $output['form:billingAddress3'] = set_value('billingAddress3', $data['billingAddress3']); $output['form:billingCity'] = set_value('billingCity', $data['billingCity']); $output['select:billingState'] = @display_states('billingState', $data['billingState'], 'id="billingState" class="formelement"'); $output['form:billingPostcode'] = set_value('billingPostcode', $data['billingPostcode']); $output['select:billingCountry'] = @display_countries('billingCountry', set_value('billingCountry', $data['billingCountry']), 'id="billingCountry" class="formelement"'); // load errors $output['errors'] = validation_errors() ? validation_errors() : FALSE; // set page title $output['page:title'] = 'My Account' . ($this->site->config['siteName'] ? ' - ' . $this->site->config['siteName'] : ''); // display with cms layer $this->pages->view('shop_account', $output, TRUE); }
<label for="siteTel">Telephone:</label> <?php echo @form_input('siteTel', set_value('siteTel', $data['siteTel']), 'id="siteTel" class="formelement"'); ?> <br class="clear" /> <label for="siteAddress">Address:</label> <?php echo @form_textarea('siteAddress', set_value('siteAddress', $data['siteAddress']), 'id="siteAddress" class="formelement small"'); ?> <br class="clear" /> <label for="siteCountry">Country:</label> <?php echo display_countries('siteCountry', $data['siteCountry'], 'id="siteCountry" class="formelement"'); ?> <br class="clear" /><br /> <?php if (@in_array('emailer', $this->permission->permissions)) { ?> <label for="emailerEmail">From Email:</label> <?php echo @form_input('emailerEmail', set_value('emailerEmail', $data['emailerEmail']), 'id="emailerEmail" class="formelement"'); ?> <span class="tip">The email address from which emails will be sent (must be a Fully Qualified Domain Name).</span><br class="clear" /> <label for="emailerName">From Name:</label> <?php
function account($redirect = '') { // check user is logged in, if not send them away from this controller if (!$this->session->userdata('session_user')) { redirect('/users/login/' . $this->core->encode($this->uri->uri_string())); } // required $this->core->required = array('email' => array('label' => 'Email', 'rules' => 'valid_email|unique[users.email]|required|trim'), 'firstName' => array('label' => 'First Name', 'rules' => 'required|trim|ucfirst'), 'lastName' => array('label' => 'Last Name', 'rules' => 'required|trim|ucfirst'), 'address1' => array('label' => 'Address1', 'rules' => 'trim|ucfirst'), 'address2' => array('label' => 'Address2', 'rules' => 'trim|ucfirst'), 'address3' => array('label' => 'Address3', 'rules' => 'trim|ucfirst'), 'city' => array('label' => 'City / State', 'rules' => 'trim|ucfirst'), 'displayName' => array('label' => 'Display Name', 'rules' => 'unique[users.displayName]|max_length[15]|min_length[3]|alpha_dash|trim')); // set object ID $objectID = array('userID' => $this->session->userdata('userID')); // get values $data = $this->core->get_values('users', $objectID); if (count($_POST)) { // set default error message $error = ''; // upload image if (@$_FILES['image']['name'] != '') { // set upload config $img_upload_path = site_url() . 'static/uploads/avatars'; $this->uploads->allowedTypes = 'gif|jpg|png'; $this->uploads->uploadsPath .= '/avatars'; $this->uploads->maxSize = '100000'; $this->uploads->maxWidth = '2000'; $this->uploads->maxHeight = '2000'; // upload avatar if ($imageData = $this->uploads->upload_image(FALSE)) { $this->core->set['avatar'] = $imageData['file_name']; } // set error $error = $this->uploads->errors ? 'Problem with your image: ' . $this->uploads->errors : ''; } // upload logo if (@$_FILES['logo']['name'] != '') { // set upload config $this->uploads->allowedTypes = 'gif|jpg|png'; $this->uploads->uploadsPath .= '/avatars'; $this->uploads->maxSize = '100000'; $this->uploads->maxWidth = '2000'; $this->uploads->maxHeight = '2000'; // upload logo if ($imageData = $this->uploads->upload_image(FALSE, NULL, 'logo')) { $this->core->set['companyLogo'] = $imageData['file_name']; } // set error $error = $this->uploads->errors ? 'Problem with your logo: ' . $this->uploads->errors : ''; } // get image errors if there are any if ($error) { $this->form_validation->set_error($error); } else { // security check if ($this->input->post('username')) { $this->core->set['username'] = $data['username']; } if ($this->input->post('subscribed')) { $this->core->set['subscribed'] = $data['subscribed']; } if ($this->input->post('siteID')) { $this->core->set['siteID'] = $this->siteID; } if ($this->input->post('userID')) { $this->core->set['userID'] = $data['userID']; } if ($this->input->post('resellerID')) { $this->core->set['resellerID'] = $data['resellerID']; } if ($this->input->post('kudos')) { $this->core->set['kudos'] = $data['kudos']; } if ($this->input->post('posts')) { $this->core->set['posts'] = $data['posts']; } // update if ($this->core->update('users', $objectID)) { // get updated row $row = $this->core->viewall('users', $objectID, NULL, 1); // remove the password field unset($row['users'][0]['password']); // set session data $this->session->set_userdata($row['users'][0]); // update image data in session if (isset($imageData)) { $this->session->set_userdata('avatar', $imageData['file_name']); } // set success message $this->session->set_flashdata('success', 'Your details have been updated.'); // redirect if ($redirect) { redirect('/users/' . $redirect); } else { redirect('/users/account'); } } } } // set title $output['page:title'] = $this->site->config['siteName'] . ' - Account'; // load errors $output['errors'] = validation_errors() ? validation_errors() : FALSE; // if reverted show a message if ($message = $this->session->flashdata('success')) { $output['message'] = $message; } // populate template $output['user:avatar'] = anchor('/users/profile/' . $data['userID'], display_image($this->users->get_avatar($data['avatar']), 'User Avatar', 150, 'class="bordered"', base_url() . $this->config->item('staticPath') . '/images/noavatar.gif')); $output['user:logo'] = anchor('/users/profile/' . $data['userID'], display_image($this->users->get_avatar($data['companyLogo']), 'Company Logo', 150, 'class="bordered"')); $output['form:email'] = set_value('email', $data['email']); $output['form:displayName'] = set_value('displayName', $data['displayName']); $output['form:firstName'] = set_value('firstName', $data['firstName']); $output['form:lastName'] = set_value('lastName', $data['lastName']); $output['form:bio'] = set_value('bio', $data['bio']); $output['form:website'] = set_value('website', $data['website']); $output['form:signature'] = set_value('signature', $data['signature']); $output['form:companyName'] = set_value('companyName', $data['companyName']); $output['form:companyEmail'] = set_value('companyEmail', $data['companyEmail']); $output['form:companyWebsite'] = set_value('companyWebsite', $data['companyWebsite']); $output['form:companyDescription'] = set_value('companyDescription', $data['companyDescription']); $output['form:address1'] = set_value('address1', $data['address1']); $output['form:address2'] = set_value('address2', $data['address2']); $output['form:address3'] = set_value('address3', $data['address3']); $output['form:city'] = set_value('city', $data['city']); $output['form:postcode'] = set_value('postcode', $data['postcode']); $output['form:phone'] = set_value('phone', $data['phone']); $output['select:country'] = @display_countries('country', set_value('country', $data['country']), 'id="country" class="formelement"'); $values = array('V' => 'Everyone can see my profile', 'H' => 'Hide my profile and feed'); $output['select:privacy'] = @form_dropdown('privacy', $values, set_value('privacy', $data['privacy']), 'id="privacy" class="formelement"'); $values = array(0 => 'No', 1 => 'Yes'); $output['select:notifications'] = @form_dropdown('notifications', $values, set_value('notifications', $data['notifications']), 'id="notifications" class="formelement"'); $output['select:currency'] = @form_dropdown('currency', currencies(), set_value('currency', $data['currency']), 'id="currency" class="formelement"'); $output['select:language'] = @form_dropdown('language', languages(), set_value('language', $data['language']), 'id="language" class="formelement"'); // display with cms layer $this->pages->view('community_account', $output, 'community'); }
<br class="clear" /> </div> <div class="formrow cczip-row"> <label for="cczip">Zip/Post Code:</label> <input type="text" name="x_zip" id="cczip" class="formelement" value="<?php echo $this->input->post('x_zip') ? $this->input->post('x_zip') : @$user['billingPostcode']; ?> " /> <br class="clear" /> </div> <div class="formrow cccountry-row"> <label for="cccountry">Country:</label> <?php echo display_countries('x_country', $this->input->post('x_country') ? $this->input->post('x_country') : @$user['billingCountry'], 'id="cccountry" class="formelement"'); ?> <br class="clear" /> </div> <?php } elseif ($this->site->config['shopGateway'] == 'sagepay') { ?> <input type="hidden" name="transactionID" value="<?php echo $transaction['transactionID']; ?> " /> <input type="hidden" name="Description" value="<?php echo $this->site->config['siteName']; ?>