YES WE DID IT! Ok with many thanks to V@no,
I have managed to alter the code enough to just allow members who have created a new category to write to it, but not allow any other members. I did this by altering the code for the upload button, and by adding a field to the *_categories table in the database.
First of all get in the database and add a new field to the categories table called "cat_author"The reason for this is because when a new category is made, we are going to add the name of the member who created it.
For those categories where you want anyone to be able to write to, just put 1. If there is already many categories on your site, you'll have to make the new field with a default value of 1, otherwise nobody will be able to write to them again once the code is in.
(you have been warned)After your time in the databse, now lets alter the code to add the members name who created the category.
Find this entry in addcat.php (you can see where I have entered the new entries. $sql = "INSERT INTO (name)_categories
(whatever your table is called) (
cat_id,
cat_name,
cat_description,
cat_parent_id,
cat_author , cat_hits,
cat_order,
auth_viewcat,
auth_viewimage,
auth_download,
auth_upload,
auth_directupload,
auth_vote,
auth_sendpostcard,
auth_readcomment,
auth_postcomment
)
VALUES
(
'$new_cat_id',
'$new_cat_name',
'$new_cat_description',
'$cat_parent_id',
'$user_name', '$cat_hits',
'$new_cat_order',
'$auth_viewcat',
'$auth_viewimage',
'$auth_download',
'$auth_upload',
'$auth_directupload',
'$auth_vote',
'$auth_sendpostcard',
'$auth_readcomment',
'$auth_postcomment'
)";
Use $username as this is what name you are using when you are logged into the gallery.
Next you will need to add "cat_author" to your global.php in your gallery root directory.Change this line in global.php (Its line 462 in my script) $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
to
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_author, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
Notice the new entry for cat_author?
In catergories.php you need to overwrite and enter some extra code for the new upload button.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&".URL_CAT_ID."=".$cat_id);
$upload_button = "<a href=\"".$upload_url."\"><img src=\"".get_gallery_image("upload.gif")."\" border=\"0\" alt=\"\" /></a>";
}
and change to:
//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------
$online_member ="$user_info[user_name]";
$cat_creator = $cat_cache[$cat_id]['cat_author'];
if($online_member == $cat_creator || $cat_creator ==1)
{
$upload_allowed = "1";
}
else
{
$upload_allowed = "0";
}
if ($upload_allowed != "1") {
$upload_url = "";
$upload_button = "<div align=\"center\"><img src=\"".get_gallery_image("upload_off.gif")."\" border=\"0\" alt=\"\" /> <br />private category</div>";
}
else if (!check_permission("auth_upload", $cat_id)) {
$upload_url = "";
$upload_button = "<img src=\"".get_gallery_image("upload_off.gif")."\" border=\"0\" alt=\"\" />";
}
else {
$upload_url = $site_sess->url(ROOT_PATH."member.php?action=uploadform&".URL_CAT_ID."=".$cat_id);
$upload_button = "<a href=\"".$upload_url."\"><img src=\"".get_gallery_image("upload.gif")."\" border=\"0\" alt=\"\" /></a>";
}
And thats it. Now you can write to any category except those that are created by members (after this code is added).
Hope it works for you
Gary