We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8584
    • 14 Posts
    Im using an Unauth snippet to handle people not logged in

    <?php
    /* Unauthorized snippet */
    if (! $modx->user->hasSessionContext($modx->context->get('key'))) {
        $modx->sendUnauthorizedPage();
    } else {
        return '';
    }
    



    So only Login ,Register,Register Success, and Lost Passwd are allowed if not logged in

    When you complete a registration form is redirects to id=15 with query string params
    index.php?id=15?username=ehask17&[email protected]

    Well for some reason the query string causes the page to redirect to the login page?? if I remove the query string params it shows fine

    Eric
      • 8584
      • 14 Posts
      Nevermind I figured it out it is a bug in the Register Processor if you dont use fancy urls it will result in a query string with 2 - ?’s this is only if you are redirecting to another resource


      I made a quick edit to the register processor php since i am under the gun on this project. I will revisit this later to see if I can improve
      /* if provided a redirect id, will redirect to that resource, with the
       * GET params `username` and `email` for you to use */
      $submittedResourceId = $modx->getOption('submittedResourceId',$scriptProperties,'');
      if (!empty($submittedResourceId)) {
          $seperator = '?';
          $urlpart = $modx->makeUrl($submittedResourceId);
          $pos = strpos($urlpart,'?');
          if($pos){
             $seperator = '&';
          }
          $url = $urlpart.$seperator.'username='.$user->get('username').'&email='.$profile->get('email');
          $modx->sendRedirect($url);
      } else {
      


      thx,
      Eric
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        There is a setting to indicate if friendly URLs are being used or not; anything like this should check that setting and use ? or & depending on the setting.
        $qstart = (check-here-for-setting) ? '?' : '&';
          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
          • 8584
          • 14 Posts
          Thanks Susan,

          I figured as much but I am just moving along to finish this site by tomm. Its Splittingred’s addon so I will notify him

          Eric