Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
Can't call adminapi_delete
  • Posted: 17.01.2006, 06:33
     
    sbszine
    rank:
    Freshman Freshman
    registered:
     January 2005
    Status:
    offline
    last visit:
    14.02.06
    Posts:
    33
    Howdy

    I'm tinkering with a module at the moment, and while I can create items (with adminapi_create) I can't seem to delete them (with adminapi_delete).

    The adminapi_delete function as it stands is just a die() statement to let me know that it's being called, so I know that there's nothing amiss there. Here's the code anyway:

    Code

    function Dubplate_adminapi_delete( $ahDeleteProdInfo )
    {
        die( "in adminapi_delete" );
    }



    Code

    if( !pnModAPILoad( 'Dubplate', 'admin' ) )
    {
            pnSessionSetVar( 'errormsg' , pnVarPrepHTMLDisplay( _LOADFAILED ) );
            pnRedirect( pnModURL( 'Dubplate', 'admin', 'view' ) );
            return true;
    }

    $lbSuccess = pnModAPIFunc( 'Dubplate', 'adminapi', 'delete',
                                array( 'id' => $loProd->getID() )
                             );

    die( "returned from adminapi" );


    I'm certain that the API is loading (I've tested that with die() statements), and the pnModAPIFunc arguments seem okay (the 'id' resolves to its expected value, an integer). But when I run the code above, it goes stright through to "returned from adminapi".

    The only real difference between the delete code and my create code is the 'id' argument. Is 'id' perhaps a reserved word? Any thoughts?
  • Posted: 17.01.2006, 12:25
     
    Simon
    rank:
    Steering Committee Steering Committee
    registered:
     December 2002
    Status:
    offline
    last visit:
    23.11.08
    Posts:
    13415

    Quote

    $lbSuccess = pnModAPIFunc( 'Dubplate', 'adminapi', 'delete',
    array( 'id' => $loProd->getID() )
    );


    The pnModAPIFunc call wants to know the type of API you want to call, so you should have 'admin' rather than 'adminapi' in the above. The PostNuke core will add the API suffix automatically.

    --
    Regards,
    Simon

    itbegins.co.uk - Zikula Consulting

    Please read the Support Guide
  • Posted: 17.01.2006, 17:50
     
    cannibus
    rank:
    Helper Helper
    registered:
     November 2004
    Status:
    offline
    last visit:
    20.09.08
    Posts:
    401
    curious as to what kind of module u building? 8)
  • Posted: 14.02.2006, 10:16
     
    sbszine
    rank:
    Freshman Freshman
    registered:
     January 2005
    Status:
    offline
    last visit:
    14.02.06
    Posts:
    33
    Thanks Simon -- I'll give it a go.

    As for what the module does, it's an mp3 upload module for unsigned musicians. It's for a drum n bass site, hence the name.

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula