MOD 2.02 User Categories AreaThis mod was a big undertaking on my part out of necessity to use on my own website.
I saw other attempts to create this but they leave out things I needed so I borrowed their creations and made them work nicely together along with some of my own improvements
This mod makes changes to your database so please backup and test on a testing server before undertaking a public site!! You have been warned!!!The mods that I used to create this one are…
http://www.4homepages.de/forum/index.php?topic=18564.0[MOD] V1.3 Let users add (sub-)categories / User erstellen (Sub-)Kategorien
http://www.4homepages.de/forum/index.php?topic=20657.0[MOD] - Multiupload (thunderstrike version)I actually used the attachment on reply #35 of this thread, it worked fine for me.
Version 2.0 has added support for dropdown fields for additional user field MODhttp://www.4homepages.de/forum/index.php?topic=7112.0[MOD] Dropdown options for custom database fieldsand
http://www.4homepages.de/forum/index.php?topic=7385.0[MOD] Select country and gender with gif when register as my test fields.
you will need to install at least the first one to work with this mod. If you do not use these mods, my script will detect that and just not let you use that part of the setup.
Could not remember link of mod that I used but it was the auto resize mod with big folder mod
(if you need to use make sure you add all of this mod to your site first)What does this mod do?1. As administrator you can create a category that will house user categories of your choosing that they can upload files to and create/delete categories of their choosing under their user area.
1a.
(NEW IN VER 2.0) Administrator can now set home categories based on additional_user_fields Dropdown lists MOD
2. You can set each user as either direct upload or validation on files.
3. When you give a user permission the system will create their category for them under the category that you choose in admin panel and give them the correct permissions to modify under their own sub categories.
3a.
(NEW IN VER 2.0) You can set settings so any new user can create an area without your input
4. You can have a log of category creation/deletions created for this area to see if you have any problems with certain users.
5. With the multiupload mod added to this mod, the users can upload more than one file at a time.
6. I have added the big folder mod for uploading (can be turned on/off)
7. I have added if no image name inserted then it will use the filename instead (can be turned on/off)
8. Mod is template friendly (at least the templates I was playing with)
9. Look at screen shots attached to understand MOD better (Sorry, no demo site)
I have tested this mod on a fresh install of 4images 1.7.7 using the default template and everything works as it should.
A couple of notes before you get started.1. I have always noticed that in the auto resize big folder mod, unless I installed in incorrectly, it would copy the original file to the big folder and resize the image to the max values set in the admin panel and displayed in the upload form. For the end user, I needed it to give them a max upload value like 1920X1200 and resize down to 480X480 for the details page, so I set the admin panel to 1920X1200 and in the constants.php file I made two new values of 480X480 for the details page. The end user now sees the 1920X1200 on the upload form and errors out when they try to upload bigger and I still get smaller file on my detail page. In order for this to work I had to do this modification to original auto resize mod
In the
includes/upload.php file
look for
if ($this->auto_image[$this->image_type]) {
$ok = 1;
}
replace with…
/*if ($this->auto_image[$this->image_type]) {
$ok = 1;
}*/
If you do not make this modification then the user can upload any dimension file they want as long as it does not reach the megabyte file size limit set in the admin panel.
2. I saw the [all in one] mod that does watermarks and histograms as well as the resize on upload; I do not use them so I have never installed that mod. If enough people ask I may install it and see how to insert that code into this mod.
3. I am not sure how this stands up in security. I tried all hacks I could think of and it seems pretty stable/secure,
4. If you look at the addition to the style.css file, you should be able to modify the colors/fonts to fit into your site without modifying a bunch of my code.
5. To make this mod fit into your template better, instead of using my
user_categoriesform.html file, use one of your templates other main display files and place this information in the main body of the page and save it as
user_categoriesform.html and it should work.
<span class="title">{lang_user_area}</span>
<hr size="1" />
{content}
{msg}
Revisions history…2.02 major mistake in my coding regarding sessionsChanged files in version 2.02Added new lang data to main.php file so admin.php language is not needed for end users and used just for the admin panel.
Please download new zip file for the changed files and also place the new language data in the main.php file.
- changed user_multiupload.php in zip file.
- changed includes/user_functions.php in zip file.
- changed templates/default/member_user_multiupload_content.html in zip file.
2.01 major mistake in my coding,Changed files in version 2.01Please download new zip file
- changed user_categories.php in zip file
- changed user_multiupload.php in zip file.
- changed includes/user_functions.php in zip file.
2.00 Added support for additional_user_fields dropdown MOD, cleaned some of the code up a little1.03 found error when I added Captcha, updated user_categories.php file in zip file again.1.02 found error in the database install file. please read note at bottom of post1.01 added Captcha to adding new categories to stop automated scripts from killing site
Changed files in version 1.01
- changed user_categories.php in zip file, please download new file
- changed Global.php, look at first two changes in mods to see what is different
1.0 first try at it.Things I would like to see added/modified are…1. the [all in one mod] to handle everyone’s needs.
2. Would like a plug-in in the admin panel that could list all users with fields to change multiple settings for this mod in one shot like the batch image edit mod that V@no created.
3. make the log better, not sure if I did it correctly but it works for my purposes.
4. would like to give users the ability to move images between their own categories (don’t even know where to begin on that one) for now, they can just contact the admin to do it.
If you are ready to begin adding this mod, let’s get started…
Warning (NOT a 5 minute install) Took me 5 weeks to get it running this smooth for you…
BACKUP YOUR DATABASE AND FILES BEFORE YOU START!New files added included in attached zip file…install_user_categories.php
(delete after you run this file once!)user_categories.php
(UPDATED FILE FOR VER 2.0)user_multiupload.php
includes/user_functions.php
(UPDATED FILE FOR VER 2.0)admin/plugins/user_categories_mod.php
(NEW FILE FOR VER 2.0)templates/your template folder/user_categoriesform.html
templates/your template folder/member_user_multiuploadform.html
templates/your template folder/member_user_multiuploadform_select.html
templates/your template folder/member_user_multiupload_content.html
templates/your template folder/images/user_multiupload.gif
templates/your template folder/images/user_multiupload_off.gif
templates/your template folder/images/folder_path.gif
Place the install_user_categories.php file in your gallery root directory and run the file to add the fields to your databases.
Delete this file from your root after you run it!(Do not need to run this installer is upgrading from version 1.03 to 2.0 version of this mod)
The following fields are created in case you need to remove them for troubleshooting
Settings table- - user_submitted_enable
- user_submitted_maincat
- user_submitted_default_direct
- user_submitted_log
- user_multiupload_size
- user_submitted_default_create (NEW FOR ver2.0, will be autocreated if not there)
Groupaccess table- Categories table- Users table-- user_submitted_allow
- user_submitted_direct
- user_submitted_parent
The following files are modified (BACKUP FIRST!)Categories.php
Global.php
Login.php (maybe?)
Logout.php (maybe?)
registar.php
(new to list for ver 2.0)Admin/admin_functions.php
(new to list for ver 2.0)Admin/categories.php
Admin/settings.php
(mod can be removed from this file for ver 2.0)Admin/usergroups.php
Includes/auth.php
Includes/constants.php
Includes/db_field_definitions.php
Includes/functions.php
Includes/page_header.php
Includes/sessions.php
Lang/English/main.php
Lang/English/admin.php
Templates/your template/categories.html
Templates/your template/style.css
Start of modifications...in
admin/admin_functions.php file...
(New Modification for ver 2.0)look for...
show_input_row($val[0], $field_name, $value);
Replace with
//MOD User Categories
if (substr($field_name,0,21)=='user_submitted_parent'){
show_user_parent_input_row($val[0],$field_name,$value);
}
else{
show_input_row($val[0], $field_name, $value);
}
//END MOD User Categories
look for...
?>
insert
Before//MOD User Categories
function show_user_parent_input_row($title, $name, $value = "", $size = "") {
global $HTTP_POST_VARS;
if (isset($HTTP_POST_VARS[$name])/* && $value == ""*/) {
$value = stripslashes($HTTP_POST_VARS[$name]);
}
echo "<tr class=\"".get_row_bg()."\">\n<td><p class=\"rowtitle\">".$title."</p></td>\n<td><p>".show_user_parent_dropdown_list_mod($name,$value)."</p></td>\n</tr>\n";
}
function show_user_parent_dropdown_list_mod($setting_name, $setting_value){
$var = get_user_parent_dropdown_mod($setting_value,$setting_name);
return $var;
}
function get_user_parent_dropdown_mod($cat_id,$setting_name) {
global $lang, $drop_down_cat_cache, $cat_parent_cache;
$category = "\n<select name=\"".$setting_name."\" class=\"categoryselect\">\n";
$category .= "<option value=\"0\">".$lang['no_category']."</option>\n";
$category .= "<option value=\"0\">-------------------------------</option>\n";
$drop_down_cat_cache = array();
$drop_down_cat_cache = $cat_parent_cache;
$category .= get_user_category_dropdown_bits($cat_id);
$category .= "</select>\n";
return $category;
}
//END MOD User Categories
in
admin/categories.php file...
look for
"auth_postcomment" => AUTH_USER
replace with
"auth_postcomment" => AUTH_USER,
"auth_user_manage" => AUTH_ACL
look for
$error_log[] = $lang['cat_delete_error']." <b>".format_text($cats['cat_name'], 2)."</b> (ID: ".$cats['cat_id'].")";
}
insert
after //MOD User Categories
$sql = "UPDATE ".USERS_TABLE."
SET user_submitted_parent = 0
WHERE user_submitted_parent = ".$cats['cat_id'];
$site_db->query($sql);
//END MOD User Categories
look for
$error_log[] = $lang['cat_delete_error']." <b>".format_text($cat_cache[$cat_id]['cat_name'], 2)."</b> (ID: ".$cat_id.")";
}
insert
after //MOD User Categories
$sql = "UPDATE ".USERS_TABLE."
SET user_submitted_parent = 0
WHERE user_submitted_parent = ".$cat_id;
$site_db->query($sql);
//END MOD User Categories
look for
Twice $auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];
insert
after both places
$auth_user_manage = $HTTP_POST_VARS['auth_user_manage'];
look for
(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
replace with
(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, auth_user_manage
look for
('$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";
replace with
('$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, $auth_user_manage
look for
$sql = "SELECT cat_name, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
replace with
$sql = "SELECT cat_name, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, auth_user_manage
look for
SET cat_name = '$cat_name', cat_description = '$cat_description', cat_parent_id = $cat_parent_id, cat_order = $cat_order, cat_hits = $cat_hits, auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcomment
replace with
SET cat_name = '$cat_name', cat_description = '$cat_description', cat_parent_id = $cat_parent_id, cat_order = $cat_order, cat_hits = $cat_hits, auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcomment, auth_user_manage = $auth_user_manage
look for
$sql = "SELECT cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
replace with
$sql = "SELECT cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, auth_user_manage
look for
twice$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
replace Both with
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, auth_user_manage
in the
admin/settings.php file
(no longer needed for Ver 2.0) (mods can be removed from this file)look for
// end of functions
insert
before (Remove this code for ver 2.0)
//MOD user categories
function show_category_dropdown_list($setting_name, $setting_value){
$var = get_user_category_dropdown($setting_value,"",2);
echo $var;
}
function show_user_submitted_log_options($setting_name, $setting_value) {
global $user_submitted_log_optionlist;
foreach ($user_submitted_log_optionlist as $key => $val) {
echo "<input type=\"radio\" name=\"setting_item[".$setting_name."]\" value=\"$key\"";
if ($setting_value == $key) {
echo " checked=\"checked\"";
}
echo "> ".$val."<br />";
}
}
//END MOD user categories
look for
show_form_footer($lang['save_changes'], "", 2);
}
insert
before (Remove this code for ver 2.0)
// MOD user Categories area
show_table_separator($setting_group[XX], 2, "setting_group_XX");//replace XX with next number in sequence looking at above $setting_group
show_setting_row("user_submitted_enable","radio");
show_setting_row("user_submitted_maincat","show_category_dropdown_list");
show_setting_row("user_submitted_default_direct", "radio");
show_setting_row("user_submitted_log", "show_user_submitted_log_options");
show_setting_row("user_multiupload_size");
//END MOD user Categories area
look at $setting_group[##] before this insert and add 1 to the number and replace both XX in the above insert with that new number
Write this new number down for later insert!
example, if last number is 10 your line from insert above should look like this...
show_table_separator($setting_group[11], 2, "setting_group_11");//replace XX with next number in sequence looking at above $setting_group
in
admin/usergroups.php file
look for
"auth_postcomment"
replace with
"auth_postcomment",
"auth_user_manage"
look for
$auth_postcomment = (isset($auth[$key]['auth_postcomment']) && $auth[$key]['auth_postcomment'] == 1) ? 1 : 0;
insert
after $auth_user_manage = (isset($auth[$key]['auth_user_manage']) && $auth[$key]['auth_user_manage'] == 1) ? 1 : 0;
look for
if ($auth_viewcat || $auth_viewimage || $auth_download || $auth_upload || $auth_directupload || $auth_vote || $auth_sendpostcard || $auth_readcomment || $auth_postcomment) {
$sql = "INSERT INTO ".GROUP_ACCESS_TABLE."
(group_id, cat_id, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment)
VALUES
($group_id, $key, $auth_viewcat, $auth_viewimage, $auth_download, $auth_upload, $auth_directupload, $auth_vote, $auth_sendpostcard, $auth_readcomment, $auth_postcomment)";
replace with.. (make sure you do not have any other mod fields added in this area, you will need to re-add them)
if ($auth_viewcat || $auth_viewimage || $auth_download || $auth_upload || $auth_directupload || $auth_vote || $auth_sendpostcard || $auth_readcomment || $auth_postcomment || $auth_user_manage) {
$sql = "INSERT INTO ".GROUP_ACCESS_TABLE."
(group_id, cat_id, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, auth_user_manage)
VALUES
($group_id, $key, $auth_viewcat, $auth_viewimage, $auth_download, $auth_upload, $auth_directupload, $auth_vote, $auth_sendpostcard, $auth_readcomment, $auth_postcomment, $auth_user_manage)";
in
registar.php file
(New modification for ver 2.0)look for
$activationkey = get_random_key(USERS_TABLE, get_user_table_field("", $user_table_fields['user_activationkey']));
insert
Before //MOD User Categories
$additional_field_sql .= ", user_submitted_allow, user_submitted_direct, user_submitted_parent";
$additional_value_sql .= ", '".$config['user_submitted_default_create']."', '".$config['user_submitted_default_direct']."', '0'";
//END MOD User categories
in
global.php file
look for
$captcha_path = ROOT_PATH.'captcha';
insert
before changed in version 1.01$captcha_enable_user_multiupload = 0;//set to what you want it to be
$captcha_enable_user_category_add = 1;//set to what you want it to be
look for
if (!$captcha_enable) {
$captcha_enable_comments = 0;
$captcha_enable_upload = 0;
insert
after changed in version 1.01 $captcha_enable_user_multiupload = 0;
$captcha_enable_user_category_add = 0;
look for
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
replace with
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment,auth_user_manage
in
categories.php file in your gallery
root directory
look for
//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------
if (!check_permission("auth_upload", $cat_id)) {
$upload_url = "";
$upload_button = "<img src=\"".get_gallery_image("upload_off.gif")."\" border=\"0\" alt=\"\" />";
}
else {
$upload_url = $site_sess->url(ROOT_PATH."member.php?action=uploadform&".URL_CAT_ID."=".$cat_id);
$upload_button = "<a href=\"".$upload_url."\"><img src=\"".get_gallery_image("upload.gif")."\" border=\"0\" alt=\"\" /></a>";
}
replace with
//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------
/*if (!check_permission("auth_upload", $cat_id)) {
$upload_url = "";
$upload_button = "<img src=\"".get_gallery_image("upload_off.gif")."\" border=\"0\" alt=\"\" />";
}
else {
$upload_url = $site_sess->url(ROOT_PATH."member.php?action=uploadform&".URL_CAT_ID."=".$cat_id);
$upload_button = "<a href=\"".$upload_url."\"><img src=\"".get_gallery_image("upload.gif")."\" border=\"0\" alt=\"\" /></a>";
}
*/
if (!check_permission("auth_upload", $cat_id)) {
$upload_url = "";
$upload_button = "<img src=\"".get_gallery_image("upload_off.gif")."\" border=\"0\" alt=\"\" />";
if (isset($config['user_multiupload_size']) && $config['user_multiupload_size'] > 1 ) {
$user_multiupload_url = "";
$user_multiupload_button = "<img src=\"".get_gallery_image("user_multiupload_off.gif")."\" border=\"0\" alt=\"\" />";
}
}
else {
$upload_url = $site_sess->url(ROOT_PATH."member.php?action=uploadform&".URL_CAT_ID."=".$cat_id);
$upload_button = "<a href=\"".$upload_url."\"><img src=\"".get_gallery_image("upload.gif")."\" border=\"0\" alt=\"\" /></a>";
if (isset($config['user_multiupload_size']) && $config['user_multiupload_size'] > 1 ) {
if ($user_info['user_level'] == GUEST) {
$user_multiupload_url = "";
$user_multiupload_button = "<img src=\"".get_gallery_image("user_multiupload_off.gif")."\" border=\"0\" alt=\"\" />";
}
else {
$user_multiupload_url = $site_sess->url(ROOT_PATH."user_multiupload.php?action=multiuploadform&".URL_CAT_ID."=".$cat_id);
$user_multiupload_button = "<a href=\"".$user_multiupload_url."\"><img src=\"".get_gallery_image("user_multiupload.gif")."\" border=\"0\" alt=\"\" /></a>";
}
}
}
look for
"upload_button" => $upload_button,
insert
after "user_multiupload_button" => $user_multiupload_button,
in the
includes/auth.php file
look for
, a.auth_postcomment
replace with
, a.auth_postcomment, a.auth_user_manage
in the
includes/constants.php file
look for
?>
insert
before//MOD user categories
define('USER_BIG_FOLDER' , '/big');//name of directory you are using for big or alternate download directory for big images
define('USER_DETAIL_WIDTH',480);// size width to display on detail page
define('USER_DETAIL_HEIGHT',480);// size height to display on detail page
define('USER_LOG_DIR', 'data/logs'); // directory to store log file in
define('USER_LOG_FILENAME', 'user_categories.log'); //name of log file
define('USER_AUTO_FILENAME', '1');//make 0 if you want to make user put a imageame in or set to 1 to use filename as imagename if left blank
define('USER_CAT_DESC', '1');//1= use auto description for main user cat description or 0 to leave blank
define('USER_AUTO_RESIZE', '1');// 1= use auto resize on upload, 0= do not use
//END MOD user categories
in the
includes/db_field_definitions.php file
look for
?>
insert
before//MOD user categories
$additional_user_fields['user_submitted_allow'] = array("Allowed to create a user category area", "radio", 1);
$additional_user_fields['user_submitted_direct'] = array("Allowed to direct upload to user category area", "radio", 1);
$additional_user_fields['user_submitted_parent'] = array("parent category for this user category area", "text", 1);
//END MOD user categories
in the
includes/functions.php file
look for
?>
insert
before// MOD user categories
function get_user_category_dropdown($cat_id, $jump = 0, $admin = 0, $i = 0) {
global $lang, $drop_down_cat_cache, $cat_parent_cache;
// $admin = 1 Main Cat (update/add cats)
// $admin = 2 All Cats (find/validate images...)
// $admin = 3 Select Cat (update/add image)
// $admin = 4 No Cat (check new images)
switch ($admin) {
case 1:
$category = "\n<select name=\"cat_id\" class=\"categoryselect\">\n";
$category .= "<option value=\"156\">"."Your Main Root Gallery"."</option>\n";
$category .= "<option value=\"156\">--------------</option>\n";
break;
case 2:
$category = "\n<select name=\"setting_item[user_submitted_maincat]\" class=\"categoryselect\">\n";
$category .= "<option value=\"0\">".$lang['main_category']."</option>\n";
$category .= "<option value=\"0\">-------------------------------</option>\n";
$drop_down_cat_cache = array();
$drop_down_cat_cache = $cat_parent_cache;
$category .= get_user_category_dropdown_bits($cat_id);
$category .= "</select>\n";
return $category;
break;
case 3:
$i = ($i) ? "_".$i : "";
$category = "\n<select name=\"cat_id".$i."\" class=\"categoryselect\">\n";
$category .= "<option value=\"0\">".$lang['select_category']."</option>\n";
$category .= "<option value=\"0\">-------------------------------</option>\n";
break;
case 4:
$category = "\n<select name=\"cat_id\" class=\"categoryselect\">\n";
$category .= "<option value=\"0\">".$lang['no_category']."</option>\n";
$category .= "<option value=\"0\">-------------------------------</option>\n";
break;
case 0:
default:
if ($jump) {
$category = "\n<select name=\"".URL_CAT_ID."\" onchange=\"if (this.options[this.selectedIndex].value != 0){ forms['jumpbox'].submit() }\" class=\"categoryselect\">\n";
}
else {
$category = "\n<select name=\"".URL_CAT_ID."\" class=\"categoryselect\">\n";
}
$category .= "<option value=\"0\">".$lang['select_category']."</option>\n";
$category .= "<option value=\"0\">-------------------------------</option>\n";
} // end switch
$drop_down_cat_cache = array();
$drop_down_cat_cache = $cat_parent_cache;
$category .= get_user_category_dropdown_bits($cat_id, $cat_id);
$category .= "</select>\n";
return $category;
}
function get_user_category_dropdown_bits($cat_id, $cid = 0, $depth = 1) {
global $site_db, $drop_down_cat_cache, $cat_cache;
if (!isset($drop_down_cat_cache[$cid])) {
return "";
}
$category_list = "";
foreach ($drop_down_cat_cache[$cid] as $key => $category_id) {
if (check_permission("auth_upload", $category_id)) {
$category_list .= "<option value=\"".$category_id."\"";
if ($cat_id == $category_id) {
$category_list .= " selected=\"selected\"";
}
if ($cat_cache[$category_id]['cat_parent_id'] == 0) {
$category_list .= " class=\"dropdownmarker\"";
}
if ($depth > 1) {
$category_list .= ">".str_repeat("--", $depth - 1)." ".format_text($cat_cache[$category_id]['cat_name'], 2)."</option>\n";
}
else {
$category_list .= ">".format_text($cat_cache[$category_id]['cat_name'], 2)."</option>\n";
}
$category_list .= get_user_category_dropdown_bits($cat_id, $category_id, $depth + 1);
}
}
unset($drop_down_cat_cache[$cid]);
return $category_list;
}
// END MOD user categories
in the
includes/page_header.php file
look for
"url_upload" => (!empty($url_upload)) ? $site_sess->url($url_upload) : $site_sess->url(ROOT_PATH."member.php?action=uploadform"),
insert
after "url_user_multiupload" => (!empty($url_user_multiupload)) ? $site_sess->url($url_user_multiupload) : $site_sess->url(ROOT_PATH."user_multiupload.php"),
look for
//-----------------------------------------------------
//--- User Box ----------------------------------------
//-----------------------------------------------------
if ($user_info['user_level'] >= USER) {
$site_template->register_vars("lang_loggedin_msg", preg_replace("/".$site_template->start."loggedin_user_name".$site_template->end."/siU", format_text($user_info['user_name'], 2), $lang['lang_loggedin_msg']));
insert
after // MOD User categories area
$user_submitted_allowed = 0;
if ($config['user_submitted_enable'] && $user_info['user_submitted_allow']){
$user_submitted_allowed = 1;
}
if ($user_info['user_submitted_parent']==0){
$user_submitted_url = "user_categories.php?action=createuser";
}
else {
$user_submitted_url = "user_categories.php";
}
$site_template->register_vars(array(
"user_submitted_allowed" => $user_submitted_allowed,
"user_submitted_url" => $site_sess->url(ROOT_PATH.$user_submitted_url),
"lang_user_area" => $lang['usercat_user_area']
));
unset($user_submitted_allowed);
unset($user_submitted_url);
//END MOD User categories area
in the
includes/sessions.php file
look for
function logout($user_id) {
global $site_db;
replace with
function logout($user_id) {
global $site_db,$site_sess;
$user_categories_log = $site_sess->get_session_var("user_categories_log");
if(isset($user_categories_log)){
include(ROOT_PATH.'includes/user_functions.php');
$var= user_categories_log_file($user_categories_log);
}
in the
lang/english/admin.php file
look for
?>
insert
before (Updated insert for version 2.0)
// MOD user submited area
$lang['auth_user_manage'] = "User Manage";
$setting["user_submitted_area"] = "User Categories Area";
$setting["user_submitted_enable"] = "Enable user category area";
$setting["user_submitted_maincat"] = "Parent category for this area";
$setting["user_submitted_default_direct"] = "Allow direct upload as default setting";
$setting['user_submitted_log'] = "Would you like to record a log file for user activity?";
$setting['user_submitted_continue']= "Continue";
$user_submitted_log_optionlist = array(
"0" => "No",
"1" => "Yes, Record only errors",
"2" => "Yes, Record all activity"
);
// added for version 2.0
$user_submitted_enable_optionlist = array(
"0" => "No",
"1" => "Yes, Using one main area",
"2" => "Yes, Using category based on Additional User Field Dropdown Mod"
);
$setting['user_multiupload_size'] = "Set max value for user to upload images to gallery";
$setting['user_submitted_maincat_field']="Additional User Field Dropdown Field to use";
$setting['user_submitted_maincat1']="Main User Category Area using \"";
$setting['user_submitted_maincat2']="\" Dropdown Field";
$setting['user_submitted_maincat3']="Main User Category Area";
$setting['user_submitted_default_create']="Allow new users to create area without Admin involvement";
//end MOD user submitted area
in the
lang/english/main.php file
look for
?>
insert
before (modified insert for version 2.0)
//-----------------------------------------------------
//--- User category area -------------------------------------
//-----------------------------------------------------
$lang['usercat_no_rights'] = 'You do not have the permission to access this page!';
$lang['usercat_create_abort'] = 'Your area was not created at this time.';
$lang['usercat_return_gallery'] = 'return to gallery';
$lang['usercat_aborted'] = 'changes were aborted';
$lang['usercat_catname1'] = ''; // this is the name of users main category when it is created(format "$lang['usercat_catname1'].$user_info['user_name'].$lang['usercat_catname2']")
$lang['usercat_catname2'] = ''s collection'; // (default is "username's collection")
$lang['usercat_catdesc1'] = 'This is '; //this is the description of users main category (format "$lang['usercat_catdesc1'].$user_info['user_name'].$lang['usercat_catdesc2']")
$lang['usercat_catdesc2'] = ''s collection of uploaded files.'; // (default is "This is username's collection of files.")
$lang['usercat_deletehead'] = 'Summary of Deleting Categories';
$lang['usercat_create_main'] = 'Your area has not been created yet';
$lang['usercat_create_question'] = 'Do you wish to create your area now?';
$lang['usercat_area']= 'Your user area</span>';
$lang['usercat_editcat'] = 'Editing categories';
$lang['usercat_inside'] = ' inside ';
$lang['usercat_user_area'] = 'Your User Area';
$lang['usercat_edit'] = "[Edit]";
$lang['usercat_delete'] = "[Delete]";
$lang['usercat_add'] = "[Add Subcategory]";
$lang['usercat_upload'] = "[Upload Files]";
$lang['user_multiupload_file_title'] = "File no. ";
$lang['user_multiupload_select'] = "Select the number of images for upload:<br /><span class=\"smalltext\"><font color=\"red\">Note:</font> Check all field before upload.</span>";
$lang['user_multiupload_select_title'] = "Multiupload - select";
$lang['user_multiupload_file'] = "Multiupload files";
$lang['user_multiupload_empty_filename'] = "<br><span class='smalltext'>Will use filename if left blank</span>";
$lang['usercat_no_rights2'] = 'Based on your selections in your profile, You do not have the permission create an user area. Please contact Admin if you feel this is an error';
$lang['sub_categories'] = "Subcategories";
$lang['no_subcategories'] = "No subcategories added";
$lang['delete_cat_confirm'] = "Do you want to delete this category?<br />All subcategories as well as attached images and comments will be deleted!";
$lang['delete_cat_files_confirm'] = "Delete all image files from the server?";
$lang['cat_add_success'] = "Category added";
$lang['cat_add_error'] = "Error adding category";
$lang['cat_edit_success'] = "Category edited";
$lang['cat_edit_error'] = "Error editing category";
$lang['cat_delete_success'] = "Category deleted";
$lang['cat_delete_error'] = "Error while deleting category";
$lang['cat_order'] = "Category Order";
$lang['at_beginning'] = "At Beginning";
$lang['at_end'] = "At End";
$lang['after'] = "After";
$lang['nav_categories_add'] = "Add categories";
$lang['lostfield_error'] = "Please recheck the marked fields.";
$lang['image_delete_success'] = "Image deleted";
$lang['image_delete_error'] = "Error deleting image";
$lang['file_delete_success'] = "Image file deleted";
$lang['file_delete_error'] = "Error deleting image file.";
$lang['thumb_delete_success'] = "Thumbnail file deleted";
$lang['thumb_delete_error'] = "Error deleting thumbnail file";
$lang['comments_delete_success'] = "Comments deleted";
$lang['comments_delete_error'] = "Error deleting comments";
$lang['error_log_desc'] = "The following errors occurred:";
$lang['back_overview'] = "Back to overview";
$lang['save_changes'] = "Save changes";
$lang['back'] = "Back";
$lang['reset'] = "Reset";
$lang['add'] = "Add";
$lang['delete'] = "Delete";
$lang['field_category_name'] = "Category name";
$lang['field_description'] = "Description";
$lang['usercat_upload1'] = "Upload:";
$lang['usercat_url'] = "Url:";
in the
templates/your template folder/categories.html file
look for
{upload_button}
insert
after or
replace with
{user_multiupload_button}
in the
templates/your template folder/user_logininfo.html file
look for
» <a href="{url_control_panel}">{lang_control_panel}</a><br />
insert
after{if user_submitted_allowed}
» <a href="{user_submitted_url}">{lang_user_area}</a><br />
{endif user_submitted_allowed}
in the
templates/your template folder/style.css file
insert
at end of file
/* MOD User Categories
userhead1 is text in header at top
userhead2 is link text in header at top
user1 is text in table
user2 is link text in table
*/
.userhead1 {
background-color: #004C75;
color: #fcdc43;
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
}
.userhead2 {
background-color: #004C75;
color: #fcdc43;
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
}
.userhead2:link {
background-color: #004C75;
color: #fcdc43;
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
}
.userhead2:visited {
background-color: #004C75;
color: #fcdc43;
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
}
.userhead2:hover {
background-color: #004C75;
color: #FFFFFF;
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
}
.user1 {
color: #004C75;
}
.user2 {
color: #004C75;
}
.user2:link {
color: #004C75;
}
.user2:visited {
color: #004C75;
}
.user2:hover {
color: #000000;
}
/*END MOD user categories*/
not sure if you need these mods or not...
I had to insert them to get the site to redirect to the correct page when I login/logout.
in the
login.php file
look for
twice&& !ereg("member.php", $url)
replace Both with
&& !ereg("member.php", $url) && !ereg("user_multiupload.php", $url)
in the
logout.php file
look for
&& !ereg("member.php", $url)
replace with
&& !ereg("member.php", $url) && !ereg("user_multiupload.php", $url) && !ereg("user_categories.php", $url)
changes in 1.02I made a big mistake in the install_user_categories.php file.
When it created the fields for the user database the field `user_submitted_parent` is suppose to be MEDIUMINT and not TINYINT(1)
I have changed the file to correct the error. You will need to delete the database fields created with the old one and run the new install_user_categories.php file to correct the error or if you know how to go into phpadmin and change the field to the correct fieldtype would be easier. I found it worked fine until you reached 128 for a category number.
Sorry for the oversite...