Delete item from frontend - front end delete article

More
13 years 9 months ago #9038 by cden
Hi

I am able to create / edit items from front end using flexicontent. Unfortunately I do not see how to delete any items. All I can do is unpublish (but that shows all items still when I am logged in, which when I add a lot of content means the list is long). Or i can move to another category (but that means that they will build up long list of content also, and be searchable).

I need to be able to remove items completely from the front end.

Is this possible with flexicontent?

Do i need flexiaccess for this feature to be enabled with flexicontent?

Thanks

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago #9048 by yopyop001
Hi,

I think it's not possible to delete items from front-end even if you use Flexiaccess.

May be i'm wrong, but i didn't find this functionnality. May be you can post it in the feature request topic.

Regards

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago #9051 by cden
I would have thought it would be natural to have this feature, without the need to request as it seems only natural that users would want to add, edit and delete their content.

I'll pop it in the feature request topic anyhow and hopefully Emmanuel enables it quickly!

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago #9218 by micker
but for security .... maybe a unpublish option ?

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
13 years 6 months ago #11318 by visionears
We had the same problem with some clients. Mostly when we create a site for a client we only give them frontend access. I think frontend deleting items should be included in the components too.

Workaround
I created a piece of code that makes it possible to delete items from the frontend. You need to install Jumi for this solution, please ensure you have a newer version (e.g. 2.0.6). After the installation of Jumi you can paste the code below in a Jumi Module and publish the module somewhere in your template (e.g. above the <jdoc:include type="component" /> tag.

The delete function can only be used by Managers, Administrators and Super Administrators. If you want other frontend users to be able to delete items you should edit the first if statement.

This piece of code was tested with Joomla 1.5.21 with Flexicontent 1.5.3c.
Code:
<? global $Itemid, $mainframe; $user =& JFactory::getUser(); if($user->gid == 23 || $user->gid == 24 || $user->gid == 25) { $option = JRequest::getVar('option',null); $id = JRequest::getVar('id', null, 'get'); $cid = JRequest::getVar('cid', null); $delete_item = JRequest::getVar('id', null, 'post','int'); $view = JRequest::getVar('view', null); if($option == 'com_flexicontent' && $view == 'items' && is_numeric($delete_item)) { $delete_items[] = $delete_item; $link = 'index.php?option=com_flexicontent&view=category&cid=' . $cid; if(delete($delete_items)) { $mainframe->redirect($link, 'Item deleted', 'notice'); } else { $mainframe->redirect($link, 'Item not deleted', 'error'); } } elseif($option == 'com_flexicontent' && $view == 'items') { echo '<form id="delete_item" name="delete_item" action="" method="post"> <input type="hidden" name="id" value="' . $id . '" /> <input type="hidden" name="cid" value="' . $cid . '" /> <input type="button" class="button" value="Delete item" onclick="if(confirm(\'Are you sure you want to delete this item?\')) this.form.submit(); else return false;" /> </form>'; } } /* The next function is copied from /administrator/components/com_flexicontent/models/items.php The database object was added in the function and the setquery function was modified to use the db object. */ /** * Method to remove an item * * @access public * @return boolean True on success * @since 1.0 */ function delete($delete_item) { if (count( $delete_item )) { $db =& JFactory::getDBO(); $delete_items = implode( ',', $delete_item ); $query = 'DELETE FROM #__content' . ' WHERE id IN ('. $delete_items .')' ; $db->setQuery( $query ); if(!$db->query()) { $this->setError($db->getErrorMsg()); return false; } // remove items extended $query = 'DELETE FROM #__flexicontent_items_ext' . ' WHERE item_id IN ('. $delete_items .')' ; $db->setQuery( $query ); if(!$db->query()) { $this->setError($db->getErrorMsg()); return false; } //remove assigned tag references $query = 'DELETE FROM #__flexicontent_tags_item_relations' .' WHERE itemid IN ('. $delete_items .')' ; $db->setQuery($query); if(!$db->query()) { $this->setError($db->getErrorMsg()); return false; } //remove assigned category references $query = 'DELETE FROM #__flexicontent_cats_item_relations' .' WHERE itemid IN ('. $delete_items .')' ; $db->setQuery($query); if(!$db->query()) { $this->setError($db->getErrorMsg()); return false; } // delete also fields in fields_item relation $query = 'DELETE FROM #__flexicontent_fields_item_relations' . ' WHERE item_id IN ('. $delete_items .')' ; $db->setQuery( $query ); if(!$db->query()) { $this->setError($db->getErrorMsg()); return false; } // delete also versions $query = 'DELETE FROM #__flexicontent_items_versions' . ' WHERE item_id IN ('. $delete_items .')' ; $db->setQuery( $query ); if(!$db->query()) { $this->setError($db->getErrorMsg()); return false; } $query = 'DELETE FROM #__flexicontent_versions' . ' WHERE item_id IN ('. $delete_items .')' ; $db->setQuery( $query ); if(!$db->query()) { $this->setError($db->getErrorMsg()); return false; } // delete also item ACL if (FLEXI_ACCESS) { $query = 'DELETE FROM #__flexiaccess_acl' . ' WHERE acosection = ' . $db->Quote('com_content') . ' AND axosection = ' . $db->Quote('item') . ' AND axo IN ('. $delete_items .')' ; $db->setQuery( $query ); } if(!$db->query()) { $this->setError($db->getErrorMsg()); return false; } return true; } return false; } ?>

Hope this will help some people :)

Please Log in or Create an account to join the conversation.

More
13 years 6 months ago #11320 by micker
cool great !
it possible to insert this in core file ?
thank for solution

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.291 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline