[WORKING] mosDBTable->publish_array

Last reviewed: Not reviewed
phpDocumentor

mosDBTable->publish_array

Generic publish/unpublish function.  Returns true if successful; false otherwise.  If returning false then an error message can be retrieved using the mosDBTable->getError function.

Note: In Joomla! 1.0.4 this method does not return a boolean and so it is not possible to determine if the method succeeded or not.

Syntax

boolean publish_array ( array $id [, int $publish [, int $myid ]] )

$id
is an array of primary keys for records to be published or unpublished.  If the array is empty then publish_array will return false.
$publish
is 0 to unpublish or 1 to publish.  This parameter is optional and if omitted will default to 1 (publish).
$myid
is the id of the user performing the operation.  This parameter is optional and if omitted will default to 0.

Examples

Example: In this example menu records with particular item id's are unpublished.

global $database, $my;
 
// Declare an instance of the menu class.
$menu = new mosMenu( $database );
 
// Create an array of record id's to be unpublished.
$idarray = array( 2, 3, 5 );
 
// Unpublish the menu records with these id's.
$menu->publish_array( $idarray, 0, $my->id );

Please report any errors on this page to the Developer Documentation Forum.

Last Updated ( Monday, 25 December 2006 )