WordPress.org

Ready to get started?Download WordPress

Forums

Gallery
[resolved] How to password protect galleries (2 posts)

  1. mzjme
    Member
    Posted 1 year ago #

    I have tried to password protect individual galleries, even though it requires a password the photos are still viewable..Any suggestions, would be greatly appreciated

    http://wordpress.org/extend/plugins/gallery-plugin/

  2. bestwebsoft
    Member
    Plugin Author

    Posted 10 months ago #

    Hello mzjme,

    You should change the gallery template. Please open the folder with theme, find there the files gallery-single-template.php and gallery-template.php
    for gallery-template.php template, find the lines 75-76 there

    <div><?php echo the_excerpt_max_charlength(100); ?></div>
    <a href="<?php echo $permalink; echo basename( get_permalink(
    $post->ID ) ); ?>"><?php echo $gllr_options["read_more_link_text"];
    ?>

    You should arrange them in the construction of password verification, so that it will be like this:

    <?php if ( post_password_required() ) : ?>
    <div><?php echo the_excerpt_max_charlength(100); ?></div>
    <a href="<?php echo $permalink; echo basename( get_permalink(
    $post->ID ) ); ?>"><?php echo $gllr_options["read_more_link_text"];
    ?>
    <?php endif; ?>

    For the template gallery-single-template.php
    Find the lines 16-72, arrange them in the construction of password verification before the line 16:
    <div class="gallery_box_single">
    Add the line:
    <?php if ( post_password_required() ) : ?>
    So that it will be like this:

    <?php if ( post_password_required() ) : ?>
    <div class="gallery_box_single">

    And after the line 72
    </div>
    Add the line:
    <?php endif; ?>
    So that it will be like this:

    </div>
    <?php endif; ?>
    <div class="clear"></div>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    Kind regards,
    support Team

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic