<![CDATA[ {Hooks} Login custom postHook not working - My Forums]]> https://forums.modx.com/thread/?thread=87178 <![CDATA[{Hooks} Login custom postHook not working]]> https://forums.modx.com/thread/87178/hooks-login-custom-posthook-not-working#dis-post-480274
Code:
<?php
$modx->regClientStartupHTMLBlock('
<script type="text/javascript">
$(function(){
   var $windowWidth=$( document ).width();
                   $("#extruderBottom").buildMbExtruder({
                        position:"bottom",
                        width:$windowWidth,
                        extruderOpacity:.9,
                        onExtOpen:function(){},
                        onExtContentLoad:function(){},
                        onExtClose:function(){}
                    }); 
                    $("#extruderBottom .text").height(235);
  });

</script>');


Now when i set the post hook in the Login call then i logged in on the front end the snippet worked great. Or so I thought.. The bottom panel showed up but my login text (to say welcome basically when the user was logged in) did not appear. So I take it my code actually stopped the login process temporarily. I refreshed the page and suddenly i was logged in but the bottom panel was gone. So my question is what did I do wrong? Is there a better way to do this? and way the weird login stuff? Any help will be appreciated.


Thanks,
Modxnooby
p.s. I have already checked my javascript code in regards to the slide out panels so that is not the problem.]]>
modxnooby Oct 15, 2013, 06:13 AM https://forums.modx.com/thread/87178/hooks-login-custom-posthook-not-working#dis-post-480274
<![CDATA[Re: {Hooks} Login custom postHook not working]]> https://forums.modx.com/thread/87178/hooks-login-custom-posthook-not-working#dis-post-480371
Thanks so much,
ModxNooby]]>
modxnooby Oct 16, 2013, 04:31 AM https://forums.modx.com/thread/87178/hooks-login-custom-posthook-not-working#dis-post-480371
<![CDATA[Re: {Hooks} Login custom postHook not working]]> https://forums.modx.com/thread/87178/hooks-login-custom-posthook-not-working#dis-post-480370 sottwell Oct 16, 2013, 04:13 AM https://forums.modx.com/thread/87178/hooks-login-custom-posthook-not-working#dis-post-480370 <![CDATA[Re: {Hooks} Login custom postHook not working]]> https://forums.modx.com/thread/87178/hooks-login-custom-posthook-not-working#dis-post-480351
p.s. I wont mark this as answered until I have tried it and made sure it works but i'm sure it will smiley

Thanks,
ModxNooby]]>
modxnooby Oct 15, 2013, 10:05 PM https://forums.modx.com/thread/87178/hooks-login-custom-posthook-not-working#dis-post-480351
<![CDATA[Re: {Hooks} Login custom postHook not working]]> https://forums.modx.com/thread/87178/hooks-login-custom-posthook-not-working#dis-post-480315 http://modx.com/extras/package/personalize för more details.]]> Kristoffer Oct 15, 2013, 02:11 PM https://forums.modx.com/thread/87178/hooks-login-custom-posthook-not-working#dis-post-480315 <![CDATA[Re: {Hooks} Login custom postHook not working (Best Answer)]]> https://forums.modx.com/thread/87178/hooks-login-custom-posthook-not-working#dis-post-480281
<?php
$_SESSION['loginmessage'] = 'true';

Then a snippet (the login message is itself a resource for easier editing by the client since they change it a lot)
<?php
if(isset($_SESSION['loginmessage']) && $_SESSION['loginmessage'] == 'true') {
  $js = '
  <script type="text/javascript">
	  $(function() {
		  $( "#popupMessage" ).dialog({ 
			   position: { my: "right bottom", at: "right bottom", of: window },
			   hide: {effect: "fade", duration: 6000}
		  });
		  setTimeout(function(){ $("#popupMessage").dialog("close"); }, 8000);
	  });
  </script>
  ';
  $modx->regClientScript($js);
  
  $document = $modx->getObject('modResource',array(
	  'id' => 58
  ));
  
  $_SESSION['loginmessage'] = '';
  unset($_SESSION['loginmessage']);
  
  return $document->get('content');
}
return;

This checks for the SESSION loginmessage flag that gets set by the plugin on web login, sets up the javascript and the content, and removes the SESSION loginmessage field. The snippet is in the template, so it works wherever the user is when he logs in.]]>
sottwell Oct 15, 2013, 09:14 AM https://forums.modx.com/thread/87178/hooks-login-custom-posthook-not-working#dis-post-480281