With this modification you can add in "ACP -> Add Categories " several categories with one single click !
if i have 400 category i must lose days with simple procedure ...
modify function for multiple category/subcategory one time, one click !!!
========= This is my modification code for this job ===========
if (empty($error)) {
$cat_name_array = explode('|', $cat_name);
$cat_name_count = count($cat_name_array);
for ($i=0;$i<$cat_name_count;$i++)
{
$cat_name = $cat_name_array[$i];
/** Start ADD **/
if (!$cat_order) {
$sql = "SELECT cat_order
FROM ".CATEGORIES_TABLE."
WHERE cat_parent_id = $cat_parent_id
ORDER BY cat_order DESC
LIMIT 1";
$catorder = $site_db->query_firstrow($sql);
$cat_order = $catorder['cat_order'] + 10;
$do_update_cat_order = 0;
}
else {
$do_update_cat_order = 1;
}
$sql = "INSERT INTO ".CATEGORIES_TABLE."
(cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment)
VALUES
('$cat_name', '$cat_description', $cat_parent_id, $cat_order, $auth_viewcat, $auth_viewimage, $auth_download, $auth_upload, $auth_directupload, $auth_vote, $auth_sendpostcard, $auth_readcomment, $auth_postcomment)";
$result = $site_db->query($sql);
$cat_id = $site_db->get_insert_id();
if ($result && $cat_id) {
if ($do_update_cat_order) {
update_cat_order($cat_parent_id);
}
$msg = $lang['cat_add_success'];
create_cat_folder(MEDIA_PATH."/".$cat_id, CHMOD_DIRS);
create_cat_folder(THUMB_PATH."/".$cat_id, CHMOD_DIRS);
}
else {
$msg = $lang['cat_add_error'];
}
/** End ADD **/
// echo $cat_name.' , ';
} // end FOR!
forward_to_modify($msg);
}
modification in:
admin/categories.phpposition: in body "savecat"
action: if ($action == "savecat") {so....
now you can enter categories like this example:
Animals|Cars|Bussines|Nature|Musical|Sports|Abstract|Art|People|Objects|Musical|Food|Education
and .. done ... 13 categories with only 1 click !!!
This modification works here :
http://www.findavatar.com
Edited by mawenzi :
- how to add the modification :
here- how to add APC description extension :
here