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
    That depends on if friendly URLs are being used or not. If they are, you’d need the ?, but if they aren’t the ? is already being used (index.php?id=...) and it needs to be a &.

    Any snippet that will add to the query string needs to check for $modx->config[’friendly_urls’] and specify a ? if it’s 1 and & if it’s 0.
      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
      • 19726
      • 239 Posts
      Quote from: sottwell at Apr 07, 2006, 08:46 AM

      That depends on if friendly URLs are being used or not. If they are, you’d need the ?, but if they aren’t the ? is already being used (index.php?id=...) and it needs to be a &.

      Any snippet that will add to the query string needs to check for $modx->config[’friendly_urls’] and specify a ? if it’s 1 and & if it’s 0.
      I think it would be better to use the makeURL API function which handles friendly urls automatically. To generate that link with the makeUrl API it would look something like this:
      $modx->makeUrl($loginPageId,'','webloginmode=lo');
        • 8471
        • 333 Posts
        Quote from: sottwell at Apr 07, 2006, 08:46 AM

        That depends on if friendly URLs are being used or not. If they are, you’d need the ?, but if they aren’t the ? is already being used (index.php?id=...) and it needs to be a &.

        Any snippet that will add to the query string needs to check for $modx->config[’friendly_urls’] and specify a ? if it’s 1 and & if it’s 0.
        OK, sorry for my incompetence wink
          Sorry for my bad English grin
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          No need to beat yourself up wink
            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
            • 4273
            • 356 Posts
            Quote from: sottwell at Apr 01, 2006, 03:40 AM

            Sorry, I had forgotten that I had added that little feature to it.
            $test = $modx->getLoginUserName(); 
            if(isset($guest)) { // add a feature to allow setting a guest username
            $test = (!$test) ? $guest : $test;
            }
            


            added this feature to where the snippet or the head ?
              SMF Bookmark Mod - check it out
              http://mods.simplemachines.org/index.php?mod=350
              • 13736
              • 345 Posts
              So is the downloadable code at the top the most current version ... with the forgotten feature already added? I don’t see a version number up there to compare anything to.

                • 13736
                • 345 Posts
                Based on this thread, I think I’ve figured out that the personalize snippet code should look like this...

                #::::::::::::::::::::::::::::::::::::::::
                # Snippet Name: Personalize 
                # Short Desc: basic personalization for logged in users
                # Version: 1.0
                # Created By: Ryan Thrash ([email protected])
                #
                # Date: December 1, 2005
                #
                # Changelog: 
                # Dec 1, 05 -- initial release
                #
                #::::::::::::::::::::::::::::::::::::::::
                # Description: 	
                #	Checks to see if users belong to a certain group and 
                #	displays the specified chunk if they do. Performs several
                #	sanity checks and allows to be used multiple times on a page.
                #	Only meant to be used once per page.
                #
                # Params:
                #	&message [string] (optional)
                #		simple message to prepend in front of the username
                #
                #	&wrapper [string] (optional) 
                #		optional element to wrap the message in
                #
                #	&class [string] (optional) 
                #		optional name of the class for the wrapper element
                #
                #	&ph [boolean] ( optional ) 
                #		if set, outputs to the ph name passed in, instead 
                #		of directly returning the output
                #
                # Example Usage:
                #
                #	[[Personalize? &message=`Welcome back, ` &wrapper=`h3` &class=`welcome`]]
                #
                #	For a logged in user John, would return: 
                #	<h3 class="welcome">Welcome back, John</h3>
                #
                #::::::::::::::::::::::::::::::::::::::::
                
                # is there a class defined?
                $class = (isset($class))? ' class="'.$class.'"' : '';
                
                # build the wrappers as needed
                if (isset($wrapper)) {
                	$w1 = '<'.$wrapper.$class.'>' ;
                	$w2 = '</'.$wrapper.'>';
                } else {
                	$w1 = '';
                	$w2 = '';
                }
                
                # add in the message
                $message = (isset($message))? $message : '';
                
                # do the work
                $o = '';
                $test = $modx->getLoginUserName();
                if(isset($guest)) {
                  // add a feature to allow setting a guest username
                  $test = (!$test) ? $guest : $test;
                }
                $o = ($test)? "$w1$message$test$w2" : '';
                
                if (isset($ph)) {
                	$modx->setPlaceholder($ph,$o);
                } else {
                	return $o;
                }
                
                


                But if we wanted to update the Friendly URL ideas talked about where would the

                $modx->makeUrl($loginPageId,'','webloginmode=lo'); 


                suggestion fit into the WebLoginBox snippet?

                  • 4273
                  • 356 Posts
                  Is there a reason why you came up with webloginbox when the weblogin snippet already has the welcome user login/logout
                    SMF Bookmark Mod - check it out
                    http://mods.simplemachines.org/index.php?mod=350