Mod Dev Q: Not deleteing...

For some reason, when confirmed, this is not sending the value of $asn through. It's showing fine when it's first loaded, but not passing through on confirm..

Code

function pnSerialTracker_user_delete( $args )
{
                 list( $asn, $confirmation ) = pnVarCleanFromInput( 'asn', 'confirmation' );
                 extract( $args );
                 $output = new pnHTML();
                 $output->SetInputMode( _PNH_VERBATIMINPUT );
                 $output->Text( pnSerialTracker_usermenu() );
                 $output->SetInputMode( _PNH_PARSEINPUT );
                 if ( !pnModAPILoad( 'pnSerialTracker', 'user' ) )
                {
                                 pnSessionSetVar( 'errormsg', _LOADFAILED );
                                 return $output->GetOutput();
                                 }
                if ( empty( $confirmation ) )
                {
                                 $output->Title( _PNSTDELETEITEM );
                                 $output->ConfirmAction( _PNSTSURE . $asn ,
                                                 pnModURL( 'pnSerialTracker',
                                                                 'user',
                                                                 'delete ' ),
                                                 _CANCELITEMDELETE,
                                                 pnModURL( 'pnSerialTracker',
                                                                 'user',
                                                                 'do_search',
                                                                 array( 'loc' => 1,
                                                                                 'term' => pnUserGetVar( uname ) )
                                                                 ) );
                                 return $output->GetOutput();
                                 }
                if ( !pnModAPILoad( 'pnSerialTracker', 'user' ) )
                {
                                 $output->Text( _LOADFAILED );
                                 return $output->GetOutput();
                                 }
                if ( pnModAPIFunc( 'pnSerialTracker',
                                                 'user',
                                                 'delete_item',
                                                 array( 'asn' => $asn ) ) )
                {
                                 pnSessionSetVar( 'statusmsg', _PNSTITEMDELETED );
                                 }
                pnRedirect( pnModURL( 'pnSerialTracker',
                                                                 'user',
                                                                 'do_search',
                                                                 array( 'loc' => 1,
                                                                                 'term' => pnUserGetVar( uname ) )
                                                                 ) );
                 return true;
                }


--
Home Page | Find on Facebook | Follow on Twitter
I have no clue what this module is, but the first thing I would ask is why you are loading the API twice. Then I would want to look at the code that called the user_delete function to see if it is passing a value for asn that is overwriting the value that you get from pnVarCleanFromInput() when you do the extract($args); Then I would want to see the delete_item function to make sure that it wasn't that function that was losing the value.

Right off hand it looks like this function should work.

-Chris
Take that back. Change this:

Code

pnModURL( 'pnSerialTracker',
                                                  'user',
                                                  'delete ' ),

To be:

Code

pnModURL( 'pnSerialTracker',
                                                  'user',
                                                  'delete ',
                                                 array('asn'=>$asn) ),

inside this block:

Code

if ( empty( $confirmation ) ) { }


-Chris
That took care of part of it, totally missed that there was also a space after delete, and that was also a problem.

--
Home Page | Find on Facebook | Follow on Twitter