We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23496
    • 20 Posts
    Hello,

    I wrote a hook for the registration process. This hook should write some data in a custom table.
    When I am testing the snippet as stand alone, outside the registration process, it works fine.

    So I wrote a easy snippets that only creates an session variable und write it to the error log.

    $email = $hook->getValue('email') ? $modx->getOption('email', $scriptProperties) : "";
    $code = $hook->getValue('access_code') ? $modx->getOption('accessCode', $scriptProperties) : "";
    
    $_SESSION['registration'] = true;
    $_SESSION['registrationData'] = array('email' => $email, 'code' => $code);
    
    $modx->log(modX::LOG_LEVEL_ERROR,'Test if sendmail is fired: '.$email);


    But this hook is also not fired as posthook. The user is always created.

    Some infos about my system:


    • MODX Version: 2.2.11 traditional
    • PHP Version: 5.4.4 auf Debian 7.1
    • Database(MySQL, SQL Server, etc) Version:5.5.31-0+wheezy1
    • Other Info: Debian 7.1 wheezy in VirtualBox

    Does sombody habe any idea? Here is the call of the registration snippet.

    [[!Register?
    &activation=`0`
    &activationEmailSubject=`Registrierung Theodor Secret Area Account`
    &activationEmailTpl=`emailRegisterTheodorAccount`
    &submitVar=`register` 
    &submittedResourceId=`793`
    &usernameField=`email` 
    &usergroups=`Theodor1` 
    &placeholderPrefix=`reg.`
    &validate=`fullname:required,
    email:required:email,
    password:required:minLength=^8^,
    &postHooks=`accessCodeSetAsUsed`
    ]]
    [[!$formRegisterSimple]]`]]


    Thanks for helping or any ideas.

    Greetings
    Florian
    • I think the problem is your tag syntax -- I think you're missing a backtick wrapping the arguments for the validate parameter, so the effect is likely that the parser never sees the &postHooks parameter which follows it.

      I did write a plugin to help identify bad MODX syntax: http://modx.com/extras/package/syntaxchecker but it's a bit trigger happy for complex tags...
        • 3749
        • 24,544 Posts
        Good catch Everett. smiley

        That last comma should be a back-tick:

        &validate=`fullname:required,
        email:required:email,
        password:required:minLength=^8^`
          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
          • 23496
          • 20 Posts
          Thank you guys!
          Suche things happening after many hours working...
            • 23496
            • 20 Posts
            Thank you guys!
            Suche things happening after many hours working...