Hi Mikono,
Depending on how you are inserting your gallery or galleries in your post(s), what I would do is have two different versions of your galleries: one for admins and registered users, and one for non-registered users and visitors. Then, you can use a php if statement to check whether the user is logged in: if the user is logged in (ie., is a registered user), the full version is displayed; if he is not logged in, the limited version is displayed.
To do this, first you need to download and install these three plugins:
1. Exec-php,
2. Role Manager, and
3. Multiple Galleries.
Exec-php allows you to run php code in your posts, pages, and widgets. You need to follow the plugin’s instructions carefully so as to not let just any user do this.
Role Manager allows you to manage WP user capabilities and gives you more control over user permissions. It is required by Exec-php to control which user levels are allowed to write and execute PHP code.
Multiple Galleries inserts a checkbox next to each image in the Gallery section, making the creation of multiple galleries way easier.
Next, edit/create a post or page in which you wish to display multiple galleries, and paste this code into that post or page, where you want the gallery to appear:
<?php if ( is_user_logged_in () ) { ?>
[gallery]
<?php } else { ?>
[insert_visitor_gallery_here]
<?php } ?>
The short code [gallery]
will display the entire gallery, but only if the user is logged in. If the user is not logged in, the else
segment of the condition will be executed. What you need to do to make it work, is replace [insert_visitor_gallery_here]
with the short code for the limited version of the gallery. To do this, simply highlight that text, click on the ‘Add object’ icon, go to Gallery
, check only the images that you want visitors to see, and click on Insert Gallery
button.
And presto, you are done! You can repeat the process for each post in which you wish to display multiple galleries.
I hope this works for you.
Good luck!