I just started playing with Drupal and I'd like the user to be able to add a custom node(or content) outside the admin by providing a form and then add that to Drupal's database once submitted. How do I do this programmatically and securely? Wordpress has a wp_insert_post() function for this functionality, what's the Drupal version?

  • Is there a reason you want to do it programatically? Drupal can do what you described without needing to go into code.
    – arkz
    Feb 9, 2012 at 14:31
  • @arkz: Your answer made that reason moot, how exactly do I do that?
    – jilseego
    Feb 9, 2012 at 14:35

1 Answer 1


Are you sure you want to do it programmatically? You can just create the Content Type and use Permissions to control which user's roles can add/edit/delete that type of content.

  • Well, I'd like the form to be embed-able anywhere in a page just like a widget. I don't want to provide the whole admin interface in creating the node. Could the method you suggest accomplish that?
    – jilseego
    Feb 9, 2012 at 14:42
  • Sure, for instance you can use Page and Panels modules to put the form anywhere within the page content.
    – dxvargas
    Feb 9, 2012 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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