Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function createNewAccount( $args ) {
- $this->escape( $args );
- $username = $args[0];
- $password = $args[1];
- $new_username = $args[2];
- $new_user_psswd = $args[3];
- $email = $args[4];
- $weblog_title = $args[5];
- $domain = $args[6];
- $bio = $args[7];
- $aeUrl = $args[8];
- if ( !$user = $this->login($username, $password) ) {
- return $this->error;
- }
- if ( !current_user_can( 'manage_options' ) ) {
- return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
- }
- try {
- do_action('xmlrpc_call', 'dgr.createNewAccount');
- } catch (Exception $e) {
- return new IXR_Error(9876, __('Error creating account'));
- }
- $user_id = 0;
- try {
- $user_id = wpmu_create_user($new_username, $new_user_psswd, $email);
- } catch (Exception $e) {
- return new IXR_Error(9876, __('Error during user creation user_id ='.$user_id.' error : '.$e));
- }
- if ( $user_id < 1) {
- return new IXR_Error(9876, __('Failed to create the user. '.$user_id));
- }
- else
- {
- try {
- //create the user bio
- wp_update_user( array ('ID' => $user_id, 'description' => $bio, 'user_url' => $aeUrl) ) ;
- } catch (Exception $e) {
- return new IXR_Error(9876, __('Error updating bio user_id ='.$user_id.' error : '.$e));
- }
- }
- try {
- $blog_id = wpmu_create_blog($domain, '/', $weblog_title, $user_id );
- } catch (Exception $e) {
- return new IXR_Error(9876, __('Error during blog creation blog_id ='.$blog_id.' error : '.$e));
- }
- return $blog_id;
- }
- function updateUserMeta( $args ) {
- $this->escape( $args );
- $username = $args[0];
- $password = $args[1];
- $bio = $args[2];
- $aeUrl = $args[3];
- if ( ! $user = $this->login($username, $password)) {
- return $this->error;
- }
- if ( ! current_user_can('manage_options'))
- return new IXR_Error(403, __('You are not allowed access to details about this blog.'));
- //create the user bio
- $user_id = $user->ID;
- try {
- $id_of_updated_user = wp_update_user(array ('ID' => $user_id, 'description' => $bio, 'user_url' => $aeUrl));
- } catch (Exception $e) {
- return new IXR_Error(9876, __('Error updating user details for user_id ='.$user_id.' error : '.$e));
- }
- if ( ! $id_of_updated_user) {
- return new IXR_Error(9876, __('Error updating user details for user_id ='.$user_id));
- }
- return $id_of_updated_user;
- }
Add Comment
Please, Sign In to add comment