0

I have a script :

<cfscript>
     gf = createObject('component','com.general');
     gf.checkIpBlocked();
</cfscript>

that I want to fire onSessionStart.

I added an onSessionStart to /siteID/includes/themes/myTheme/eventHandler.cfc. But the session start NEVER fires. I know there is something managing sessions because of I open the admin, login then close the browser, re-open it I am forced to login again.

If I set a session variable close the browser and and the session.testVar never goes away and seems to hold the initial value for a very long time.

I am not trying to manage mura users or anything I am just trying to set a session variable the first time in a "session". In a typical application.cfc this is easy.

Any insight is appreciated.

Lance
  • 3,193
  • 2
  • 32
  • 49

2 Answers2

2

Unfortunately, that's a bug. However, one thing to keep in mind is that onSiteSessionStart is unreliable since it only fires when a siteID is defined within the request. For example, if you were to go to the admin and be asked to login your session will have started and there would have been no siteID.

For now I would try using onSiteRequestStart to param the variable instead.

function onSiteRequestStart($){
    param name="session.ipChecked" default=false;
    if(!session.ipChecked){
        var gf = createObject('component','com.general');
        gf.checkIpBlocked();
        session.ipChecked=true;
    }
}

In regard to our documentation we have three Mura 6 books available both printed and digital downloads from Lulu

And are also working to create a systematic way to post the contents of those books on our support site which we are hoping to complete by MuraCon on 9/30. So that the all of our documentation will stay update and in sync.

  • I can get this to fire using onSiteRequestStart the problem is that when I close the browser and re-open it I still have the same session that was already started. Even if I add `onSiteSessionEnd ... session.ipChecked=false;` the ipChecked will NOT fire again. It does not behave in the same fasion as the /admin does. Do you have another suggestion? – Lance Aug 12 '13 at 19:47
1

The Mura docs state that the application events are actually onGlobalSessionStart and/or onSiteSessionStart.

Application Events

onApplicationLoad       onSiteSessionStart
onGlobalSessionStart    onSiteSessionEnd
onSiteMissingTemplate   onSiteError
onGlobalError           onBeforeAutoUpdate
onAfterAutoUpdate       onGlobalThreatDetect

Note that Events that begin with onGlobal are defined on a per-Mura instance basis.

Mura docs.

Miguel-F
  • 13,450
  • 6
  • 38
  • 63
  • Yes that is true but those seem to be application variables. We tried to use `onSiteSessionStart` but that seems to only fire once when mura starts (or based on the application timeout). They seem more "application" variable than session variables. – Lance Aug 08 '13 at 19:51
  • I [found someone else having issues](http://www.getmura.com/forum/messages.cfm?threadid=4F061400-BBCE-48B2-B2BCE2DD2D4E526E) (from a couple of years ago) – Miguel-F Aug 08 '13 at 20:33
  • Thanks @Miguel-F I found that when searching too. The problem is that, as typical for the Mura forums, someone asked a question of the mura folks who occasionally will ask a an additional question or too but rarely have actual solutions. In fact I post the exact question here on SO that I post in the mura forum because I have hope that someone here might have run into something similar. Thanks again Miguel for trying to help!! – Lance Aug 08 '13 at 20:52
  • Yes that's what it looked like when I was searching; lots of questions not so many answers. That's unfortunate. I haven't used Mura but have been considering it. Anyway it looked like the onSiteSessionStart would be the option. Wonder if it is a big? – Miguel-F Aug 09 '13 at 00:18
  • 1
    Might be. We have been using it and even paid for private training. The answer to most of the question during train were "there are a hundred way to skin a cat" But then there was never a real example to skin the cat even one one. Mura is VERY easy to use from a contributor and front end stand point. From the back end it isn't too bad either but the documentation is severely lack and not up to date (current for v5.2) and the support (even when we looked into paid support) is weak at best. – Lance Aug 09 '13 at 04:54
  • Wow, sorry to hear that. My last thoughts on your issue here, again, I'm not too familiar with Mura itself. Did you test the `onGlobalSessionStart` event to see when it fires? Maybe that is the one to use. Could you just modify the Application.cfc file directly with your changes? Or are you not supposed to do that for future updates of Mura, etc. – Miguel-F Aug 09 '13 at 11:58