function perform()
 {
     // fetch the validated data
     $this->_userName = Textfilter::filterAllHTML($this->_request->getValue("userName"));
     $this->_userPassword = $this->_request->getValue("newUserPassword");
     $this->_userEmail = Textfilter::filterAllHTML($this->_request->getValue("userEmail"));
     $this->_userFullName = Textfilter::filterAllHTML($this->_request->getValue("userFullName"));
     $this->_userStatus = $this->_request->getValue("userStatus");
     $this->_userBlog = $this->_request->getValue("userBlog");
     // now that we have validated the data, we can proceed to create the user, making
     // sure that it doesn't already exists
     $users = new Users();
     $userInfo = $users->userExists($this->_userName);
     if ($userInfo) {
         $this->_form->setFieldValidationStatus("userName", false);
         $this->_view = new AdminAddUserView($this->_blogInfo);
         $this->setCommonData(true);
         return false;
     }
     // otherwise, we can create a new one
     $user = new UserInfo($this->_userName, $this->_userPassword, $this->_userEmail, "", $this->_userFullName, 0, $this->_properties);
     $user->setStatus($this->_userStatus);
     $this->notifyEvent(EVENT_PRE_USER_ADD, array("user" => &$user));
     $newUserId = $users->addUser($user);
     if (!$newUserId) {
         $this->_view = new AdminAddUserView($this->_blogInfo);
         $this->_form->setFieldValidationStatus("userName", false);
         $this->setCommonData(true);
         return false;
     }
     // if the userBlog parameter is different than 0, we have to add a relationship
     // between that user and the blog
     if ($this->_userBlog > 0) {
         $permissions = new UserPermissions();
         $result = $permissions->grantPermission($newUserId, $this->_userBlog, PERMISSION_BLOG_USER);
     }
     $this->notifyEvent(EVENT_POST_USER_ADD, array("user" => &$user));
     $this->_view = new AdminSiteUsersListView($this->_blogInfo);
     $this->_view->setSuccessMessage($this->_locale->pr("user_added_ok", $user->getUsername()));
     $this->setCommonData();
     return true;
 }
 function perform()
 {
     $this->_notificationText = $this->_request->getValue("newBlogUserText");
     $this->_newUsername = Textfilter::filterAllHTML($this->_request->getValue("newBlogUserName"));
     // see if the user exists
     $users = new Users();
     $userInfo = $users->getUserInfoFromUsername($this->_newUsername);
     if (!$userInfo) {
         $this->_view = new AdminTemplatedView($this->_blogInfo, "addbloguser");
         $this->_view->setErrorMessage($this->_locale->pr("error_invalid_user"), $this->_newUsername);
         $this->_form->setFieldValidationStatus("newBlogUserName", false);
         $this->setCommonData(true);
         return false;
     }
     $this->notifyEvent(EVENT_USER_LOADED, array("user" => &$userInfo));
     // now we can add this user to the blog
     $userPerms = new UserPermissions();
     $res = $userPerms->grantPermission($userInfo->getId(), $this->_blogInfo->getId(), PERMISSION_BLOG_USER);
     $this->notifyEvent(EVENT_PRE_USER_UPDATE, array("user" => &$userInfo));
     if (!$res) {
         // there was an error adding the user to the blog
         $this->_view = new AdminTemplatedView($this->_blogInfo, "addbloguser");
         $this->_view->setErrorMessage($this->_locale->pr("error_adding_user", $userInfo->getUsername()));
         $this->setCommonData();
         return false;
     }
     $this->notifyEvent(EVENT_POST_USER_UPDATE, array("user" => &$userInfo));
     // send a notification if enabled
     if ($this->_sendNotification) {
         $this->sendNotificationEmail($userInfo);
     }
     $this->_view = new AdminBlogUsersListView($this->_blogInfo);
     $this->_view->setSuccessMessage($this->_locale->pr("user_added_to_blog_ok", $userInfo->getUsername()));
     $this->setCommonData();
     return true;
 }