1

I want to delete all nodes for a user whoes any one node has been flagged as spam.

For example:

If user has created 3 nodes of same/different content types, then If admin flag any one content as spam, then all the 3 nodes should get deleted and the user should get blocked.

I am able to block the user and delete the flagged node but not the other 2 nodes. I want to delete all nodes associated to that user.

enter image description here

Please help.

  • Could you clarify how you are currently deleting and blocking the users? This can make the answer more specific to your use case. – dmsmidt Jan 19 '16 at 10:17
  • I have attached the screenshot. Blocking and unpublishing the content. – echo Jan 19 '16 at 12:43
  • get the user ID, and delete its content programatically – M a m a D Jan 19 '16 at 12:52
  • @Drupalist well that I can, but I want that to happen when user flags the node. With your solution I have to create a separate link/button. – echo Jan 19 '16 at 12:54
  • Using rules module, set the Event on node flag and the action on the nodes delete – M a m a D Jan 19 '16 at 12:55
2

I did in this way without writing a single line of code.

1) Add action: Fetch entity by property: Choose Entity type as 'Node', Property as 'Author' and Data selector as 'flagged-node:author'. Choose variable label ('spam nodes' in my case) and variable name ('spam_nodes' in my case) as you wish.

2) Add Loop: Select Data selector as 'spam-nodes' (this will show as per your variable label in step 1). Set variable label('spam node' in my case) and variable name('spam_item' in my case) as you wish.

3) Now click on 'Add action' link under 'Operations' column against the loop you have added in step 2. Select 'Delete Entity' and set the Data selector as 'spam-item' (this will show as per your variable label in step 2).

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.