This site uses cookies and similar technologies.

If you don't change browser settings, you agree to it.

I understand
Announcement: Please use Github, to report any new issue or pull request.
None
Givx - RG
2013-10-29

Implement onCCK_Storage_LocationDelete. If i use Seblod without article bridge, i don't create manager on the frond site for edit or delete. 

My code for use plugin link delete on my front manager in the file plugin/cck_storage_location/free/free.php

public static function onCCK_Storage_LocationDelete( $pk, &$config = array() )

{

             

$app=JFactory::getApplication();

                $db             =       JFactory::getDbo();

                $query          =       $db->getQuery( true );

                $query->select('id')

                        ->from('#__cck_core')

                        ->where($db->quoteName('pk').'='.$db->quote($pk))

                        ->where($db->quoteName('cck').'='.$db->quote($config['type']));

                $db->setQuery($query);

                $id = $db->loadResult();

                $core=JCckTable::getInstance( '#__cck_core', 'id' );

                $core->load($id);

               

                $table=self::_getTable( $pk , $core->storage_table);

if ( !$table ) {

return false;

}

// Check

$user =JCck::getUser();

$canDelete=$user->authorise( 'core.delete', 'com_cck.form.'.$config['type_id'] );

$canDeleteOwn=$user->authorise( 'core.delete.own', 'com_cck.form.'.$config['type_id'] );

if ( ( !$canDelete && !$canDeleteOwn ) ||

( !$canDelete && $canDeleteOwn && $config['author'] != $user->get( 'id' ) ) ||

( $canDelete && !$canDeleteOwn && $config['author'] == $user->get( 'id' ) ) ) {

$app->enqueueMessage( JText::_( 'COM_CCK_ERROR_DELETE_NOT_PERMITTED' ), 'error' );

return;

}

               

                if ( !$table->delete( $pk ) || !$core->delete( $id )) {

return false;

}

               

                return true;

                // todo

//return false;

}


Need some help?

Comments