Jump to content

Delete user when page is deleted


onjegolders
 Share

Recommended Posts

The issue is when using the ProcessPage Delete non-core module. It adds a link to the page so you can delete without entering the page itself.

I will have a look at the update function again. I was testing with isChanged() but it wasn't working for me.

Thanks for the explanation about skip.

Ahh... the ProcessPageDelete module by Nico. Works fine here.

Again, it depends on what you set the hook, this module does trash the page and not delete it.

Link to comment
Share on other sites

Ahh... the ProcessPageDelete module by Nico. Works fine here.

Again, it depends on what you set the hook, this module does trash the page and not delete it.

True, the problem I seem to get is any page I use the "delete" shortcut on which is already in the trash gets "re-trashed" not deleted. 

This isn't actually only related to my student pages but any pages. I guess that maybe Nico's intention. But it's a bit confusing if so. Perhaps that link shouldn't show for pages in the trash.

Link to comment
Share on other sites

Regarding the debugging element to this thread, "error_log()" is one of the things I find incredibly useful. Very handy way to spit out the value of a variable, or even just "test" at a certain point in the code to confirm that bit is being processed. This is useful for times when it is not easy to echo content to the page for whatever reason, or if you are **shudder** trying to fix something on a live site and don't want the output littered with your debug code as you are working on it.

  • Like 2
Link to comment
Share on other sites

  • 6 months later...
public static function getModuleInfo() {

		return array(

			'title' => 'Hello World',
			'version' => 101, 
			'summary' => 'An example module used for demonstration purposes. See the /site/modules/Helloworld.module file for details.',
			'href' => 'http://www.processwire.com',
			'singular' => true, 
			'autoload' => true, 
			);
	}

	public function init() {
		$this->pages->addHookAfter('trash', $this, 'example5');
	}

	
	public function example5($event){
		$this->message("TRASHed");
	}

I just edited helloworld module to add hook after trash ...I have succesfully added hook after save, but this after trash hook doesnt seem to work for me .

Pls guide where am i goin wrong .

What happens is when i delete a page(added to trash), this message "TRASHed " appears twice as in the snapshot.

post-2174-0-67528400-1395658143_thumb.pn
Link to comment
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
 Share

×
×
  • Create New...