benbyf

deleting current user

2 posts in this topic

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

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 Mustafa Online
      Hello PW Lovers! i know that i can edit user template (Profile) and add as many fields as i want,
      But i wanna know if i can create pages and associate them to users, For Example: what if i have a users system & each
      user has a profile + custom page with personal info, and any user could edit his own page - Thanx 
    • By nbcommunication
      Hi,
      I'm sure this is maybe in the works already, given that findMany() is a recent addition to the API, but having this (and the other new find options) available to $users would be a great addition.
      Cheers,
      Chris
      NB Communication
       
    • By Kiwi Chris
      I'd really like Processwire to have a robust page based permissions system rather than just template based out of the box.
      If the page tree is compared to a file system, it would be nice to be able to set owner (user), group (role) and public permissions on a page and have this propagate to sub-pages unless explicitly over-ridden.
      With a large site, it's quite possible to have multiple sections that use the same templates, but where editing needs to be assigned to different people, for different parts of a site.

      I've seen some proofs of concept that have never been updated or maintained, so I'm sure it can be done, but this is a bit of a show-stopper for me with an otherwise excellent CMS.
      I might be able to have a go at something myself, but since this is security related, and I haven't had a go at module development before, it would be really handy to have something robust that just works.
    • By rayorg
      Hi all,
      I discovered Processwire a little over a week ago and have been playing around with it ever since.  Going through the tutorials, creating templates, pages, etc. and see what a nice system it is.  However, I'm led to believe that's it's not meant for user-centric sites, and by that I mean a site where you expect to have hundreds/thousands of users and expect them to log in, update their profiles, submit content, create galleries, message each other, chat in the Forum, get email notifications, etc. etc., you get the idea.  
      I was trying to update the Profile page last night by adding fields for First Name, Last Name, Profile Pic, and a bunch of others and realized that it's not that easy to do.  There's not even a template.php file for the Profile page.   Am I just not seeing it because I'm so inexperienced with the CMS?  Or, is Processwire really geared more towards sites where not much user interaction is expected?
      thanks,
      Ray
    • By cosmicsafari
      Hi all,
      Just wondering if its safe to delete the content of the cache table manually within the database?