You can view this working at:
http://rendervisions.com -Click on the galleries link at the top-
1) The first part is creating a warning that an image contains nudity under the thumbnail of that image.
2) The second part is creating a toggle in the Users control panel that allows the user to select yes or no to viewing nudity in the search, categories and details pages of the gallery.
3) The third part is the mod to hide the images that contain nudity if the user has selected No to viewing Nudity in the gallery, in his/her control panel (You must complete step 1 and 2 for this to work).
(Remember its allways good practice to backup the files you are going to modify, just in case you need to restore before your changes)
Part 1Displaying a Warning message under images that contain nudity.
OPEN: includes/db_field_definitions.php
Near the bottom ADD:
$additional_image_fields['Nudity'] = array("Image contains nudity", "radio", 1);
OPEN: templates/*Your Template*/member_uploadform.html
FIND:
<td class="row2"><b>{lang_image_name}</b></td>
<td class="row2"><input type="text" name="image_name" size="30" value="{image_name}" class="input" /></td>
</tr>
After ADD:
<tr><td class="row1" align="left"><center>
<div align="left"><u><b>Image Contains</b></u><br>
</div>
<div align="left"><u><b> Nudity?</b></u><br>
</div>
<div align="left"><font size="1">(shows up under the thumbnail image)</font></div>
</center></td>
<td align="left" class="row1">
<div align="left">
</div>
<b>Image Contains Nudity</b><br>
-Click below if applicable-<br>
<div align="left">
</div>
<input type="radio" name="Nudity" value="1"> Yes
<input type="radio" name="Nudity" value="0" checked="checked"> No
<br>
<div align="left">
<br>
<br>
</div>
</td>
</tr>
OPEN: templates/*Your Theme*/thumbnail_bit.html
FIND:
{if allow_comments}{lang_comments} {image_comments}{endif allow_comments}<br />
After ADD:
{if Nudity}<font color=red>Warning: Nudity</font><br>
{endif Nudity}
Open Your Mysql with something like phpmyadmin.
In the following tables: 4images_images, 4images_images_temp
Add the following fields:
Feild Name: Nudity
Type: TINYINT
Length/Values: 4
Default: 0
Now when your Users go to upload thier image they will have a nudity check box. The user will be able to select yes or no if their image has nudity or not. This will also display a Tag under the thumbnail of the image that says
Warning: Nudity if the image contains nudity
Part 2What I wanted to create was a Yes no toggle in the control panel for users to be able to select yes or no to viewing Nudity in the new images, Categories, and details pages.
I created the toggle in the control for users to select Yes or no to view nudity:
Open: includes/db_field_definitions.php
Near the bottom add:
$additional_user_fields['user_gallerynudity'] = array("Show Nudity In Gallery", "radio", 1);
Open: templates/*YourTemplate*/member_editprofile.html
Find
<tr>
<td class="row1"><b>{lang_invisible}</b></td>
<td class="row1">
<input type="radio" name="user_invisible" value="1"{user_invisible_yes} />
{lang_yes}
<input type="radio" name="user_invisible" value="0"{user_invisible_no} />
{lang_no}
</td>
</tr>
After ADD:
<tr>
<td class="row2"><b>Show Nudity in Gallery</b></td>
<td class="row2">
<input type="radio" name="user_gallerynudity" value="1"{user_gallerynudity_yes} />
{lang_yes}
<input type="radio" name="user_gallerynudity" value="0"{user_gallerynudity_no} />
{lang_no}
</td>
</tr>
Next open your MYSQL user table using something like phpmyadmin and add the following field to your 4images_users table:
Feild: user_gallerynudity
Type: TINYINT
Length/Value: 4
Default: 0
Part 3Hiding the thumbnails of Nude images if the user has selected NO to viewing Nude images in the gallery user control panel.
(I wanted to give a very sincere thank you to V@no for showing me exactly what needed to be done to get this part working. *Thank you V@no!!*)
The search.php file will also hide or unhide nude images in your "New Images" page.
OPEN: search.php
FIND:
WHERE i.image_active = 1
$sql_where_query
AND c.cat_id = i.cat_id AND i.cat_id IN ($cat_id_sql)
After ADD:
".(($user_info['user_gallerynudity']) ? "" : " AND i.Nudity <> 1")."
END RESULT WILL LOOK LIKE:
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1
$sql_where_query
AND c.cat_id = i.cat_id AND i.cat_id IN ($cat_id_sql)".(($user_info['user_gallerynudity']) ? "" : " AND i.Nudity <> 1")."
ORDER BY ".$config['image_order']." ".$config['image_sort']."
LIMIT $offset, $perpage";
OPEN: categories.php
FIND:
WHERE i.image_active = 1 AND i.cat_id = $cat_id AND c.cat_id = i.cat_id
After ADD:
".(($user_info['user_gallerynudity']) ? "" : " AND i.Nudity <> 1")."
END Result will Look Like:
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND i.cat_id = $cat_id AND c.cat_id = i.cat_id ".(($user_info['user_gallerynudity']) ? "" : " AND i.Nudity <> 1")."
ORDER BY ".$config['image_order']." ".$config['image_sort']."
LIMIT $offset, $perpage";
OPEN: index.php
FIND:
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
After ADD:
".(($user_info['user_gallerynudity']) ? "" : " AND i.Nudity <> 1")."
End result will Look Like:
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")".(($user_info['user_gallerynudity']) ? "" : " AND i.Nudity <> 1")."
ORDER BY i.image_date DESC
LIMIT $num_new_images";
Save all files and exit.
Again I wanted to thank you V@no for your help, I couldnt have completed Part 3 without you!
I hope this helps anyone out there that needs to exclude images when a user selects to in the user control panel.
Thank you
-Lady Cherry