We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36764 ☆ A M B ☆
    • 45 Posts
    Evengard aka Eiventeleiron Reply #1, 14 years ago
    Hello everyone!
    I have several questions about MODX system event OnBeforeWebLogin and it's parameters - mainly to the devs of MODX.
    According to documentation (http://rtfm.modx.com/display/revolution20/OnBeforeWebLogin) it is said, that inside the $attributes array we have, quoting:
    An array of:
    rememberme - Boolean set if user wants password to be remembered.
    lifetime - The session cookie lifetime for this login.
    loginContext - The context key this login is occurring in.
    But, when I am watching the source code of /core/model/modx/processors/security/login.php (https://github.com/modxcms/revolution/blob/develop/core/model/modx/processors/security/login.php , checked from 2.0 to 2.2, the cited code doesn't differ much), I see the following:
    $onBeforeLoginParams = array(
        'username' => $username,
        'password' => $givenPassword,
        'attributes' => array(
            'rememberme' => & $rememberme,
            'lifetime' => & $lifetime,
            'loginContext' => & $loginContext,
            'addContexts' => & $addContexts,
        )
    );
    
    $rt = false;  /* $rt will be an array if the event fires */
    if ($mgrEvents) {
        $rt = $modx->invokeEvent("OnBeforeManagerLogin", $onBeforeLoginParams);
    } else {
        $rt = $modx->invokeEvent("OnBeforeWebLogin", $onBeforeLoginParams);
    }

    From here I have several questions:
    1. Is it safe to use these additional parameters? (I am talking about "addContexts" one)
    2. Why there is nowhere said that these parameters are passed by reference, which means that we can modify them?
    3. Is this behaviour subject to change, or this is a definitive behaviour of this plugin event (and other similar, like OnWebLogin and tons of other)? Can I use it safely without worrying that it is going to change in future releases of MODX?

    This question has been answered by opengeek. See the first response.

    [ed. note: eiventeleiron last edited this post 14 years ago.]
      • 3749
      • 24,544 Posts
      I can't give you a definitive answer, but I doubt if it's likely to change any time soon.


      ------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using.
      MODX info for everyone: http://bobsguides.com/modx.html
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 36764 ☆ A M B ☆
        • 45 Posts
        Evengard aka Eiventeleiron Reply #3, 14 years ago
        Yeah, this is more of a questions to opengeek or splittingred... Just need really to know if this is undocumented just because noone had the time to do it or it is intended not to be documented cause this is going to be changed
          • 36764 ☆ A M B ☆
          • 45 Posts
          Evengard aka Eiventeleiron Reply #4, 14 years ago
          If anyone have a possibility to contact devs, can you please direct them to this topic? Because I think only they can definitely answer here.
            • 36764 ☆ A M B ☆
            • 45 Posts
            Evengard aka Eiventeleiron Reply #5, 14 years ago
            Noone can definitely answer that question?
              • 28215
              • 4,149 Posts
              splittingred Reply #6, 14 years ago
              We don't have plans to change it in any non-breaking versions.
                shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
              • discuss.answer
                • 22303 MODX Staff
                • 10,725 Posts
                MODX is in the process of adopting semantic versioning moving forward. This means that new major versions (e.g. 2.x to 3.x) will be the ONLY releases with planned backwards compatibility breaks. New minor versions (e.g. 2.2 to 2.3) will be the ONLY releases with planned feature additions. And new patch versions (e.g. 2.2.4 to 2.2.5) will ONLY contain backwards compatible bug fixes.

                In other words, you can trust those event properties will not change until 3.x. If anything does change with regard to this event before 3.x, it will be the addition of new properties, but not the removal of existing.

                Any yes, the documentation needs to be updated.
                  • 36764 ☆ A M B ☆
                  • 45 Posts
                  Evengard aka Eiventeleiron Reply #8, 14 years ago
                  Thank you a lot for your answer!