benbyf

deleting current user

Recommended Posts

benbyf    504

within my module not sure how to delete the current user and redirect without incurring this error:

Fatal error: Exception: You do not have permission to execute this module - ProcessPageView (in /srv/users/serverpilot/apps/betaville-dev/public/wire/core/Modules.php line 1022) #0 /srv/users/serverpilot/apps/betaville-dev/public/wire/core/Modules.php(940): Modules->getModule('ProcessPageView') #1 /srv/users/serverpilot/apps/betaville-dev/public/wire/core/Session.php(609): Modules->get('ProcessPageView') #2 /srv/users/serverpilot/apps/betaville-dev/public/wire/core/Wire.php(398): Session->___redirect('/') #3 /srv/users/serverpilot/apps/betaville-dev/public/wire/core/Wire.php(333): Wire->runHooks('redirect', Array) #4 /srv/users/serverpilot/apps/betaville-dev/public/site/modules/Subscribers/Subscribers.module(345): Wire->__call('redirect', Array) #5 /srv/users/serverpilot/apps/betaville-dev/public/site/templates/login.php(27): Subscribers->deleteUser('benjaminbyford5...') #6 /srv/users/serverpilot/apps/betaville-dev/public/wire/core/TemplateFile.php(182): require('/srv/users/serv...') #7 /srv/users/serverpilot/apps/betavi in /srv/users/serverpilot/apps/betaville-dev/public/index.php on line 248

 

$u = $this->user;

// user found and deleted
$this->users->delete($u);

// send to homepage
$homepage = $this->pages->get('/');
$this->session->redirect($homepage->url);

 

Share this post


Link to post
Share on other sites
adrian    7,667

Not sure, but maybe try hooking after: Session::redirect

Or maybe you need to: $session->logout() first.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By benbyf
      Is there a way to restrict logins for users so that one user can't be loggedin in two places at the same time?
      e.g. auto logout user after inactivity (of say 15 minutes..?), or logout action and disallow login if user still "logged in" somewhere?
    • By Martin Muzatko
      Hello there!
      I want to create a user front-end (user can register/login/logout via templates)
      I'm working based on the intermediate site profile. So _init.php is loaded first, then the template file and then _main.php.
      I integrated the custom login as described here, and changed it to my needs. ( I don't want to redirect the user, if the form is filled in successfully)
      The problem I face, is that $user->isLoggedin() lags behind $session->login().
      Which means that whenever I do a login, I DO get the information that the login was successful ($session->login(...) instanceof User). I COULD use that information on _main.php to show a profile in the upper right corner.
      However I don't want to set a variable in the template and ask for it in _main.php. Are there any alternatives? Is a redirect really required to complete the session handling? Why? I have the same problem for the logout. The user is still displayed as logged in, when he opens the logout page.
      Thanks in advance.
      Best,
      Martin
    • By modifiedcontent
      I have 100+ spam/Russian user accounts on a semi-test site. Is deleting them one by one the only option? Is there no way to select a whole page of spam user accounts and batch delete them?