Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7952503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:52:47+00:00 2026-06-04T02:52:47+00:00

Looking for the best way to allow users to delete nodes on a site

  • 0

Looking for the best way to allow users to delete nodes on a site without the need to use a confirm form. I have tried using a form_alter to direct people to a custom submit function, without success.

Anyone ever tried this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:52:49+00:00Added an answer on June 4, 2026 at 2:52 am

    Assuming drupal 7, the node/%/delete menu entry is wired directly to the node_delete_confirm form. You can modify it with with a hook_menu_alter, and change the function from drupal_get_form to a page callback of your own design that will just delete the node.

    Example:

    In your module file you’d need:

    function mymodule_menu_alter(&$items) {
      $items['node/%node/delete']['page callback'] = 'my_node_delete_function';
      $items['node/%node/delete']['page arguments'] = array(1);
      $items['node/%node/delete']['module'] = 'mymodule';
      $items['node/%node/delete']['file'] = 'mymodule.pages.inc';
    }
    

    And in your mymodule.pages.inc file you’d need:

    function my_node_delete_function($node) {
      // Taken from node modules node_delete_confirm submit handler
      node_delete($node->nid);
      watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->title));
      drupal_set_message(t('@type %title has been deleted.', array('@type' => node_type_get_name($node), '%title' => $node->title)));
    
      // Do a drupal goto here to preserver the 'destination' parameter
      drupal_goto();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for the best way to use a duration field in a Rails
Looking for the best practice here... I would like to allow multiple users to
I'm looking for the best way to implement the following. I have a MySQL
I need an easy way to allow users to upload multiple files at once
I'm looking for best way of using session within zf application. At first I
Looking for the best way to set-up an iPhone project in XCode ... namely:
I'm looking for the best way to select numbers directly from an in clause.
I'm looking for the best way of loading formatted data in VBA. I’ve spent
I am looking for the best way to mimic the facebook friend window, where
I'm looking for the best way to create a unique ID as a String

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.