Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function myprefix_edit_user_cb(){
- $user_id=$_REQUEST['user_id'];
- $user = get_user_by( 'ID', $user_id );
- echo
- ' <fieldset>
- <legend>Form</legend>
- <form id="update-form" action="" method="POST">
- <label>Username:<span style="color:red">*</span></label>
- <input name="id" type="hidden" value=" '. $user->ID.' " required>
- <input name="username" type="text" value=" '. $user->user_login.' " required>
- <label>Email:<span style="color:red">*</span></label>
- <input name="email" type="email" value="'.$user->user_email.'" required>
- <label>Password:</label>
- <input name="password" type="password" value="">
- <input class="btn btn-default" name="submit" type="submit" value="submit">
- </form>
- </fieldset>
- ';
- die();
- }
- function update_data()
- {
- wp_enqueue_style('mysample');
- global $reg_errors;
- if(isset($_POST['submit']))
- {
- $username=isset($_POST['username'])?$_POST['username']:null;
- $email=isset($_POST['email'])?$_POST['email']:null;
- $password=isset($_POST['password'])?$_POST['password']:null;
- validation_for_edit($username,$email,$password);
- $userdata = array(
- 'ID' => $_POST['id'],
- 'user_login' => $username,
- 'user_email' => $email,
- 'user_pass' => $password,
- );
- echo "<pre>";print_r($userdata);
- if(1 > count( $reg_errors->get_error_messages() ) )
- {
- if($userdata=wp_update_user( $userdata ))
- {
- echo '<span id="message">Update complete.</span>';
- echo 'Goto <a href="' . get_site_url() . '/wp-login.php">login page</a>';
- }
- }
- }
- die();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement