Hello
I need some users to send some photos using cred form and display them in their profile
Those photos are "semi-nude" photos requiered to the personal trainer to provide a good workout program.
But
1 ) I don't want authors/editors to be able to see them in the media gallery of wordpress
2 ) I don't want the image to be accessible to guests and from a public url ( maybe access or some membership plugins can help ? )
I've already made their profile visible only to them and to the admins using access
But I need help to prevent the photos from going to the media library and be findable on google or a public url.
Hello Luca,
I'm Mohammed, the Toolset support team leader.I will do my best to help you.
You requirements can be achieved using Toolset access.let me describe how you can implement you requirements:
--Go to Toolset > Access control
--In the post types tab, you will find a section for the Media
--Click on Media
--Enable the (Managed by Access) option
--Enable/Disable the capabilities according to your needs
For example, if you disabled the (preview any) for the guest role, then the guest users will be able to access the images.
If you disabled;ed the edit any for the author role, then the author will not be able to edit them in the backend.
If you need to add some custom logic to your website, then you will need custom code to implement this logic.
Even we don't support custom code, but I prepared a snippet that will help you. this is just in case.
add_action('pre_get_posts','users_own_attachments');
function users_own_attachments( $wp_query_obj )
{
global $current_user, $pagenow;
if( !is_a( $current_user, 'WP_User') )
{
return;
}
if( 'upload.php' != $pagenow )
{
return;
}
$role = 'administrator'; // return string 'contributor_facebook'
$users = new WP_User_Query( array( 'role' => $role ) );
$results = $users->get_results();
$user_ids = array();
foreach( $results as $result ) {
$user_ids[] = (int) $result->ID;
}
$user_ids = ! empty( $user_ids ) ? $user_ids : PHP_INT_MAX;
$wp_query_obj->set( 'author__in', $user_ids );
return;
}
you can use this snippet to allow only administrators to preview/edit the images in the backend. you can modify this to do whatever you need.
Please let me know if this helps.
Thanks.
Hello
thanks for the reply and for the snippet
With access and the snippet I was able to remove the media link from the menu and prevent authors/editorsetc. to access the upload.php page
but authors are still able to see all the images when they create a post and try to add a media.
i found this plugin that prevents the access to media files ( aside from their own ) while creating a post
lien caché
- -
This way I covered 2/3 of the problems.
There is still one.
Google, and direct linking.
Guests and google can see an image such as
lien caché
How do I prevent this image from being seen from guests, or appear in google ( disallow in htaccess? but it is inside a normal wordpress folder so I can't )
I want an image, sent from cred user from, to be seen only to the uploader ( that has a contributor role ) and the admins.
Hi Luca,
I'm happy to see your issue resolved.
As peer the Toolset Support request guidelines: https://toolset.com/toolset-support-policy/ , it's mentioned that "Only one issue will be solved in a given ticket (thread)."
So, I'm allowed only to handle one issue per a ticket.
I'm kindly asking you to open a new ticket describing your new requirements and of course, we will do our best to help you.
Thanks.