4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: budduke on April 19, 2009, 11:10:01 PM

Title: [MOD] User Categories Area
Post by: budduke on April 19, 2009, 11:10:01 PM
MOD 2.02 User Categories Area

This 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 (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 (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 MOD
http://www.4homepages.de/forum/index.php?topic=7112.0 (http://www.4homepages.de/forum/index.php?topic=7112.0)[MOD] Dropdown options for custom database fields
and
http://www.4homepages.de/forum/index.php?topic=7385.0 (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
Code: [Select]
if ($this->auto_image[$this->image_type]) {
        $ok = 1;
     }
replace with…
Code: [Select]
/*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.
Code: [Select]
<span class="title">{lang_user_area}</span>
<hr size="1" />
{content}
{msg}

Revisions history…
2.02 major mistake in my coding regarding sessions
Changed files in version 2.02
Added 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.
2.01 major mistake in my coding,
Changed files in version 2.01
Please download new zip file
2.00 Added support for additional_user_fields dropdown MOD, cleaned some of the code up a little
1.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 post
1.01 added Captcha to adding new categories to stop automated scripts from killing site
Changed files in version 1.01
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-   Groupaccess table-   
Categories table-   
Users table-
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...
Code: [Select]
show_input_row($val[0], $field_name, $value);Replace with
Code: [Select]
  //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...
Code: [Select]
?>insert Before
Code: [Select]
//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
Code: [Select]
  "auth_postcomment" => AUTH_USERreplace with
Code: [Select]
  "auth_postcomment" => AUTH_USER,
  "auth_user_manage" => AUTH_ACL

look for
Code: [Select]
      $error_log[] = $lang['cat_delete_error']." <b>".format_text($cats['cat_name'], 2)."</b> (ID: ".$cats['cat_id'].")";
    }
insert after
Code: [Select]
//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
Code: [Select]
    $error_log[] = $lang['cat_delete_error']." <b>".format_text($cat_cache[$cat_id]['cat_name'], 2)."</b> (ID: ".$cat_id.")";
  }
insert after
Code: [Select]
//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
Code: [Select]
  $auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];insert after both places
Code: [Select]
  $auth_user_manage = $HTTP_POST_VARS['auth_user_manage'];
look for
Code: [Select]
(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
Code: [Select]
(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
Code: [Select]
('$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
Code: [Select]
('$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
Code: [Select]
$sql = "SELECT cat_name, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
replace with
Code: [Select]
$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
Code: [Select]
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
Code: [Select]
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
Code: [Select]
$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
Code: [Select]
$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
Code: [Select]
$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
Code: [Select]
$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
Code: [Select]
// end of functionsinsert before (Remove this code for ver 2.0)
Code: [Select]
//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
Code: [Select]
  show_form_footer($lang['save_changes'], "", 2);
}
insert before (Remove this code for ver 2.0)
Code: [Select]
// 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...
 
Code: [Select]
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
Code: [Select]
  "auth_postcomment"replace with
Code: [Select]
  "auth_postcomment",
  "auth_user_manage"

look for
Code: [Select]
    $auth_postcomment = (isset($auth[$key]['auth_postcomment']) && $auth[$key]['auth_postcomment'] == 1) ? 1 : 0;insert after
Code: [Select]
    $auth_user_manage = (isset($auth[$key]['auth_user_manage']) && $auth[$key]['auth_user_manage'] == 1) ? 1 : 0;
look for
Code: [Select]
    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)
Code: [Select]
    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
Code: [Select]
    $activationkey = get_random_key(USERS_TABLE, get_user_table_field("", $user_table_fields['user_activationkey']));
insert Before
Code: [Select]
//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
Code: [Select]
$captcha_path                = ROOT_PATH.'captcha';insert before changed in version 1.01
Code: [Select]
$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
Code: [Select]
if (!$captcha_enable) {
  $captcha_enable_comments     = 0;
  $captcha_enable_upload       = 0;
insert after changed in version 1.01
Code: [Select]
  $captcha_enable_user_multiupload  = 0;
  $captcha_enable_user_category_add = 0;
 
look for
Code: [Select]
$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
Code: [Select]
$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
Code: [Select]
//-----------------------------------------------------
//--- 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&amp;".URL_CAT_ID."=".$cat_id);
  $upload_button = "<a href=\"".$upload_url."\"><img src=\"".get_gallery_image("upload.gif")."\" border=\"0\" alt=\"\" /></a>";
}
replace with
Code: [Select]
//-----------------------------------------------------
//--- 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&amp;".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&amp;".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&amp;".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
Code: [Select]
  "upload_button" => $upload_button,insert after
Code: [Select]
  "user_multiupload_button" => $user_multiupload_button,
in the includes/auth.php file

look for
Code: [Select]
, a.auth_postcommentreplace with
Code: [Select]
, a.auth_postcomment, a.auth_user_manage
in the includes/constants.php file

look for
Code: [Select]
?>insert before
Code: [Select]
//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
Code: [Select]
?>insert before
Code: [Select]
//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
Code: [Select]
?>insert before
Code: [Select]
// 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
Code: [Select]
  "url_upload" => (!empty($url_upload)) ? $site_sess->url($url_upload) : $site_sess->url(ROOT_PATH."member.php?action=uploadform"),insert after
Code: [Select]
  "url_user_multiupload" => (!empty($url_user_multiupload)) ? $site_sess->url($url_user_multiupload) : $site_sess->url(ROOT_PATH."user_multiupload.php"),
look for
Code: [Select]
//-----------------------------------------------------
//--- 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
Code: [Select]
// 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
Code: [Select]
  function logout($user_id) {
    global $site_db;
replace with
Code: [Select]
  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
Code: [Select]
?>insert before (Updated insert for version 2.0)
Code: [Select]
// 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
Code: [Select]
?>insert before (modified insert for version 2.0)
Code: [Select]
//-----------------------------------------------------
//--- 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'] = '&#39;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'] = '&#39;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
Code: [Select]
{upload_button}insert after or replace with
Code: [Select]
{user_multiupload_button}
in the templates/your template folder/user_logininfo.html file

look for
Code: [Select]
  &raquo; <a href="{url_control_panel}">{lang_control_panel}</a><br />insert after
Code: [Select]
{if user_submitted_allowed}
  &raquo; <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
Code: [Select]
/* 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
Code: [Select]
&& !ereg("member.php", $url)replace Both with
Code: [Select]
&& !ereg("member.php", $url) && !ereg("user_multiupload.php", $url)
in the logout.php file

look for
Code: [Select]
&& !ereg("member.php", $url)replace with
Code: [Select]
&& !ereg("member.php", $url) && !ereg("user_multiupload.php", $url) && !ereg("user_categories.php", $url)

changes in 1.02
I 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...
Title: Re: [MOD] User Categories Area
Post by: Anarchology on April 24, 2009, 08:59:11 AM
This is one whopper of a mod. I'm going to work on this one for my newly created site! It looks great man! I'll post feedback on how it all turns out!

-Anarchology
Title: Re: [MOD] User Categories Area
Post by: Sunny C. on April 24, 2009, 09:07:27 AM
Können User damit eigene Kategorie erstellen?
Title: Re: [MOD] User Categories Area
Post by: budduke on April 24, 2009, 12:11:37 PM
Können User damit eigene Kategorie erstellen?
The easy answer is Yes,
As an administrator, the last thing I want to do is create folders for each user and then give them rights. So I let PHP do it all for me.
When You give an user right to have an area like this in the admin panel, when they first click on thier user area, the site creates thier category for them and gives them rights and the ability to create/edit/delete categories inside this main category.
That is why I call it User categories, They can not modify any one else's area but their own so it sure has saved me allot of work.

hope it works for you!
Title: Re: [MOD] User Categories Area
Post by: mawenzi on April 24, 2009, 01:31:18 PM
@ budduke,

... thanks for this great modification ...
... moved to Mods & Plugins (Releases & Support) ...
Title: Re: [MOD] User Categories Area
Post by: rinaldos on April 24, 2009, 04:55:30 PM
Hi,
I have tried this mod, but if i kilck on the link "Your User Area",the page directs me to this one

 user_cat.htm?action=createuser

But i did't found that template or the php file :-( Something wrong in your description? Or I have to built in the other two mod's?

Gruß

Title: Re: [MOD] User Categories Area
Post by: budduke on April 25, 2009, 12:30:52 AM
Hi,
I have tried this mod, but if i kilck on the link "Your User Area",the page directs me to this one

 user_cat.htm?action=createuser

But i did't found that template or the php file :-( Something wrong in your description? Or I have to built in the other two mod's?

Gruß



Doublecheck the mod, user_cat.htm is from one of the other mods I was playing with at the time but I do not see any reference to it anywhere in my code.
look the the include/pageheader.php file under the userbox insert to make sure you placed it correctly and the template where it is displayed is near the bottom of my insertions.
the template folder/user_logininfo.html file would be where it will call that url the link should sat user_categories.php?action=createuser
Title: Re: [MOD] User Categories Area
Post by: rinaldos on April 25, 2009, 06:27:48 AM
OK, i will try and recheck all, I answer later what happens :-)
Thanks for the hint ...

gruß
Ingo
Title: Re: [MOD] User Categories Area
Post by: 4ella on April 25, 2009, 11:17:07 PM
That's exactly what I was searching for , I will be very happy if i will make it work , I also need some people (dancers - hostesses) to make their own profiles and night clubs to make their portfolios and then I would be happy when they will also have the possibility to edit and delete only theirs cats in their area .Thanks a lot Budduke , I will let you know if i will manage to get to make it work . It will be very helpful to me , Daniel
Title: Re: [MOD] User Categories Area
Post by: lkl231 on April 26, 2009, 01:09:29 PM
Amazing .....

thanks for sharing it ....

I just have a request.

Since you have tested this mod on a fresh 4images 1.7.6, could you please provide us with a copy of it?

 :wink:
Title: Re: [MOD] User Categories Area
Post by: budduke on April 26, 2009, 02:07:20 PM
Amazing .....

thanks for sharing it ....

I just have a request.

Since you have tested this mod on a fresh 4images 1.7.6, could you please provide us with a copy of it?

 :wink:

You can download version 1.7.6 on the main site...
http://www.4homepages.de/ (http://www.4homepages.de/)
Title: Re: [MOD] User Categories Area
Post by: lkl231 on April 26, 2009, 02:20:12 PM

You can download version 1.7.6 on the main site...
http://www.4homepages.de/ (http://www.4homepages.de/)

Oh no ...

I was taking about a copy with your mod installed.

I tried to install the mod twice. However, this error appeared.

Quote
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\localhost\www\4images\admin\categories.php on line 515


I'll be grateful if you can upload version 1.7.6 with the mod.

 :roll:
Title: Re: [MOD] User Categories Area
Post by: budduke on April 26, 2009, 07:22:17 PM

You can download version 1.7.6 on the main site...
http://www.4homepages.de/ (http://www.4homepages.de/)

Oh no ...

I was taking about a copy with your mod installed.

I tried to install the mod twice. However, this error appeared.

Quote
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\localhost\www\4images\admin\categories.php on line 515


I'll be grateful if you can upload version 1.7.6 with the mod.

 :roll:

I have attached the file with the changed files in my first post in this thread.
I looked around that line number and do not see anything that should have been changed in that area...
If you find the problem and it is something not correct in my instructions, please let me know so I can fix the instructions.
I have followed them twice and they work for me but then again I have been working on this mod for over a month so I may just be overlooking something...

You may want to make sure you are modifying the correct categories.php file. There is one in the admin folder and one in the root. Both have different changes to be made to each of them.
Title: Re: [MOD] User Categories Area
Post by: 4ella on May 08, 2009, 12:30:28 AM
Tomorrow Im going to try to install this for me very useful MOD , I have a question for Budduke , I made my website especially for 3 groups:

1.Dancers                           I would like to let dancers to make their picture portfolio
2.Hostesses                        I would like to let hostesses to make their picture portfolio

and on contrary :
3.NightClubs                       I would like to let NightClubs to make their club portfolio with their subportfolios like subcategory accomodation for girls etc.

I would like to make for everyone their  button:
e.g.:

New Dancer Profile (under category e.g id=500)
New Hostess Profile (under category e.g id=501)
New Club Portfolio (under category e.g id=502)

and lead every button directly to their own tree of categories which would start on Main Category page, I hope that it has to be simple to divide categories in some place in the code rather than to install this mod 3x and somewhere rename it , but i ask you before to make those big changes , would be glad to implement it on the fly , at this moment with your MOD as i understand it good I can only make the ONE User area , if I will have 3 areas immediately , it would save me a lot of time and too many explanations to everyone how to make his own portfolio and not only how but mainly to put it everyone on right place , dont want to mess night clubs with girls but divide them , like this eveyone will only click on his button and they can easily make everything what they want under 3 main categories which i will dedicate only to them .
Hope that you understand . Pls. Let me know if it is possible to create , thanks Daniel


Title: Re: [MOD] User Categories Area
Post by: budduke on May 08, 2009, 02:06:19 AM
to 4ella,
When I first started making this mod I was using group permissions but I was having trouble getting it to work correctly. It seemed to ignore the permissions that I set for the group.
I then read other posts about people having problems getting group permission to work correctly so I bagged it and just stuck with user controls.

I played with a quick test tonight and I think I may still be able to give you what you are wanting,
the only thing, is that everyone has the same permissions that you setup in the config part of user_categories.php file and not the permissions for that group.
The only thing it will be looking at the group permissions for is to see what categorie is that group's parent location. Will that work?
You will have to give me a little time. I have had a bunch of personal stuff crop up that has put me behind some of my other projects.

The only problem I see is with your last request for the clubs having control of areas that their dancers upload pics to... when I am done,
you may have to create a usergroup for each club and set the dancers for that club in the correct group so it will be their upload area but I think it will work...

I see another revision to my code coming....
Title: Re: [MOD] User Categories Area
Post by: 4ella on May 08, 2009, 02:14:16 PM
Thank you very much for your respond  Budduke , I didn't put them to user groups yet ,I'm not using user groups for that , because of the buttons (New Dancer , New Nightclub) that im willing to put on my site in sidebar they will (thanks to your MOD)create their profiles in their correct areas (categories ) .
To divide them  I have made another field - occupation- I used the same MOD like GIS but changed gender for occupation -   and like this i'm dividing one from another , so on my site I have also stats for everyone

lapdance clubs
nightclubs
stripclubs
photographers
models
dancers
hostesses
visitors etc.

for me are important only dancers , hostesses and nightclubs (nightclubs, lapdance clubs, tabledance, stripclubs), where they are willing to go , I only want the group dancers (in fact its not a user group ) to use category 502 and of course every category below cat502 that would create, hostess cat501 and nightclubs cat500 etc, so it doesnt have to have nothing to do with user permissions . Every group of people will have all permissions in their 500 , 501 , 502 and of course in categories created below.
Your Mod I can use only for one group , I need 3 different groups to use 3 different categories. I think that many people will use it too because almost everyone has at least 2 groups of people , like employer  - candidate , photographers - customers etc .
With this great Mod if you will manage to get it work for 2-3-4 groups you can easily transform 4Images in some JOB BOARD where the different people has their places , and everybody will know where exactly they are .
I want to come home and see that in category nightclubs I have a new club , at this moment i have to :

prepare the category for them  , create the name of this category, create a description of this category , then I have to explain exactly where to go and how to upload the pictures in their own category and after set permissions to this person in order to not to let others to put the pics at this category , if they want another subcategory I have to create it before etc.
Try to explain a dancer to make something with computer , the club owners in Italy maybe never saw the computer in their lives so I hope that with your MOD they will only click the button NEW CLUB (NEW DANCER , NEW HOSTESS) and they would create their portfolio theirselves , make their category description theirselves , upload their pics .
Would be great the MOD like this -:)

I have for this another part of my side , but its not very good to use it for picture gallery.
http://www.dancersrecruit.com/joblist/ 
its a Job Board its not working 100%  because when I installed 4Images I don't do anything else-:) but already working . You can see there employers part , candidates part . I know 4 Images  are  Picture gallery and that's why I choose gallery to help Joblist to see better pictures and to let the people to create big image portfolio .
I'm not a programmer , I can only edit , copy , delete but thanks to your (all the people here posting MODS) perfect descriptions its enough for me to know how to implement 90% of Mods here , I think that I can make it myself doing this 3x , by changing the some names . But you are a programmer of this Mod, you should know best which way to go before I choose bad one-:)
Thanks Budduke again for your respond , and do what you have to do , I'm not in a hurry at all , it would be only very pleasant addition to my 4Images website. Daniel







Title: Re: [MOD] User Categories Area
Post by: wtr on May 29, 2009, 11:25:15 PM
Hi,

Funktioniert das auch mit der Version 1.7.7???

Does it work with Version 1.7.7?

Greets wtr
Title: Re: [MOD] User Categories Area
Post by: budduke on May 30, 2009, 12:22:21 AM
Hi,

Funktioniert das auch mit der Version 1.7.7???

Does it work with Version 1.7.7?

Greets wtr
Yes,
I upgraded my site to 1.7.7 a week ago and everyone says they are still able to use the MOD so I have not heard of any problems.
Title: Re: [MOD] User Categories Area
Post by: wtr on May 30, 2009, 12:02:47 PM
OK thanks.
Then i will build in the MOD.
Title: Re: [MOD] User Categories Area
Post by: 4ella on June 12, 2009, 02:14:15 AM
@budduke
Very long installation but it worth it , amazing - working immediately and I didn't realized before the installation what I should  expect from this Mod , now I can only say super Mod , I have endless possibilities to use it now , thanks a lot for that, I would like to put your link and logo on the bottom inside user_categoriesform.html , but I didn't manage to copy that from your website (copyright restriction) , if you want to put your link and logo there, I put one but it is better to substitute it with yours, pm me please or contact me directly on my site  I would like to thank you in this way . Daniel


in case that somebody would like to test the DEMO
http://www.dancersrecruit.com/pictures/index.php
username: 4images
password: test
or you can register yourself with your name
Title: Re: [MOD] User Categories Area
Post by: 4ella on June 13, 2009, 12:31:16 PM
@Budduke I have PMed you about the logo .

Was also thinking about what Your Area should have to be 100% perfect and everybody would appreciate that and it is that this Area should serve from beginning - it means immediately after  registration ,  after successful registration to have the possibility to create My own Category (like a Mod Let user create his own category)
and after either to be redirect to control panel and there for example to put the button  (Create category , profile etc. - to use Let User Create ... MOD ) neither directly be redirected to your User Area (but with the possibility to create NEW Category) - so to connect these 2 Mods in 1, where will be the possibilty to create (IN your present form You can't use it until ADMIN give you your categoryID and also the rights to use this category.
On my opinion it would be very useful Mod in 4images , because this is only thing that I don't like that every user step has to be followed by admin step or user can do something only when admin create category ,description etc. . I like that you are trying to cut some rights from admin to user (Super idea the possibility to change the category description in User Area)(Let user create the category MOD can create the description too but only create - NOT EDIT . In Short 4images would be nice when it will allow user with some small limitations make everything but ADMIN will have the last word .
Title: Re: [MOD] User Categories Area
Post by: budduke on June 15, 2009, 01:00:45 AM
@Budduke I have PMed you about the logo .

Was also thinking about what Your Area should have to be 100% perfect and everybody would appreciate that and it is that this Area should serve from beginning - it means immediately after  registration ,  after successful registration to have the possibility to create My own Category (like a Mod Let user create his own category)
and after either to be redirect to control panel and there for example to put the button  (Create category , profile etc. - to use Let User Create ... MOD ) neither directly be redirected to your User Area (but with the possibility to create NEW Category) - so to connect these 2 Mods in 1, where will be the possibilty to create (IN your present form You can't use it until ADMIN give you your categoryID and also the rights to use this category.
On my opinion it would be very useful Mod in 4images , because this is only thing that I don't like that every user step has to be followed by admin step or user can do something only when admin create category ,description etc. . I like that you are trying to cut some rights from admin to user (Super idea the possibility to change the category description in User Area)(Let user create the category MOD can create the description too but only create - NOT EDIT . In Short 4images would be nice when it will allow user with some small limitations make everything but ADMIN will have the last word .

In 2.0 (just posted) new users can create own categories without admin approval (it was a very quick add at the end)
If I understand the rest of your idea, you are wanting buttons when they are in their categories looking at thumbnails, to be able to create a new category from that screen instead of going to the user area?
Will have to think about that one awhile

PS: anyone following allong, if you need to upgrade from 1.03 to 2.00 you should just look at the blue areas of the posted mod to see what has changed
Title: Re: [MOD] User Categories Area
Post by: theresa_rose on June 15, 2009, 04:44:02 AM
I installed this mod on an empty site...unfortunately not working for me.  I will go back and repeat the installation from scratch but I was wondering if anybody could see something in the error log.  Here is a cap of the error log.

Opps...edited....i found it....me being a dumbass and forgetting to upload a file on an older mod.
Title: Re: [MOD] User Categories Area
Post by: 4ella on June 15, 2009, 08:33:34 AM
@Budduke
I'm trying to find admin/admin_functions.php  to modify  . Did you forget to publish it or I overlooked that?

and about my question:
Quote
Was also thinking about what Your Area should have to be 100% perfect and everybody would appreciate that and it is that this Area should serve from beginning - it means immediately after  registration ,  after successful registration to have the possibility to create My own Category (like a Mod Let user create his own category)

Forget this question , I didn't realize that your Mod already works from beginning - Now I see that there already was the possibility to create the category immediately from the start (I didnt try it like a new member before).  So your Mod was and is even better than I thought, I will let you know if everything works good in New 2.0 version, now I get errors and don't see my area anymore, because I didn't put admin_functions.php changes , I think that you have forgot to publish them -:)
Title: Re: [MOD] User Categories Area
Post by: budduke on June 15, 2009, 12:56:16 PM
My bad...
Forgot to add mod to admin_functions...
Modified first post so things should be good now.
Title: Re: [MOD] User Categories Area
Post by: 4ella on June 15, 2009, 01:12:00 PM
Budduke I have following error here in in plugins ACP:
Warning: Invalid argument supplied for foreach() in /home2/dancersr/public_html/pictures/admin/plugins/user_categories_mod.php on line 291

user_categories_mod.php line 284 - 294
291 - function show_user_submitted_enable_options($setting_name, $setting_value) {

In attach i added also my admin_function.php

Code: [Select]
     echo "> ".$val."<br />";
  }
}

function show_user_submitted_enable_options($setting_name, $setting_value) {
  global $user_submitted_enable_optionlist,$none_found;
  foreach ($user_submitted_enable_optionlist as $key => $val) {
  if ($none_found && ($key===2)){
(http://www.dancersrecruit.com/pictures/templates/default/images/user area.jpg)

Title: Re: [MOD] User Categories Area
Post by: budduke on June 15, 2009, 07:53:18 PM
@4ella,

did you change the mod in the lang/english/admin.php file?
I forgot to change the text to blue.
It added more info to the option list.

I will not be able to look further till I get home tonight...
Title: Re: [MOD] User Categories Area
Post by: 4ella on June 15, 2009, 08:47:56 PM
@Budduke
There's no hurry Budduke no problem , Yes i didn't change the admin.php-:) , so now i dont have the error in plugin area but I still have the errors in admin_function.php(screen above - 5x warning) , otherwise now I undestand how it works and it is absolutely super idea with dropdown menu , looking forward when it starts to work , very nice and useful  indeed .
Title: Re: [MOD] User Categories Area
Post by: budduke on June 16, 2009, 01:01:55 AM
I haved tried installing it twice and it works fine for me...
What other mods are you also using on this test site?
I did notice that you did not have the case dropdown mod in the admin_functions file. Could that be causing the problem?

my file looked like this
Code: [Select]
     case "textarea":
        show_textarea_row($val[0], $field_name, $value);
        break;
      case "dropdown":
        show_user_dropdown_row($field_name, $val, $value);
        break;
 case "radio":
        show_radio_row($val[0], $field_name, ($value == "") ? 1 : $value);
        break;
      case "text":
      default:
 //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
 } // end switch

Your file was missing the dropdown case area...
Let me know if it is still happening and what other mods you have installed on this setup.

Also, what happens when you try to run the other plugin (clear cache) that is native to 4images?
The is the file a used as a template when I was creating my plugin. That may tell me if it is my files or something else...
Title: Re: [MOD] User Categories Area
Post by: budduke on June 20, 2009, 04:31:52 PM
Thew above admin header problem fixed in version 2.01
Title: Re: [MOD] User Categories Area
Post by: surferboy on February 20, 2010, 10:29:11 AM
In your first post, you note:

Quote
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)

Hi -

Are you referring to this MOD:
http://www.4homepages.de/forum/index.php?topic=7700.0 ?

I installed this in my new install of 1.7.7 and it works fine.

Now, my question, in following your instructions ... should I install your MOD first before I install this other MOD?  That would mean I should reinstall a clean version of 4images and start with your MOD first ...

Being new to 4images, there doesn't seem to be a protocol on how to install MOD's, one after another ...

Thanks,

Brian
Title: Re: [MOD] User Categories Area
Post by: budduke on February 20, 2010, 03:27:25 PM
Yes, that is the Mod I was referring to...
I would install it first before installing mine.

Yes Mods are a little confusing to deal with but they are worth the effort
Title: Re: [MOD] User Categories Area
Post by: surferboy on March 24, 2010, 08:02:05 PM
Hi -

This is the last of the MOD's to install before our gallery goes live.

I have had very good success installing almost every MOD, now counting 17 I think.  Beyond that, I had to uninstall (2) additional MODs that did not work well or had unresolved glitches: flash tag cloud and Shout/Guest Comment Box. I mention this to show I have a certain level of competence.

I have read and reread your notes for this MOD and my biggest question is whether I have to install the Thunderstrike version of MultiUpload. I have already uploaded the V@no multiupload version, multi-upload plus v.03b, topic 12742.0, and I am concerned that having both would be a problem for our users let alone for the script..

Can this MOD work using the V@no multi-upload plus v.03b, topic 12742.0 for uploading multiple images? 

Thanks for your thoughts on this.

Cheers,

Brian
Title: Re: [MOD] User Categories Area
Post by: budduke on March 25, 2010, 01:04:35 AM
@ surferboy,
The thunderstike version of multiupload is already integrated into this mod. I renamed the files so they would not cause any issues if both were loaded. So, No, you do not have to install that Mod.
I tried V@no's version once a couple months back but could not get it to work reliably for my taste, (maybe I just did not spend enough time with it)
When something acts different when bouncing between different browsers then I get discouraged.
I would say yes, both V@no's and mine can be installed at the same time but I do not think V@no's multiupload mod will not be called on when your users are in their categorie area.
I have not looked into testing that Mod out with mine.
When your site is up and running, I would love to see that version of multiupload running so I can see how it works.
Title: Re: [MOD] User Categories Area
Post by: surferboy on March 25, 2010, 03:33:48 AM
Hi -

Thanks for your reply.

Great!  I will send you an IM right now so you can have access to the gallery while under construction.  I would very much appreciate your taking a look because my concern is that I have a link in the userbox that says 'upload your images' which is V@no's mutliupload basic MOD.  If a user clicks on the link, he/she will go to the User Control Panel to proceed with selecting a category, choosing the number of images, and so on.  You will see in the home page that I have created a placemarker for the User Category. 

After I install your MOD, I assume that the only way the users will be able to see and access the User Category is through your MOD's link in the userbox.

Otherwise, that is where I see a conflict: a user clicks on V@no's link, goes to the Control Panel, and not knowing any better, looks for the User Category, and if it is visible, selects it, and then proceeds.  Hopefully my logic is correct - that the user will not see the User Category in the dropdown menu of V@no's mutliupload form and they will just use your link from your MOD in the userbox. 

Thanks for taking the time to look at this .

Oh, one other question:  I already have the MOD V1.3 Let users add (sub-)categories installed. Will that installation conflict with your MOD?  Given your answers to the previous post, I assume it will not since you said you had renamed the files but I just want to be sure.

Thanks again,

Brian
Title: Re: [MOD] User Categories Area
Post by: alex9193 on June 19, 2010, 11:32:24 AM
[MOD] User Categories Area was installed without any problems, but I have MOD Google Friendly Urls For 4images Best Seo Mod (http://www.4homepages.de/forum/index.php?PHPSESSID=1efa61208ddacaa2e086becbc61dd031&topic=17598.0), that's why when I use the link [Your User Area] I get the following URL http://127.0.0.1/4images/user_cat.htm, well, I inserted it manually http://127.0.0.1/4images/user_categories.php, and I'm redirected to the page [Your User Area] when you see so to say "base category" id=127, although I created in the base category another category Upload with id=2940, when I use the link [Add Subcategory]
I'm redirected to the page http://127.0.0.1/4images/user_categories.php?action=addcat&cat_parent_id=127 where, of course, I do not have rights to do anything. I change id=127 manually to id=2940 and am redirected to the right page for adding category, but here all buttons redirect me again here http://127.0.0.1/4images/user_cat.htm

Please, advise how to install the right base category, not id=127 and how to avoid conflict with [MOD] Google Friendly Urls For 4images Best Seo Mod

Title: Re: [MOD] User Categories Area
Post by: V@no on June 19, 2010, 06:37:49 PM
Try this.
In includes/sessions.php find:
      elseif (strstr($url, 'categories.php')) {

Insert above:
      elseif (strstr($url, 'user_categories.php')) {
        // do nothing
      }
Title: Re: [MOD] User Categories Area
Post by: alex9193 on June 19, 2010, 09:50:07 PM
Thank you, V@no! It works!
One more thing, how to solve the problem with opening of a necessary base category? Maybe it's possible to write the needed ID in the file
user_categories.php, so if you add a category the following page opens
http://127.0.0.1/4images/user_categories.php?action=addcat&cat_parent_id=127 and not
http://127.0.0.1/4images/user_categories.php?action=addcat&cat_parent_id=XXXX

Title: Re: [MOD] User Categories Area
Post by: budduke on June 20, 2010, 01:35:50 AM
@ alex9193,
I am glad V@no was able to help you with the google friendly codes because I have no knowledge in that dept.

if you are seeing user_cat.htm (that file has nothing to do with this mod, I posted that to another user up this list. Make sure you are not getting any mod's coding intermixed in some way)

I am trying to understand your other issue. Let me explain how it is suppose to work and then we can troubleshoot it from there.
When you first setup the user_categories in the admin panel you select a base_cat area on your site, I am assuming that is category #127.
The user has a "0" entered in for their base category when the mod is first started.
When the user clicks on their user area and the code sees that they have a "0" in their field and they say yes to creating a user area for themselves, then the code creates a subfolder for them under that #127 category. That sub-folder becomes that users base parent category, in your case I am assuming #2940.
That also becomes the number that is stored for that user in the admin control panel.
Now, from that point on, when that user clicks on their user area, the parent category will always be #2940 and not #127.
You are correct, they only have rights for any folders under their base category and not the main category that houses everybody.

Is this how your site is working? after all the changes you have made with the google friendly stuff, you may try deleting all user folders, place a "0" in your users properties in the control panel and make sure you have category #127 set for the main overall category to house all your user's folders.
Then click on the "user area" for that user and see if it creates it correctly and sets their main parent category correctly.

Hopefully this helps,
Let me know if you are stuck or do not understand...
Title: Re: [MOD] User Categories Area
Post by: alex9193 on June 20, 2010, 03:33:29 PM
budduke,
I'll try to explain more detaily. I have 6 main categories on my website (pic. 1)

I created category 7 Upload ID=2940 which I want to be the base category for users areas, but it doesn't work.
If the category Upload is a base category in my settings, another category with ID=127 (which has been already used) becomes base category.
If I set ANY category with ID < 128 as a base category, it works without any problems, id ID is bigger, so category ID=127 automatically becomes
a base category.  
If I set "no categories", a category with a smaller ID is a base category (in my case it's ID=15) (pic. 2)
Title: Re: [MOD] User Categories Area
Post by: budduke on June 20, 2010, 04:41:11 PM
@alex9193,

 :oops:  that is my bad. Just looked at the code in the zip file that creates the field for the user_submitted_parent and it was set for tinyint which only give you -127 to 127 for a value. Hard to believe this is the first time this came up. UPDATE: I did fix this once before but when I created the version 2, I accidentally used the old code again... :(

if you know how to use phpmyadmin to run a command on your database, run this command...
Code: [Select]
ALTER TABLE `4images_users` CHANGE `user_submitted_parent` `user_submitted_parent` MEDIUMINT NOT NULL DEFAULT '0' remember to change the 4images_users with your name of your user's table...

that will give you 8388607 for a max value on categories and still keep data small in the database...

I am so sorry for that, I have fixed the zip file again and replaced the installer with the correct one for the database changes
Title: Re: [MOD] User Categories Area
Post by: alex9193 on June 27, 2010, 01:49:13 PM
budduke,
thanks, it works as it's supposed to! :)


I have a couple of questions:
When creating a new user area everything works fine (showing of user areas, multiupload work with different languages), but adding
of new areas doesn't work (it's possible to change the language only in captcha).
1. Is it possible to add other lanuage files?
2. In the form field descriptions are taken from the file admin.php, it is possible to move them into файл main.php?
Title: Re: [MOD] User Categories Area
Post by: budduke on June 27, 2010, 09:08:55 PM
I have a couple of questions:
When creating a new user area everything works fine (showing of user areas, multiupload work with different languages), but adding
of new areas doesn't work (it's possible to change the language only in captcha).
1. Is it possible to add other lanuage files?
2. In the form field descriptions are taken from the file admin.php, it is possible to move them into файл main.php?

Not sure if I understand what you are asking or not :?:
question 1: If you can translate the English words, you should be able to create language files for your language.

question 2: Why? the lang/admin.php file is used in the admin control panel area of the site and the lang/main.php is used for the normal users of your site.

Are there words that I may have forgotten to put in there that you can not translate?
Title: Re: [MOD] User Categories Area
Post by: alex9193 on June 28, 2010, 07:50:57 PM
1. I have 3 languages, but when you create a subcategory, language variables are taken from default language. 
2. My default language is english, but admin area is in Russian (to make it comfortable I just moved adnin.php from he other language), that's why
default language is English but if you add subcategories some Russian words appear.
3.(additionally) If you open multiupload page, the language which was previously chosen by the user is automatically changed to default language.
You can see it here:

http://max-pix.com
login: test
pass: 123456   

Try to change languages on the page where you create subcategories.
Title: Re: [MOD] User Categories Area
Post by: budduke on June 29, 2010, 12:19:54 AM
@ alex9193,
To answer questions 1&2...
You need to convert the entire main.php file over to your new languages and not just what was part of my mod.
I am reusing lang variables that are further up that file as to not overload memory having the same words created twice...
look up the main.php file for things like "yes" "no" "abort" ,ect... That is why you are seeing russian because if the multilang mod does not see the associated word in the new language file it is using, it uses the original one that is in the default settings of  4images.

Question 3 is harder,
The multilanguage mod you are using places a l=whateverlanguage at the end of every link. My mod does not incorporate that into any of it's links, that is why it defaults back to the default language when you click on any of the links. It would have been nicer if that mod passed a session variable instead of adding to the link.
I think V@no created that mod, you may ask him on that mods posing to see if there is an easy fix to add multilang to this mod. I think I would have to go through and modify almost all the code to get it in there and then people that are not using the multilang will not work.

Will have to think about that one awhile, If I come up with anything I will post it for you, or if V@no chimes in with a path for me to take then I may be able to move forward with it. But right now, I can not think of a way to put it in easy and still make it compatible for people not using that mod.

If I get time this week, I will try to place that mod on my test site and see what I can do, must no promises...
If you can zip and send me language files you are using so I will not have to create the different languages, that would help out allot.

Playing around on your site, I did notice two words that are in my templates that are not in the language file  :(
"UPLOAD:" and "URL:" and then the button you click for browsing for files is also in English but I do not think I can do anything about that one.
Title: Re: [MOD] User Categories Area
Post by: alex9193 on June 29, 2010, 08:47:39 AM
Hi budduke,
Thanks for helping me with my problem
my lang files folder + user_categories.php, user_functions.php
http://ifolder.ru/18349482
Title: Re: [MOD] User Categories Area
Post by: budduke on July 03, 2010, 08:17:08 PM
@alex9193,

Try using the files in the attached zip file...
I think this should fix your problem with the multi language...
You will see the spot of the added language entries in the maim.php file after the \\added line
They are repeats of the admin.php file, hopefully you will be able to translate them to your other languages...

Apparently, I have been creating my links incorrectly when I have been creating these mods  :( , Live and learn...
Will have to go through my other mods to repair them like this one...

Let me know if this fixes the problem or not so I can update my original post

UPDATE: file has been removed. Please just download the new version zip file on original post.
Title: Re: [MOD] User Categories Area
Post by: alex9193 on July 04, 2010, 07:28:28 PM
Thanks!
Everything works perfectly now!!!  :thumbup: besides the link "back to the gallery" after loading of files (the language is switched to default)
You can check the website, pls find login and password above

P. S. If you combine this mod and mod "Category Image" - it will be worth its weight in gold  :D
Title: Re: [MOD] User Categories Area
Post by: budduke on July 04, 2010, 07:33:13 PM
Thanks!
Everything works perfectly now!!!  :thumbup: besides the link "back to the gallery" after loading of files (the language is switched to default)

Yes, I found that mistake this morning...
Try this new user_multiupload file...

Let me know if all is good to go...

UPDATE: file has been removed. Please just download the new version zip file on original post.
Title: Re: [MOD] User Categories Area
Post by: alex9193 on July 04, 2010, 08:10:23 PM
it's ok now!!! :thumbup:
Title: Re: [MOD] User Categories Area
Post by: budduke on July 04, 2010, 09:20:28 PM
it's ok now!!! :thumbup:

Version 2.02 of this mod has all fixes up to this point added to it.
Title: Re: [MOD] User Categories Area
Post by: surferboy on August 17, 2010, 02:47:55 AM
Hi Buddy Duke,

Installed your v 2.02 on v1.7.7;

Just installed this MOD and alas, some problems.

1. In the admin panel, when I click on Log Out, I get this error message:

"Warning: mkdir() [function.mkdir]: No such file or directory in /home1/xxx/public_html/xxxgallery/includes/user_functions.php on line 520

Warning: Cannot modify header information - headers already sent by (output started at /home1/xxx/public_html/xxxgallery/includes/user_functions.php:520) in /home1/xxx/public_html/xxxgallery/includes/sessions.php on line 101

Warning: Cannot modify header information - headers already sent by (output started at /home1/xxx/public_html/xxxgallery/includes/user_functions.php:520) in /home1/xxx/public_html/xxxgallery/includes/sessions.php on line 101

Warning: Cannot modify header information - headers already sent by (output started at /home1/xxx/public_html/xxxgallery/includes/user_functions.php:520) in /home1/xxx/public_html/xxxgallery/admin/admin_global.php on line 94

Warning: Cannot modify header information - headers already sent by (output started at /home1/xxx/public_html/xxxgallery/includes/user_functions.php:520) in /home1/xxx/public_html/xxxgallery/includes/functions.php on line 134"

Issue 2:

I had added several users as test subjects.  I went into the admin panel and set the User Category Settings as:
Yes, Using one main area
21 images
yes - Allow new users to create without admin involve
yes - allow direct upload as default
yes - record log file for all activity
parent category for this area: using a previously created category that has been sitting idle for several month.

okay, with that complete, I tried to log in as one of the test subjects and could not find the 'Your user area' and determined in going back into the admin control panel and editing the user that I had to manually activate the profiles with:
yes - allowed to create a user category area
yes - allowed to direct upload to user category area
selected the parent category mentioned above for this user category area

then, I relogged in and WAS able to see the Your User Area link in the userbox. But, when I clicked on it, it took me to the user categories page and yes, the link does say www.xxx.com/xxxgallery/user_categories.php instead of the action?=createuser link that you mention in the first page of this post to one of the users. When I click on the links on the user_categories.php page, it says I do not have permission to edit the parent category or upload files to the parent cateogry (that makes sense since by your explanation, the user category area should be restricted to just that one user category area).  The page also says I do not have permission to add a sub category

So, I have still been unable to achieve the initial activation of the user area.  I checked and reloaded a fresh copy of the includes/page_header.php file, ensuring that the //mod string was placed below as you directed.

I am unsure what permissions I should assign to the parent category for in the admin panel. Here are the current settings:
1. view category - registered users
2 - 8. - administrators
9. user manage - registered users.

I was extremely slow and methodical in adding all of the mods to the files. What do you think I have missed or what series of problems do you think I have encountered?

Thanks,

Brian
Title: Re: [MOD] User Categories Area
Post by: budduke on August 17, 2010, 02:58:53 PM
@surferboy,
Sorry about the troubles but the log out problem is a problem with this mod.
I always tell people do not logout on the admin panel, go back to the main gallery site and logout there and you should not see those errors. I copied the function from the admin area without renaming them so they conflict when you logout of the admin panel. When I get around to making a new version of this mod that is at the top of the list of fixes.

the other part, the checkbox for allow NEW users, does not do anything to your current users, just anyone who signs up from that point forward.
if you know sql, you can send a command to change that field in everyone's account in the database (another on my list of things to add)

The permissions should be handled by the mod, the parent folder should be set at user manage-private.

when the user first clicks on their user area, it should ask if they want to create their folder, when they select yes, then it creates the folder with all the rights.
If you already placed info in their field for the category, change it to 0 and the mod should take over from there.

Hope that helps,
Title: Re: [MOD] User Categories Area
Post by: surferboy on August 17, 2010, 04:08:53 PM
Hi -

Thank you so much for the quick reply.

Bugs are bugs. No problems on the logout from the admin control panel. I understand.

Unfortunately, I am still unsuccessful in activating a new User Area for one of the registered users. I changed the user manage - private but that still did not allow the User Area to activate.

To troubleshoot this, could you tell me what permissions I should use for settings 1 - 9 for the parent category for the User Category? All administrator except for the last one or all private? I keep getting an error - you do not have permission to access this page with all of the settings at private.  Or should I be trying to click on the permissions page? Sorry about the confusion.

Also, unfortunately, I do not understand what you mean when you say
Quote
If you already placed info in their field for the category, change it to 0 and the mod should take over from there.

Thanks so much for patience as I try to understand this.

Brian
Title: Re: [MOD] User Categories Area
Post by: budduke on August 17, 2010, 05:41:23 PM
@ surferboy,
I put together a screenshot showing what you were asking for.
Maybe it will help others in understanding this mod better...

Let me know if you are still lost, I may need a link where I can test it out.
Title: Re: [MOD] User Categories Area
Post by: surferboy on August 17, 2010, 08:05:26 PM
Hi -

Thanks again and again and again for taking the time to respond so quickly to me. I was able to achieve success but I do want to explain what I did because other users may find this helpful

My User Categories installation is slightly different than the image you posted. If we treat your image as having four quadrants, then here are the differences:

In the upper left quadrant:

Everything matches in my admin panel for User Category Settings.

In the lower left quadrant:

1. I do not see a field below the user manage drop down in edit categories for "Category Image" so I only have 9 fields while you have 10. Therefore I do not see an image count of images in the user category.

In the upper right quadrant:

1. My screen says 'parent category for this user category area' and it is not a blank field but a drop down field of all the categories. To achieve what you said of entering a "0", I had to change the drop down selection from the current parent user category to 'No Category.'

In the lower right quadrant:

1. I think you made a slight typo. I think you meant to write in black "upload" and "direct upload" instead of download and direct download. The permissions area may be confusing for others because if they (I) look in the user groups permissions, we see the same check boxes for the User Category areas and they are unchecked. I had a look in the admin panel for one user and looked at the permissions and they are all checked just as you show in your image.
--------------------------

I just uploaded some images into the personal user area using your multiupload and everything went fine, and thumbnails were created.  My other comments:  the single upload vs. multiupload is confusing since the single upload button is present for the other categories but that is just a matter of removing the coding on the html file. When I click on the User Category and click the user main category, I find I can edit the description but not the name so the category name is something like 'joe's collection.'  It would be nice to allow our users to change the name of their main user category but I don't know if that is possible.  I just noticed I can change the name of the member main category but only from the admin panel.

That's it I think. 

Thanks again.

Brian
Title: Re: [MOD] User Categories Area
Post by: zakaria666 on August 19, 2010, 04:34:38 AM
Buddke or ayone like vano

i have a quesition, please foprgive me i have read your description but im just finding it hard to grasp.

1) what exctly is the objective of this MOD? What does is do for the userside as oppose to what it does for the users viewing other users.
2) U said they get thre own user area to upload stuff to different categories,. How does this work? So i have control to create as much folders i can for different upload purposes? How does other users get to see other users images by clicking on users link?.
3) there are 3 download links on offer, i have 1.7.7 already but with much installed mods already. like friends and personal messagining. So should i just download the MOD called user categoris??

plz help me expalin my questions please

thank u
Title: Re: [MOD] User Categories Area
Post by: surferboy on August 19, 2010, 05:13:33 AM
Hey Zman,

this MOD is perfect for our rowing community. We want our members to upload rowing pictures to various public categories like regattas, or countries, and so on.  But ... we also want our members to share their personal pictures .. of their cruise ship trip, or their new dog, or their big family gathering.  

So this MOD allows us to keep our rowing pictures in the rowing categories, and then each member can have their OWN photo album where ONLY THEY can upload pictures of their new doggie, or their boyfriend, or their car, or their halloween party.  

The beauty of this MOD is that a User Category is only allowed to have pictures uploaded from its own user.  Other members can look at the pictures, make comments, download them, send an eCard ... those kinds of things ...

But this MOD allows members to personalize their space on our community website.  I have already tested this out with several test memberships.  Under ONE PARENT category, all of the member's galleries are listed. So as a 4images visitor, I can see Joe's pictures of his car, Jane's pictures of her new puppy, and John's pictures of his boyfriend he just started dating.

The other main categories, unless you have specific groups and separate permissions set up, allows ALL members to upload pictures to a category.

I hope that explains the main concept and the brilliant work that Budduke has done to create this MOD.

As to your other question about which link to download, you need to install the MOD called user categories ... BUT this MOD works best if you install the two other MOD's he has listed, which is 7112.0 and 7385.0.  So install those two first, and then install this one. That's my advice.

Brian
Title: Re: [MOD] User Categories Area
Post by: zakaria666 on August 19, 2010, 01:34:38 PM
@suferBoy

Thanks for the rpely, it really help me, but i have problem i have so many MODS and i like this MOD is well but if i make fresh install then all my MODS go, but if i just install MOD categorie would this be effiecient enough to help me?? i mean it will still work right?

than ks man
Title: Re: [MOD] User Categories Area
Post by: surferboy on August 19, 2010, 05:26:21 PM
Dude, you don't have nearly as many MODs installed as I do ... I think I have 17 installed BEFORE I installed this MOD.  This was the last MOD that I wanted to install before we make the gallery operational because it takes so much time and you have to be very careful and methodical in making all the changes to the files.

I don't see why you would need to do a fresh install at all.  Like you, I have v1.7.7 and yeah, I don't quite know what to do with the upgrade to v1.7.8 but I after all of my work to this point, March 2010 - August 2010, creating this image gallery and installing all of these MODs, I can't even imagine doing a fresh install of v.1.7.8.  That would be a nightmare.

So even though you have a bunch of MODs already installed, don't worry. This one works just fine with all of the others. Budduke has seen to that. Have you seen his image gallery? He has a gazillion MODs installed on his image gallery. He, like V@no and so many other others on here, are not only brilliant but so incredibly nice to help everyone.

Yes, I think you COULD install just this MOD, User Categories, and it would work for you even if you did not install MODs 7112 and 7385.

Brian
Title: Re: [MOD] User Categories Area
Post by: zakaria666 on August 19, 2010, 06:22:45 PM
Anyone here can help me

I have problem, I installed this MOD, no problems what so ever, just want to say my users they register using another software via plugin, they dont register directly on 4images however inside the MOD instaation they ask me to tweak the register.php script and i dont use that script, i have taken the reigster functionality away, is this why when i log in my users cannot see the  'User link' on the left hand side of the screen next to the logout link, also on my admin screen all i seem to see is is the image below,

______________________
(http://i38.tinypic.com/123tan7.jpg)


There is no problem but i dont see to have many of the things on the image that is posted on the instaltion, any reasons why, is this maybe because of the register.php??
Title: Re: [MOD] User Categories Area
Post by: budduke on August 19, 2010, 09:26:01 PM
@zakaria666,

Yes, those fields are changed as the user is being registered.
Code: [Select]
user_submitted_allow, user_submitted_directare the fields that get changed when they register based on what you set them for in the control panel.

If you are not able to add those fields through your other means of registering then the only option that I can think of is to change the default setting in the database itself to what you want them to be.

in your PhpMyAdmin, in both of the above fields, change the default setting to "1" and then it should work correctly for you when they register. That does not do anything for your current users. They have to be changed under their user account's settings or if you know SQL you can change the above fields for all current users.

You screen does look correct, you would only see the other one if the Mod detected one of the other mods that it needs to perform the other actions based on the user information, so it looks like you are almost there.
Title: Re: [MOD] User Categories Area
Post by: zakaria666 on August 19, 2010, 10:53:50 PM
@Budduke,

Thank u so much sir for replying back to me,

What i did was registered another user via the plugin from the third party software and tried to see if the user area will appear but it hasnt. I realize the only this will work is if the user actually registers using the 4images registration service. Its a real shame this MOD is amazing, i would love to have it but it seems i cannot due to registration issues. :(
Title: Re: [MOD] User Categories Area
Post by: budduke on August 20, 2010, 12:11:03 AM
@zakaria666,
do you know how to use phpmyadmin to change your database?

On my post, all you need to do is change the default setting for both of those fields to 1 and then everytime a new database entry is created they will automatically be turned on.

I may be able to create an installer file you can run that will do this for you.

since you are using something else for registration, is it still using the user database? if not, then nothing we will do will change anything, it would have to be changed on the other end.

Can you post or PM me a link to your site so I can see how it is registering?
Title: Re: [MOD] User Categories Area
Post by: zakaria666 on August 20, 2010, 12:21:52 AM
Budduke, I am using this www.amember.com (http://www.amember.com) software and it offers a plugin that registers users that lets them user the username and password on 4images.

Because i am trying to make the registration simpler on the member, i thought it would be wise if they registered in 1 place making it easier for the user rather than having to register in two places. The registration works, the user is able to use the username and password on 4images.

to be honest i really have no clue as to how phpadmin works :( please forgive me i wish i had more knowlegde currently i am learning php with mysql. I will be sooooooooooooooooooooooo honoured if u would be kind enough to make an installer that will help me in using this great MOD, i relaly will. This will be the icing on the cake. I will be seriously over the moon if u can help me.

The registration process works for 4images users can login and users can browse just like if they were to register on the 4images page. Only problem like i said is that when user logs in they have that certain problem of not having any privileges because of the issue u pointed out regarding the mysql issue. Please help me sir, i will pay u for ur hard work. Pm me ur paypal, i wouldnt want to think i am taking advantage. God bless u sir
Title: Re: [MOD] User Categories Area
Post by: surferboy on August 20, 2010, 01:09:58 AM
Hey Buddy Duke,

I have prepping my 4images gallery for use with aMember external registration.  I am following your notes about this with avid interest. I am somewhat familiar with phpmyadmin so I will let you know if I am successful in changing the default settings.

[Edit] changed the default settings for the two fields so I should be all set.  Since we use aMember for several Single Sign On (SSO) functions, what we have found is that aMember creates the user profile in the receiving database, passing those amember fields we specify. So our users register with aMember, providing a user id, password, email, country, sex, state, city, and other information. I work with the folks at aMember to modify the plugin they offer to pass these additional fields to the 4images user database where I have already created the additional fields.

Thanks,

Brian
Title: Re: [MOD] User Categories Area
Post by: budduke on August 20, 2010, 01:27:34 AM
@ zakaria666,
unzip the attached file and place it in the root of your 4images gallery and run it and it should change the default value of both those fields for you.
It was harder then I thought to change a default value but it worked on my database.

@surferboy,
That would be nice if they looked at the structure of the database they were importing into and tried to mirror it, but the software sounds kinda interesting.
Title: Re: [MOD] User Categories Area
Post by: budduke on August 23, 2010, 12:57:35 AM
[MOD] UPDATE...
If you are using the media sites mod http://www.4homepages.de/forum/index.php?topic=24054.0 (http://www.4homepages.de/forum/index.php?topic=24054.0)
and you need thumbnails to be created while using my user_multi_upload.php file...
Here is what I found should fix it for you...

in the user_multiupload.php file

search for
Code: [Select]
    $remote_media_file[$i] = format_url(un_htmlspecialchars(trim($HTTP_POST_VARS['remote_media_file'.$i])));
insert AFTER
Code: [Select]
/*
  MOD MEDIA SITES
  BEGIN INSERT
*/
  if ($media_sites_data[$i] = media_sites($remote_media_file[$i]))
    $remote_media_file [$i]= $media_sites_data[$i][1]['media_src'];
/*
  MOD MEDIA SITES
  END INSERT
*/

search for
Code: [Select]
if (!$uploaderror) {insert BEFORE
Code: [Select]
/*
  MOD MEDIA SITES
  BEGIN INSERT
*/
    for ($i = 0; $i < $user_multiupload_size; $i++) {
if (empty($new_thumb_name[$i]) && $data = media_sites_thumb($media_sites_data[$i], $cat_id, $direct_upload))
{
$new_thumb_name[$i] = $data[0];
}
}
/*
  MOD MEDIA SITES
  END INSERT
*/

search for
Code: [Select]
$media = $site_template->parse_template("media/".$file_extension);insert BEFORE
Code: [Select]
/*
  MOD MEDIA SITES
  START INSERT
*/
      media_sites_template_vars($new_name[$i]);
/*
  MOD MEDIA SITES
  END INSERT
*/

That should now give you thumbnails when uploading...
Title: Re: [MOD] User Categories Area
Post by: zakaria666 on August 23, 2010, 02:12:09 AM
@Budduke,

What can i say bro, You are 1 amazing person. Thank you so much man. The fact you taking time out to help people like me is no words can describe. Im looking at the code and im just shocked as to how advanced your knowlegde is. Please understand i am utterly grateful for what you do for us and the help you are offering this community. I just wish more people were like you and were as commited like you. From the bottom of my heart, thank you budduke and i hope you will amaze us with another great MOD. Your are the best. I sincerely mean that. I hope people are not lazy and take the time out to write a thank you to you

zakaria
Title: Re: [MOD] User Categories Area
Post by: zakaria666 on September 10, 2010, 08:10:05 PM
@Budduke

Hello sir,

I just want to clarify a few things with you.

1) Only members who now register to 4images after this mod has been installed are the only ones that will see the link to  'user category'. And those members who were regsitered before the MOD was installed wont see the link 'user categery'? I just want to make sure that this is the case as u know more than me because i have downloaded this http://www.4homepages.de/forum/index.php?topic=24628.msg150142#msg150142  (http://www.4homepages.de/forum/index.php?topic=24628.msg150142#msg150142) zip u kindly made that was supposed to do something inside of the database. And give the users that were regsitered before the MOD was installed wil have access to user category. But after installing the zip and logging in as administrator or any other dummy test account i cannot seem to find the user caterogy link on the side.

Thank u Budduke and i would look forward to hearing from u
Title: Re: [MOD] User Categories Area
Post by: budduke on September 11, 2010, 12:34:48 AM
@ zakaria666,

man, what was I smoking when I made that installer file for you... :oops:
The file just changed the default setting that only takes effect when you create a new user, Boy, I must had allot on my mind that day,

download the attached zip file and unzip the 2 files to your 4images root folder and execute them.
the modify_user_allowed.php file will change all your current users except the guest account to yes.
the modify_user_direct.php will make all your current users allowed to upload without your approval (direct upload)

slight oversight there but I got it this time around,
On my next version of this mod I will add this into it for other users so I am glad it happened so I know how to fix it.

Title: Re: [MOD] User Categories Area
Post by: zakaria666 on September 11, 2010, 01:15:49 AM
@Budduke,

No way man dont sweat it, it works now. Nice 1. Thanks for that sir. Thanks again for the swift fix

 :thumbup: :thumbup:
Title: Re: [MOD] User Categories Area
Post by: Yaso9 on September 22, 2010, 02:26:09 AM
[MOD] UPDATE...
If you are using the media sites mod http://www.4homepages.de/forum/index.php?topic=24054.0
and you need thumbnails to be created while using my user_multi_upload.php file...
Here is what I found should fix it for you...

in the user_multiupload.php file

search for
Code: [Select]
    $remote_media_file[$i] = format_url(un_htmlspecialchars(trim($HTTP_POST_VARS['remote_media_file'.$i])));
insert AFTER
Code: [Select]
/*
  MOD MEDIA SITES
  BEGIN INSERT
*/
  if ($media_sites_data[$i] = media_sites($remote_media_file[$i]))
    $remote_media_file [$i]= $media_sites_data[$i][1]['media_src'];
/*
  MOD MEDIA SITES
  END INSERT
*/

search for
Code: [Select]
if (!$uploaderror) {insert BEFORE
Code: [Select]
/*
  MOD MEDIA SITES
  BEGIN INSERT
*/
    for ($i = 0; $i < $user_multiupload_size; $i++) {
if (empty($new_thumb_name[$i]) && $data = media_sites_thumb($media_sites_data[$i], $cat_id, $direct_upload))
{
$new_thumb_name[$i] = $data[0];
}
}
/*
  MOD MEDIA SITES
  END INSERT
*/

search for
Code: [Select]
$media = $site_template->parse_template("media/".$file_extension);insert BEFORE
Code: [Select]
/*
  MOD MEDIA SITES
  START INSERT
*/
      media_sites_template_vars($new_name[$i]);
/*
  MOD MEDIA SITES
  END INSERT
*/

That should now give you thumbnails when uploading...


great
but  is it possible to get thumb from youtube ? from same video ?
Title: Re: [MOD] User Categories Area
Post by: budduke on September 22, 2010, 02:48:07 PM
@ Yaso9,

Not sure what your question is but if you have installed the other MOD called Media sites, then this patch creates thumnails for the remote videos just like it does in the other mod.
Is that your question?
Title: Re: [MOD] User Categories Area
Post by: surferboy on December 03, 2010, 02:37:54 AM
Hi -

I'm doing some tweaks on our FAQ's and wondered if there was a way to limit Image Name in character length in the coding?

Otherwise, if someone enters a long field name, it plays havoc with our row display and template and causes the template to bulge outwards.  Depending on how the image name is entered, with or without underscores, 4images does not provide automatic wrapping to conform with the row box dimensions when you click on a given category.

In other words, we have 2 rows of 6 images configured for our templates as a display when you click on a category.  If the image name gets too long, it pushes the row outwards to the side, and therefore pushes the template out as well.

[edit]

Another question/issue:
I tried to upload this image using the remote url function and adding her name, Susan Francia, as the image name:
http://3.bp.blogspot.com/_1Ssoxfl0MvQ/StxFzLrMzeI/AAAAAAAAKQE/hQhbEIVVES8/s1600-h/espn9.jpg

The result is the "eye image" and the image name but when you click on the image name, and go to the details page, all you see is her image name but not the image. Have I missed something? Not sure why this is not working.

Thanks for considering my requests and questions.

Brian
Title: Re: [MOD] User Categories Area
Post by: budduke on December 04, 2010, 02:04:42 AM
@ surferboy,
Both questions really aren't Mod related but will do my best to answer them...

The first one,
 if I understand what you are trying to do, I would say the best way would be to let the long name be entered but to change the thumbnail.bit template to cut off the name at a certain # of characters.
That way they will still be able to search on the long image name but the shortened version would appear on your thumbnails...
If it was me I would look in your thumbnail_bit.html file for {image_name} and replace it with this code...
Code: [Select]
<?PHP echo substr(format_text($image_name,2),0,10);?>Replace the 10 with length of characters (I think that should work)
You may also have to edit the random_image and random_cat_image templates also.

your second one (issue) did the same thing to me also,
I even tried adding it in the admin panel (outside my mod) and the same thing happened. The link is saved correctly in the database when I looked at it, but you can not download it or thumbnail it.
I  remember something about directories that begin with a underscore like that one has and some problems linking to them but I can not remember much about it.
I do not work with remote stuff so this is new to me. I tried linking a remote image from my own site and it worked...
http://www.budduke.com/gallery/data/media/15/big/ntcosmo01.JPG (http://www.budduke.com/gallery/data/media/15/big/ntcosmo01.JPG)
but it did NOT create a thumbnail. Even from the admin panel or the normal member upload screen but it did link to it and I can download it.

I found these to MODS that seem to address this issue...
for the admin panel...
http://www.4homepages.de/forum/index.php?topic=6921.0 (http://www.4homepages.de/forum/index.php?topic=6921.0)
for the member upload...
http://www.4homepages.de/forum/index.php?topic=6920.0 (http://www.4homepages.de/forum/index.php?topic=6920.0)

I know that I do not have them installed inside my multiupload file. Give me a little time and I will see if I can add it to my uploader form...

but as for why that remote image cannot be linked to, you may want to post it in a topic all by itself under troubleshooting to see if anyone has any ideas
Title: Re: [MOD] User Categories Area
Post by: surferboy on December 04, 2010, 03:36:35 AM
Hi -

Thanks so much for your help. Your suggested fix worked perfectly. I rigged the system with a 27 character image name all connected by letters or underscore, and uploaded. Sure enough, the letters truncated at 20, (my setting), and yet the image name remained intact.

Thanks so much.

I do have the AutoThumbailer v2.3 mod installed, and yes, it does function as designed in the ACP for those remotely uploaded images.  I am aware of the other MOD, remote image thumbnail creation, but held off installing that in April of this year, thinking that the AutoThumnailer MOD superceded it.  I'll give it a try.

[edit]

I installed the MOD Remote Image Thumbnail Creation, http://www.4homepages.de/forum/index.php?topic=6920.0, and tried it using your MultiUpload and it did not work, in creating a remote thumbnail image. I tried it with the default image upload button, and yes, it did work. Thanks for considering adding the member remote upload thumbnail creation feature in your MOD.

Thanks again.

Brian
Title: Re: [MOD] User Categories Area
Post by: surferboy on December 07, 2010, 06:11:16 PM
Hi -

New issue that I wanted to alert you to about your MOD:

the autoresize did not seem to work when I performed a remote image url upload into one of my personal galleries.

Here is the massive image that needs resizing, of course! -

http://upload.wikimedia.org/wikipedia/commons/5/59/Pergamonmuseum_-_Antikensammlung_-_Pergamonaltar_13.jpg

The auto resize does work when I upload any manner of large-sized files from my desktop.

Thanks,

Brian
Title: Re: [MOD] User Categories Area
Post by: budduke on December 09, 2010, 12:58:45 AM
@ surferboy,
I was looking around the forum trying to find a correct answer but I believe that you can not resize the remote image because it would have to upload the image to your server in order to resize it, taking away from why it was on a remote server.
I do understand why you would want it to be resized but I do not think it is possible.
When I get time I will look deeper into the code to see because if you can create a thumbnail for a remote image you would think you could also create a second size image at the same time...

The holidays have me very busy so no telling when I will get around to it.
Title: Re: [MOD] User Categories Area
Post by: surferboy on December 09, 2010, 02:44:09 AM
Hi budduke,

Thanks for taking a look at this issue.  The reason I need this is that our members will be uploading images, from their own computers as well as with remote url's and if the images don't resize, our gallery default templates jump outwards to extreme width, and I am striving to keep the templates at just one width.

I was successful in uploading the remote url I listed in my post using the standard upload button and having it resize to my settings: 818 x 1024. I have the two upload buttons next to each other right now, which of course display for all categories, user and regular:
{upload_button} and the {user_multiupload_button}

Thanks again,

Brian