Plz help with confirm_form . Newbie here

udrulz - June 13, 2009 - 08:34

i got a form just like the comment approval queue form, only this one is for "blogs". Theres a drop down 1)publish 2) delete
So, when the user selects delete, it should show the confirm_form .. Somehow, it displays NOTHING.

The original form:

<?php
/**
* @desc Form submit function
*/
function moderation_queueform_submit($form, &$form_state)
{
   
$nid = current(($form_state['values']['blogs'])) ;
    if(
$form_state['values']['blogs'])
    {
        if(
$form_state['values']['operation'] == "publish") //user chooses publish
       
{
           
$query = " UPDATE {node} n SET n.status = %d, n.moderate = %d";
            if(
count($form_state['values']['blogs']) > 1) //Multiple select
           
{
               
$where = " WHERE n.nid IN (";               
                foreach(
$form_state['values']['blogs'] as $nid => $value)
                {
....
?>

the first IF part is fine..

ELSE IF:

<?php
....
else if(
$form_state['values']['operation'] == "delete")
        {
           
blog_deletion($nid);
            return;          
        }                                 
            
    }
   
cache_clear_all();      
   
drupal_set_message(t($query),'warning');       
   
$form_state['redirect'] = "admin/content/blogs";
?>

In

blog deletion

function

<?php
function blog_deletion($nid)
{
   
$blogObj = node_load($nid);
    if(
is_object($blogObj) && is_numeric($nid))
    {
       
//$output = drupal_get_form('blog_delete_confirm',$blogObj);       
       
drupal_goto("admin/content/blogs/delete");
       
//drupal_execute('blog_delete_confirm',$blogObj);
   
}
}
?>

None of the three work!..

I've even created a MENU_CALLBACK still it shows a blank page..

<?php
$items
['admin/content/blogs/delete'] = array(
   
'title' => 'Delete Blog',
   
'description' => 'The blogs which are to be deleted',
   
'page callback' => 'drupal_get_form',
   
'page arguments' => array('blog_delete_confirm'),
   
//'access arguments' => array('moderate blogs'),
   
'type' => MENU_CALLBACK,
   
'file' => 'moderator.approval.admin.inc',
    );
?>

My confirmation form looks like this

<?php

function blog_delete_confirm($blogObj)
{
   
$form = array();
   
$form['#blogDel']  = $blogObj;
   
    return
confirm_form ($form,
   
t('Are you sure you want to delete this blog?'),
   
'blogs/approval',
   
t('This action cannot be undone'),
   
t('Delete'),
   
t('Cancel'),
    (
'blog_delete_confirm')
    );
}
?>

Please, any help would be appreciated.. I've searched the forums and i found one such post, tried its solution, still did not work. The drupal_goto was the solution posted there and a MENU_CALLBACK..Some mistake I am making, and i am having a hard time figuring it out...

 
 

Drupal is a registered trademark of Dries Buytaert.