Author Topic: checkimages-Subcategories only from logged user  (Read 11264 times)

0 Members and 1 Guest are viewing this topic.

Offline Krali

  • Newbie
  • *
  • Posts: 18
    • View Profile
checkimages-Subcategories only from logged user
« 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

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: checkimages-Subcategories only from logged user
« Reply #1 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

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

Offline Krali

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: checkimages-Subcategories only from logged user
« Reply #2 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

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: checkimages-Subcategories only from logged user
« Reply #3 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


Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

Offline Krali

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: checkimages-Subcategories only from logged user
« Reply #4 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

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: checkimages-Subcategories only from logged user
« Reply #5 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;
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Krali

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: checkimages-Subcategories only from logged user
« Reply #6 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
« Last Edit: November 23, 2010, 09:25:06 AM by Krali »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: checkimages-Subcategories only from logged user
« Reply #7 on: November 23, 2010, 02:07:18 PM »
perhaps your user ids don't match with cat ids
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Krali

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: checkimages-Subcategories only from logged user
« Reply #8 on: November 23, 2010, 02:09:29 PM »
perhaps your user ids don't match with cat ids


???

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: checkimages-Subcategories only from logged user
« Reply #9 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.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Krali

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: checkimages-Subcategories only from logged user
« Reply #10 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

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: checkimages-Subcategories only from logged user
« Reply #11 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;
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Krali

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: checkimages-Subcategories only from logged user
« Reply #12 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

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: checkimages-Subcategories only from logged user
« Reply #13 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);
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Krali

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: checkimages-Subcategories only from logged user
« Reply #14 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