4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: Krali on November 22, 2010, 10:37:58 PM

Title: checkimages-Subcategories only from logged user
Post by: Krali on November 22, 2010, 10:37:58 PM
Hello,

we are 5 users in our gallery and all have administrator rights.

We have a lot of subcategories now, so it is not ok to have the whole list of subcategories in the dropdown of checkimages.php.

I know how to get the user_id from the logged in user: $user_info['user_id']
And I know the start cat_id of each user, which should be used for the beginning of the sub categories.

So, what do I have to change to get only the sub-categories (cache?) from the logged in user in the dropdown of checkimages.php?

Thank you!

Kind regards,

Klaus
Title: Re: checkimages-Subcategories only from logged user
Post by: x23piracy on November 22, 2010, 10:48:46 PM
Hi,

out of the box 4images don't save category creator so never...
Maybe you can use the MOD where user can create there own
Subcategories, i don't know but maybe there is a db extension
who save's this.


Greetz X23
Title: Re: checkimages-Subcategories only from logged user
Post by: Krali on November 22, 2010, 10:50:39 PM
Hello,

I don't need an owner of a category.

Everyone of us has it's own first "root" - category. With the user_id I can set this "root-category" anywhere to get only all the subcategories of this "root-category".

Do you understand?

Kind regards,

Klaus
Title: Re: checkimages-Subcategories only from logged user
Post by: x23piracy on November 22, 2010, 11:19:48 PM
Hi,

try this:

checkimages.php find:
Code: [Select]
$desc = get_category_dropdown_check($cat_id);
replace $cat_id with an existing category id for example:
Code: [Select]
$desc = get_category_dropdown_check(1);
I've not tested that just try it, nothing will be broken...

If that work we need to extend the code around it


Greetz X23

Title: Re: checkimages-Subcategories only from logged user
Post by: Krali on November 22, 2010, 11:57:36 PM
Hello,

no, this will not work, I tried this before.

If you change this line, the dropdown has pre-selected the category, you write in this line.
But all other subcategories of all users are still there and if you have a second or more pages for one process for the next photos, it will not use the manually choosen category, but the preselected again.

Thank you

Kind regards,

Klaus
Title: Re: checkimages-Subcategories only from logged user
Post by: V@no on November 23, 2010, 04:26:19 AM
Assuming you are using 4images v1.7.8 or newer, in checkimages.php find:
Code: [Select]
  $cat_id = (isset($HTTP_POST_VARS['cat_id_p'])) ? intval($HTTP_POST_VARS['cat_id_p']) : 0;
  $cat_id_p = $cat_id;

Replace it with:
Code: [Select]
  $cat_id = (isset($HTTP_POST_VARS['cat_id_p'])) ? intval($HTTP_POST_VARS['cat_id_p']) : $user_info['user_id'];
  $cat_id_p = $cat_id;
Title: Re: checkimages-Subcategories only from logged user
Post by: Krali on November 23, 2010, 09:06:15 AM
Hello,

I am using 1.7.5.

I found two of these lines in checkimages.php:
$cat_id = (isset($HTTP_POST_VARS['cat_id_p'])) ? intval($HTTP_POST_VARS['cat_id_p']) : 0;

I changed both, but nothing has changed.

Thank you!

Kind regards,

Klaus

PS:
If I change:
Code: [Select]
if ($action == "checkimages")
{
  $max_dimension = (isset($HTTP_POST_VARS['max_dimension'])) ? $HTTP_POST_VARS['max_dimension'] : $max_dimension_default;
  $cat_id = (isset($HTTP_POST_VARS['cat_id_p'])) ? intval($HTTP_POST_VARS['cat_id_p']) : $user_info['user_id'];

to

Code: [Select]
if ($action == "checkimages")
{
  $max_dimension = (isset($HTTP_POST_VARS['max_dimension'])) ? $HTTP_POST_VARS['max_dimension'] : $max_dimension_default;
  $cat_id = (isset($HTTP_POST_VARS['cat_id_p'])) ? intval($HTTP_POST_VARS['cat_id_p']) : $user_info['user_id'];

Nothing happens, but if I change it to:
Code: [Select]
if ($action == "checkimages")
{
  $max_dimension = (isset($HTTP_POST_VARS['max_dimension'])) ? $HTTP_POST_VARS['max_dimension'] : $max_dimension_default;
  $cat_id = (isset($HTTP_POST_VARS['cat_id_p'])) ? intval($HTTP_POST_VARS['cat_id_p']) : 1;

The dropdown jumps directly to the Name of the user with user_id 1 in the dropdown, which is a first helpful way. But all the other users are still there with their subcategories and why is it not working with $user_info['user_id'] ?

Thank you

Kind regards,

Klaus
Title: Re: checkimages-Subcategories only from logged user
Post by: V@no on November 23, 2010, 02:07:18 PM
perhaps your user ids don't match with cat ids
Title: Re: checkimages-Subcategories only from logged user
Post by: Krali on November 23, 2010, 02:09:29 PM
perhaps your user ids don't match with cat ids


???
Title: Re: checkimages-Subcategories only from logged user
Post by: V@no on November 23, 2010, 02:42:43 PM
As I understood your original post is that your users have the same IDs as categories, so when you go to categories.php?cat_id=4 and then change url to member.php?action=showprofile&user_id=4 it would open page of the user of that category.
Title: Re: checkimages-Subcategories only from logged user
Post by: Krali on November 23, 2010, 02:46:25 PM
As I understood your original post is that your users have the same IDs as categories, so when you go to categories.php?cat_id=4 and then change url to member.php?action=showprofile&user_id=4 it would open page of the user of that category.

Hello,

no, that's not right.

It's like that:
Code: [Select]
if ($user_info['user_id'] == "2") {
    $usercat = "2";
} elseif ($user_info['user_id'] == "3") {
    $usercat = "3";
} elseif ($user_info['user_id'] == "4") {
    $usercat = "1";
} elseif ($user_info['user_id'] == "5") {
    $usercat = "111";
} elseif ($user_info['user_id'] == "6") {
    $usercat = "390";
}

Thank you

Kind regards,

Klaus
Title: Re: checkimages-Subcategories only from logged user
Post by: V@no on November 23, 2010, 03:06:02 PM
Well, there you go, such a little, but crucial fact ;)
 add that code below
Code: [Select]
require('admin_global.php');

and then replace
Code: [Select]
if ($action == "checkimages") {
  $cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : 0;

with:
Code: [Select]
if ($action == "checkimages") {
  $cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : $usercat;
Title: Re: checkimages-Subcategories only from logged user
Post by: Krali on November 23, 2010, 03:16:39 PM
Hi,

ok, I have now:
if ($action == "checkimages")
{
  $max_dimension = (isset($HTTP_POST_VARS['max_dimension'])) ? $HTTP_POST_VARS['max_dimension'] : $max_dimension_default;
  $cat_id = (isset($HTTP_POST_VARS['cat_id_p'])) ? intval($HTTP_POST_VARS['cat_id_p']) : $usercat;

But all the other users and subcategories are still there, it is now just the Beginning of the user preselected.

Thank you

Kind regards,

Klaus
Title: Re: checkimages-Subcategories only from logged user
Post by: V@no on November 23, 2010, 04:19:45 PM
Try replace
Code: [Select]
  $desc = get_category_dropdown($cat_id, 0, 4);

with:
Code: [Select]
  $desc = get_category_dropdown($cat_id, $cat_id, 4);
Title: Re: checkimages-Subcategories only from logged user
Post by: Krali on November 23, 2010, 04:24:49 PM
Hi,

I only have this code:
Code: [Select]
$desc = get_category_dropdown_check($cat_id);
When I replace it with
Code: [Select]
$desc = get_category_dropdown($cat_id, $cat_id, 4);, there is no change.

Here is the file checkimages.php

Thank you

Kind regards,

Klaus
Title: Re: checkimages-Subcategories only from logged user
Post by: V@no on November 23, 2010, 05:11:24 PM
So you are using a mod, not original checkimages.php (should've mentioned this).

Remove all the changes except for what you added under admin_global.php line.
Then find:
Code: [Select]
$category .= get_category_dropdown_bits($cat_id);
Replace it with:
Code: [Select]
global $usercat;
$category .= get_category_dropdown_bits($cat_id, $usercat);
Title: Re: checkimages-Subcategories only from logged user
Post by: Krali on November 23, 2010, 06:13:11 PM
Hey,

GREAT, it works!!!

But I didn't have to delete anything :-)

Thank you very, very much!!!

Kind regards,

Klaus