コード例 #1
0
 public function updateUserActivationByAdmin($user_id, $action)
 {
     if (strtolower($action) == 'activate') {
         $user = User::where("id", $user_id)->where('activated', 0)->first();
         if ($user) {
             $activation_code = $user->getActivationCode();
             $userService = new UserAccountService();
             $userService->activateUser($user, $activation_code, $auto_login = false);
         }
         $success_msg = trans('admin/manageMembers.memberlist_activated_suc_msg');
     } else {
         $user = User::where("id", $user_id)->first();
         $data_arr['activated'] = 0;
         User::where('id', $user_id)->update($data_arr);
         $success_msg = trans('admin/manageMembers.memberlist_deactivated_suc_msg');
     }
     // Add user log entry
     $data_arr['user_id'] = $user_id;
     $data_arr['added_by'] = getAuthUser()->id;
     $data_arr['date_added'] = date('Y-m-d H:i:s');
     $data_arr['log_message'] = $success_msg . " Added by: " . getAuthUser()->first_name . " On." . date('Y-m-d H:i:s');
     $userlog = new UserLog();
     $userlog->addNew($data_arr);
     return $success_msg;
 }