We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    Not really...this is all that is.
    <?php
    $pagelocker = $modx->getService('pagelocker','PageLocker',$modx->getOption('pagelocker.core_path',null,$modx->getOption('core_path').'components/pagelocker/').'model/pagelocker/',$scriptProperties);
    if (!($pagelocker instanceof PageLocker)) return '';
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 3749
      • 24,544 Posts
      I only got as far as the filename: "snippet.pagelocker.php" and the fact that there's no plugin file in the elements directory.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        I would guess it was an attempt at a snippet that somehow manipulates a pre-installed PageLocker. It would be interesting to see what the idea was, but apparently it never got beyond those first lines.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 8822
          • 203 Posts
          Thanks for the comments and suggestions. Any ideas on what i can try with the session table/values in a bid to stop it remembering the password from a previous session (its not so much remembering the password for a given user that is the problem, more the fact that once a password has been entered correctly it appears to make the page available to everyone else).

          Thanks for your time, really need to make some headway with this and am hitting my head against a brick wall smiley
            • 8822
            • 203 Posts
            Anyone able to offer any other suggestions on this one, really need to get it sorted?
              • 3749
              • 24,544 Posts
              This is a wild guess, but try changing this line in the plugin:

              unset($_SESSION['password']);  // make sure password is not still set



              to this:

              unset($_SESSION['password']);  // make sure password is not still set
              unset($_SESSION['loggedin']);    // make sure user is not logged in
              

                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 8822
                • 203 Posts
                Hi BobRay,

                That didn't make any difference unfortunately - thanks for the suggestion though, any more ideas?
                  • 3749
                  • 24,544 Posts


                  I can't help but think that the first part of this code is where things are going wrong (I think $resourcePW is coming up empty when it shouldn't):

                  /* Do nothing if page is not password-protected, or the form page is not set in the properties */
                  if ((empty($resourcePW)) || (empty($formResourceID))) { 
                      return;
                  }


                  Here's something else to try:

                  Change this:

                  $tvPassword = $modx->getOption('tvPassword',$scriptProperties,'pagePassword');
                  $tvPasswordGroup = $modx->getOption('tvPasswordGroup',$scriptProperties,'pagePasswordGroup');
                  

                  to this:

                  $tvPassword = $modx->getOption('tvPassword',$scriptProperties,'pagePassword', true);
                  $tvPasswordGroup = $modx->getOption('tvPasswordGroup',$scriptProperties,'pagePasswordGroup', true);
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 8822
                    • 203 Posts
                    Hi BobRay, thanks for that, unfortunately no luck either. Infact it now appears not to be working at all, even if i change the password and clear the cache - something is definitely not working as it should. Are there any logs that could provide more insight? The main log has a number of warnings:

                    [2014-10-09 11:20:07] (ERROR @ /usr/local/home/httpd/vhtdocs/domainname.co.uk/core/cache/includes/elements/modplugin/4.include.cache.php : 106) PHP warning: Cannot modify header information - headers already sent by (output started at /usr/local/home/httpd/vhtdocs/domainname.co.uk/core/model/modx/modresponse.class.php:189)


                    could that affect it?
                      • 3749
                      • 24,544 Posts
                      It could. What plugin has the ID 4?

                      Try disabling it and see if that helps (unless it's PageLocker). Right-click on it in the tree and select "Deactivate Plugin". You might have to delete all files in the core/cache directory before disabling it takes effect.

                      If it's PageLocker, you probably made a typo (or I did) with the changes I suggested and that's throwing a PHP error.
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting