We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33453
    • 141 Posts
    I have set up a call to WebLogin as part of a Sidebar TV (as described elsewhere on the forum) like this:
    Login form==[!WebLogin? &tpl=`WebLoginSideBar` &loginhomeid=`84`!]
    

    I can log in and out correctly, but the page does not redirect to loginhomeid.

    Resource 84 is published but with only logged in user access permissions.

    I am not currently using friendly URLs.

    Any ideas?

    Also I have noticed that, if the TV is changed, it is automatically deselected for documents which call it and you have to edit the document and reselect it. Is this correct behaviour? It would be a pain if there were many documents involved.

    Thanks.
    • I can’t reproduce the problem with the WebLogin snippet -- I wonder if something in the sidebar TV is part of the issue? Not familiar enough with that to know.

      As for the correct behavior for the TV, if you change the default value of a TV, it should be reflected on every resource with a template that has access to the TV unless a specific resource has overridden the default value. The custom value should be retained until the page specific customization is emptied, at which point it should revert back to the default value.
        • 33453
        • 141 Posts
        I found the problem.

        The file weblogin.processor.inc.php has been changed from the initial 0.9.1 release >:(. The current version works fine.
        • zenmaster, I can only find one edit to the file after the release, and it was dealing with a space in the INSERT INTO modx_active_users statement that rendered the snippet useless on certain DB/PHP platforms. Is this what made the difference for you? If not, do you know what code change made the difference? If so, can you post some environment information, so I can log that with the bug report.
            • 33453
            • 141 Posts
            Quote from: OpenGeek at Jan 15, 2006, 06:50 PM

            If not, do you know what code change made the difference?
            Jason,

            I don’t think it’s a bug, I just seem to have got an old copy of the file. The first install was done about December 30th and the second around Jan 15th. However, in case it’s of any use to anyone else the difference between the files was as follows.

            Old file:
            	// redirect
            	if($_REQUEST["refurl"]) {
            		// last accessed page
            		$url = $_REQUEST["refurl"];
            		$modx->sendRedirect($url,0,REDIRECT_REFRESH);
            	}
            	else {
            		// login home page
            		$url = $modx->makeURL($id);
            		$modx->sendRedirect($url);
            	}
            

            New file:
            	// redirect
            	if(isset($_REQUEST['refurl']) && !empty($_REQUEST['refurl'])) {
            		// last accessed page
            		$targetPageId= html_entity_decode($_REQUEST['refurl']);
            		if (strpos($targetPageId, 'q=') !== false) {
            			$urlPos = strpos($targetPageId, 'q=')+2;
            			$alias = substr($targetPageId, $urlPos);
            			$aliasLength = (strpos($alias, '&'))? strpos($alias, '&'): strlen($alias);
            			$alias = substr($alias, 0, $aliasLength);
            			$url = $modx->config['base_url'] . $alias;
            		} elseif ($targetPageId= array_search($targetPageId, $modx->documentListing)) {
            			$url = $modx->makeUrl($targetPageId);
            		} else {
            			$url = $_REQUEST['refurl'];
            		}
            		$modx->sendRedirect($url,0,'REDIRECT_REFRESH');
            	}
            	else {
            		// login home page
            		$url = $modx->makeUrl($id);
            		$modx->sendRedirect($url);
            	}
            

            There are also a number of instances where, for example
            	if ($modx->config['login_home']) ...
            

            has become
            	if (isset($modx->config['login_home'])) ...
            


            Thanks.
            • Quote from: zenmaster at Jan 21, 2006, 06:29 PM
              Jason,

              I don’t think it’s a bug, I just seem to have got an old copy of the file. The first install was done about December 30th and the second around Jan 15th. However, in case it’s of any use to anyone else the difference between the files was as follows.

              Right, the major change here was a correction to the behavior when directing unauthenticated users to the login page from a secured resource and then trying to send them back to the original resource (being stored as the refurl $_GET param) when they successfully login. The remaining changes got rid of PHP warnings that were being ignored when certain config properties were not set, to increase the performance of the script.