4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: V@no on April 27, 2005, 04:29:11 AM
-
With this mod you will be able apply category permissions including it's sub-categories.
----------- [ Installation ] ---------------
Step 1
Open admin/categories.php
Find: $auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];
Insert below:/*
MOD SUBCAT PERM FROM PARENT
BEGIN INSERT
*/
$subcats = (isset($HTTP_POST_VARS['subcats']) && $HTTP_POST_VARS['subcats']) ? 1 : 0;
/*
MOD SUBCAT PERM FROM PARENT
END INSERT
*/
Step 1.1
Find: $msg = ($result) ? $lang['cat_edit_success'] : $lang['cat_edit_error'];
Insert above:
(for 4images v1.7/1.7.1 only!)
/*
MOD SUBCAT PERM FROM PARENT
BEGIN INSERT
*/
if ($subcats)
{
function get_subcategories_id($cat_id = 0)
{
global $subcat_ids, $cat_parent_cache;
if (!isset($cat_parent_cache[$cat_id]))
{
return false;
}
foreach ($cat_parent_cache[$cat_id] as $key => $val)
{
$subcat_ids[] = $val;
get_subcategories_id($val);
}
return $subcat_ids;
}
$subcat_ids = array();
$subcat_ids = get_subcategories_id($cat_id);
if (!empty($subcat_ids))
{
$sql = "UPDATE ".CATEGORIES_TABLE."
SET 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
WHERE cat_id IN (".implode($subcat_ids, ",").")";
$result = $site_db->query($sql);
}
}
/*
MOD SUBCAT PERM FROM PARENT
END INSERT
*/
(for 4images v1.7.2 and newer)
/*
MOD SUBCAT PERM FROM PARENT
BEGIN INSERT
*/
if ($subcats)
{
$subcat_ids = array();
$subcat_ids = get_subcategories_id($cat_id);
if (!empty($subcat_ids))
{
$sql = "UPDATE ".CATEGORIES_TABLE."
SET 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
WHERE cat_id IN (".implode($subcat_ids, ",").")";
$result = $site_db->query($sql);
}
}
/*
MOD SUBCAT PERM FROM PARENT
END INSERT
*/
Step 1.2
Find: show_form_footer($lang['save_changes'], $lang['reset'], 2, $lang['back']);
Insert above:
/*
MOD SUBCAT PERM FROM PARENT
BEGIN INSERT
*/
show_radio_row("Apply to all subcategories", "subcats", $subcats);
/*
MOD SUBCAT PERM FROM PARENT
END INSERT
*/
That's all.
Now when you edit category permissions, you should see a new option Apply to all subcategories
-
Fantastic! I can't wait to try this.
-
Super Vano :!: :D
-
Well, shoot. I got a Bad SQL Query right off the bat. I do have a shared database with phpBB2 -- could that be the reason?
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' auth_terms = WHERE cat_id IN (293,4,5,307,14,
Error editing category
I have no idea what this means! I'm using version 1.7 of 4images if that means anything also.
-
my bad, forgot remove some extra fields I have in my code... its fixed now, redo Step 1.1
-
my bad, forgot remove some extra fields I have in my code... its fixed now, redo Step 1.1
Beauty. What a time saver! Thanks for the quick fix, dude. You rock as usual.
Dave
-
I get the option now, but my save changes button has now vanished?
-
I get the option now, but my save changes button has now vanished?
restore backups and try again.
I have no idea what possible could cause your "save" button to dissapier...
-
I did it wrong, It works now, thanks
-
$auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];
I have the above code in two differnet places in my admin/categories.php
Should I use the following code in both places?
/*
MOD SUBCAT PERM FROM PARENT
BEGIN INSERT
*/
$subcats = (isset($HTTP_POST_VARS['subcats']) && $HTTP_POST_VARS['subcats']) ? 1 : 0;
/*
MOD SUBCAT PERM FROM PARENT
END INSERT
*/
Any help will be greatly appreciated. Thanks.
-
probably only below
if ($action == "updatecat") {
(second item)
-
Works! Thank you for your help.
-
Really thanks for that MOD!
WORKS PERFECT WITHOUT HAVING TROUBLE!!!
:D
-
Is there a mod that allow to do almost the same thing with users group on categories.
I explain myself :
on my site, I have about 12 main categories with for some of it 30 subcategories (on several levels). When I create a new group, I apply the same permissions than main categories to their subcategories. It should be really optimized if there was somme "apply to subcategories" actions (for the groupe) on this page.
Have you seen a mod like that somewhere?
-
THANK YOU - Exactly what I was looking for... :D
-
Is it possible to set (change) permissions for all categories (at once) ?
-
V@no,
This is great MOD, thanks so much for sharing it! I just know this will be a real time saver! :)
namaste,
Threnody
-
This is a perfect mod :D
and it work also perfect :lol:
thx v@no :mrgreen:
-
Is it possible to set (change) permissions for all categories (at once) ?
This is a great mod, easy install and works great. I also am interested in above.
-
Is it possible to set (change) permissions for all categories (at once) ?
Not with this mod.
If you are interested, I can provide you with MySQL query that you can run in phpmyadmin...
-
Is it possible to set (change) permissions for all categories (at once) ?
Not with this mod.
If you are interested, I can provide you with MySQL query that you can run in phpmyadmin...
yes, i am very interested :)
thx
-
Ok, here it is:[qcode]UPDATE 4images_categories SET
auth_viewcat = xx,
auth_viewimage = xx,
auth_download = xx,
auth_upload = xx,
auth_directupload = xx,
auth_vote = xx,
auth_sendpostcard = xx,
auth_readcomment = xx,
auth_postcomment = xx[/qcode]
The xx is one of the following:
- 0 = All
- 2 = Only registered members
- 3 = Private
- 9 = Admins only
These are default settings, but to make sure double check in includes/constants.php:// Permission levels
define('AUTH_ALL', 0);
define('AUTH_USER', 2);
define('AUTH_ACL', 3);
define('AUTH_ADMIN', 9);
You can remove auth_xxx from the query if you DON'T want to update that permission.
-
that worked just perfect ! thx a lot !! :D
-
Works like a charm. Luckily I didn't go changing each directory's permissions before seeing this :mrgreen:
-
Does this mod work in version 1.7.2? It was very useful and I don't know why you didn't include it in the new version.
-
doesnt work in 1.7.2 i get an error
Fatal error: Cannot redeclare get_subcategories_id() (previously declared in /gallery/admin/categories.php:333) in /gallery/admin/categories.php on line 645
-
From Step 1.1 of this mod remove
function get_subcategories_id($cat_id = 0)
{
global $subcat_ids, $cat_parent_cache;
if (!isset($cat_parent_cache[$cat_id]))
{
return false;
}
foreach ($cat_parent_cache[$cat_id] as $key => $val)
{
$subcat_ids[] = $val;
get_subcategories_id($val);
}
return $subcat_ids;
}
v1.7.2 already has this function.
-
From Step 1.1 of this mod remove function get_subcategories_id($cat_id = 0)
{
global $subcat_ids, $cat_parent_cache;
if (!isset($cat_parent_cache[$cat_id]))
{
return false;
}
foreach ($cat_parent_cache[$cat_id] as $key => $val)
{
$subcat_ids[] = $val;
get_subcategories_id($val);
}
return $subcat_ids;
}
v1.7.2 already has this function.
Thanks V@no this works perfect :lol:
-
Ok, here it is:[qcode]UPDATE 4images_categories SET
auth_viewcat = xx,
auth_viewimage = xx,
auth_download = xx,
auth_upload = xx,
auth_directupload = xx,
auth_vote = xx,
auth_sendpostcard = xx,
auth_readcomment = xx,
auth_postcomment = xx[/qcode]
The xx is one of the following:
- 0 = All
- 2 = Only registered members
- 3 = Private
- 9 = Admins only
is it possible to define categories to apply the changes ?
ex : UPDATE 4images_categories 200 to 500 SET [...]
(yeah i don't know anything about sql requests)
-
Ok, I answer myself :D
UPDATE 4images_categories SET
auth_viewcat = x,
auth_viewimage = x,
auth_download = x,
auth_upload = x,
auth_directupload = x,
auth_vote = x,
auth_sendpostcard = x,
auth_readcomment = x,
auth_postcomment = x
WHERE cat_id=Y
or WHERE cat_id>Y etc...
-
Easy to "install", works great - thanks!
-
PERFECT :)
-
Fatal error: Cannot redeclare get_subcategories_id() (previously declared in /www/htdocs/v110298/galerie/admin/categories.php:331) in /www/htdocs/v110298/galerie/admin/categories.php on line 669
:-(
I have version 1.7.2 of the Script.What can I do?
Thx for helping
-
From Step 1.1 of this mod remove function get_subcategories_id($cat_id = 0)
{
global $subcat_ids, $cat_parent_cache;
if (!isset($cat_parent_cache[$cat_id]))
{
return false;
}
foreach ($cat_parent_cache[$cat_id] as $key => $val)
{
$subcat_ids[] = $val;
get_subcategories_id($val);
}
return $subcat_ids;
}
v1.7.2 already has this function.
-
I have problem in 1.72v
Step 1
Open admin/categories.php
Find:
Code:
$auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];
i found two
$auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];
in if ($action == "updatecat") and if ($action == "savecat") {
when insert $subcats = (isset($HTTP_POST_VARS['subcats']) && $HTTP_POST_VARS['subcats']) ? 1 : 0; ?
in 1.72v doesn't work :?
-
Applied it to 1.7.2 without step 1.1. No error message but subcategories are not changed either.
Any ideas? I checked the code twice and am pretty sure I made no mistake with copy-paste.
-
well, if you didnt do all the steps, then what are you complaining about? :roll:
-
Ah, misread .. thought the whole 1.1. had to be skipped. My bad.
Thanks for fixing it on page 1. :)
-
Great mode! It works perfectly! :D
Thanks
-
Can this works with 1.7.3 ?
-
Zu früh gefreut :( Habe alles nach Anleitung gemacht, habe Version 1.7.3 (Link: klick (http://www.larasgeneration.de/4images/index.php)).
Im Admin Menü erscheint zwar das Feld "Apply to all subcategories", aber es funktioniert einfach nicht. Er übernimmt die Änderungen nicht für die Subkategorien :?
-
Zu früh gefreut :( Habe alles nach Anleitung gemacht, habe Version 1.7.3 (Link: klick (http://www.larasgeneration.de/4images/index.php)).
Im Admin Menü erscheint zwar das Feld "Apply to all subcategories", aber es funktioniert einfach nicht. Er übernimmt die Änderungen nicht für die Subkategorien :?
Bei mir geht es auch nicht trotz des Feldes "Apply to all subcategories" (Version 1.7.6). Kann mal einer eine funktionierende und angepasste categories.php zum Download bereitstellen oder den Code posten?
-
Add this to your language file: admin.php
Find:
$lang['save_changes'] = "Save changes";
Insert it below:
$lang['sub_categories_permission'] = "Apply To All Subcategories";
-
You forgot to mention where to edit for the language code. Please fix that also.
-
@Ivan:
Vielleicht könntest Du noch bei Punkt 1 vermerken das man die zweite Stelle der gefundenen Zeilen (ca. 610 -612 Zeile) in der "categories.php" darunter ergänzen muss. Steht zwar schon mal weiter vorn im Thread, aber so wäre die Installation leichter.
Thanks for your work V@no and Ivan.
-
Great MOD!
Just one more thing I would like to do. How I go to edit some categorie, the button "NO" related to "Aplly to all subcategories" is selectect by default. How can I turn into default the button "YES" to be selected?
-
Funktioniert das auch mit Version 1.7.7?
-
Funktioniert das auch mit Version 1.7.7?
Ich habs unter 1.7.6, entsprechend der Anleitung für 1.7.4 - 1.7.6 installiert. Danach einen manuellen Update auf 1.7.7 gemacht und der MOD läuft heut noch.
Daher gehe ich davon aus das er auch in einem "reinen" 1.7.7 läuft.
Du kannst den MOD ja vorher mit der Mobilserver Version 1.7.7 testen.
-
Habe die beiden Dateien geändert. Hat prima funktioniert... :D
Nun ist endlich Schluss mit dem schei** Spam... :mrgreen:
-
Original Code from: V@no (http://www.4homepages.de/forum/index.php?topic=7643.0) and Ivan (http://www.4homepages.de/forum/index.php?topic=7643.msg110977#msg110977)
Changelog / Änderungen:
- Beim Kategorie erstellen ist die Funktion auch vorhanden / Support the function by add categorie
- Mehrsprachig / Multilingual
Dieser MOD kann die Rechte einer Kategorie mit allen Unterkategorien aktualisieren.
Läuft mit 4images 1.7.7
Work with 4images 1.7.7
Step 1
Open / Öffne: admin/categories.php
Find / Finde:
$auth_sendpostcard = $HTTP_POST_VARS['auth_sendpostcard'];
$auth_readcomment = $HTTP_POST_VARS['auth_readcomment'];
$auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];
Insert / Füge below / darunter:
// MOD SUBCAT PERM FROM PARENT START
$subcats = (isset($HTTP_POST_VARS['subcats']) && $HTTP_POST_VARS['subcats']) ? 1 : 0;
// MOD SUBCAT PERM FROM PARENT END
Step 1.1
Find / Finde:
show_table_separator($permission_headline, 2);
foreach ($access_field_array as $key => $val) {
show_access_select($lang[$key], $key, $val);
}
Insert / Füge below / danach:
// MOD SUBCAT PERM FROM PARENT START
show_radio_row($lang['sub_categories_permission'], "subcats", $subcats);
// MOD SUBCAT PERM FROM PARENT END;
Step 1.2
Find / Finde:
$msg = ($result) ? $lang['cat_edit_success'] : $lang['cat_edit_error'];
Insert / Füge above / davor:
// MOD SUBCAT PERM FROM PARENT START
if ($subcats)
{
$subcat_ids = array();
$subcat_ids = get_subcategories_id($cat_id);
if (!empty($subcat_ids))
{
$sql = "UPDATE ".CATEGORIES_TABLE."
SET 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
WHERE cat_id IN (".implode($subcat_ids, ",").")";
$result = $site_db->query($sql);
}
}
// MOD SUBCAT PERM FROM PARENT END
Step 1.3
Find / Finde:
show_form_footer($lang['save_changes'], $lang['reset'], 2, $lang['back']);
Insert / Füge above / darüber:
// MOD SUBCAT PERM FROM PARENT START
show_radio_row($lang['sub_categories_permission'], "subcats", $subcats);
// MOD SUBCAT PERM FROM PARENT END
Step 1.4
Open / Öffne lang/admin.php
Find / Finde:
* English
$lang['save_changes'] = "Save changes";
* Deutsch
$lang['save_changes'] = "Änderungen speichern";
Replace / Ersetze mit:
* English
$lang['save_changes'] = "Save changes";
$lang['sub_categories_permission'] = "Apply To All Subcategories";
* Deutsch
$lang['save_changes'] = "Änderungen speichern";
$lang['sub_categories_permission'] = "Für alle Unterkategorien übernehmen";
-
Has this mod been tested?
I installed it checked my add categories inside my admin control panel and there was duplicates. Gave me errors.
Thanks any way man