solved Invalid item array received after deleting a single uploaded file

alt=
@dobmat
10 years ago
93 posts
Hi

In my module I have a delete button to delete individual files uploaded in an item of module. But after delete the redirect shows item detail page with error "Invalid Item Array Received".

The $_items array is set to false which is why it is showing the error. I'm following the example of jrGallery for my module. Below is the delete function in my module index.php,

jrUser_session_require_login();
jrCore_validate_location_url();

if (!isset($_post['id']) || !jrCore_checktype($_post['id'], 'number_nz')) {
jrCore_set_form_notice('error', 14);
jrCore_form_result('referrer');
}
$_rt = jrCore_db_get_item('gsVenue', $_post['id']);
if (!jrUser_can_edit_item($_rt)) {
jrUser_not_authorized();
}
jrCore_db_delete_item('gsVenue', $_post['id']);
//jrProfile_reset_cache();
jrCore_form_result("{$_conf['jrCore_base_url']}/{$_user['profile_url']}/{$_post['module_url']}/{$_post['id']}/{$_rt['venues_title_url']}");

Note that the item representing the file in the database is deleted. Please suggest what I can do about this.

Thanks.
updated by @dobmat: 06/25/14 02:11:58PM
SteveX
SteveX
@ultrajam
10 years ago
2,584 posts
It looks like you need to use a different url in jrCore_form_result as you are sending the browser to the detail page of the item you just deleted.


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
alt=
@dobmat
10 years ago
93 posts
Yeah, I noticed the URL is pointing to the deleted item. I changed it. Its working now.

Thanks.

Tags