We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I’m trying to get my Register snippet working, but submitting the form (even with no data in it) just causes the page to reload and I get a blank white page. I don’t see anything in my MODx logs or in my apache logs...

    Here’s my Snippet call:

    [[!Register?
        &submitVar=`registerbtn`
        &activationResourceId=`31`
        &activationEmailTpl=`lgnActivateEmailTpl`
        &activationEmailSubject=`Thanks for Registering!`
        &submittedResourceId=`20`
        &usergroups=`Members`
    ]]


    I’ve double checked the page IDs involved, I’ve double checked the activation email chunk, and yes, that is the correct usergroup.

    I’m baffled... I’m stopping here as the last stop before I dive into the code. Any thoughts?

    Login 1.5.2 pl
    Revo 2.0.8-pl
      • 3749
      • 24,544 Posts
      lgnActivateEmailTpl ->lgnActivationEmailTpl (unless you’ve duped it and changed the name).
        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
      • Oddly, I have identical chunks by both names on my install:

        <p>[[+username]],</p>
        
        <p>Thanks for registering! To activate your new account, please click on the following link:</p>
        
        <p><a href="[[+confirmUrl]]">[[+confirmUrl]]</a></p>
        
        <p>After activating, you may login with your password and username:</p>
        
        <p>
        Username: <strong>[[+username]]</strong><br />
        Password: <strong>[[+password]]</strong></p>
        
        <p>If you did not request this message, please ignore it.</p>
        
        <p>Thanks,<br />
        <em>Site Administrator</em></p>


        Nothing weird there ... I can’t think of anything else that would cause this thing to totally white-screen like this... no errors anywhere. No email.
          • 3749
          • 24,544 Posts
          I imagine you’ve tried deleting the core/cache files.

          The only think I can think of (and it seems far-fetched) is the security permissions. There might be issues with the snippet performing Manager actions in the front end for an anonymous user, although I’m pretty sure I tested that snippet and had no trouble, though I didn’t specify a user group. You might try taking out the &userGroups property to see if it makes a difference.
            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
          • I took out the user group... still no dice. I’m gonna start filtering through the code line by line to see if I can isolate it.... oiy...
              • 3749
              • 24,544 Posts
              Does it fail when you’re previewing the page and logged in as admin Super User? That would rule out permission issues.
                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
              • Yes, it fails when I am logged into the manager w Super User privs.. the sign-up page displays, but as soon as I submit the form, it blanks out. I’m starting to go through the code. Damn my limited understanding of connectors!
                • I’m realizing sheepishly that I must not have PHP error logging setup correctly... there’s no way this is completely blanking like this, but I can’t figure out why not... or maybe this is an issue with php 5.3.6? No... other errors ARE logging... so confusing.

                  Ok, here’s the line where it kacks in ./core/components/formit/model/formit/fivalidator.class.php file.
                  /* do new way of validation, which is more secure */
                  if (!empty($fieldValidators[$k])) {
                      foreach ($fieldValidators[$k] as $validator) {
                          $this->validate($k,$v,$validator);
                      }
                  }


                  Still figuring out exactly why, but it never makes it past that point... dig dig dig
                  • Ok, I’ve narrowed it down to the email field’s validator... something about it is dying inside the validate() function.
                    • Here’s the problem line from ./core/components/formit/model/formit/fivalidator.class.php

                      $condition = $this->config['use_multibyte'] ? @mb_ereg($pattern,$value) : @ereg($pattern, $value);


                      By printing out all defined functions, I can see that the mg_ereg function is not defined!

                      print_r(get_defined_functions());


                      This has got to be some glitch with my PHP setup. As the system setting says:

                      Set to true if you want to use the mbstring extension for multibyte characters in your MODx installation. Only set to true if you have the mbstring PHP extension installed.

                      But I DO have that compiled into PHP:
                      print_r(get_loaded_extensions());


                      Lists the following:
                      Array
                      (
                          [0] => Core
                          [1] => date
                          [2] => ereg
                          [3] => libxml
                          [4] => openssl
                          [5] => pcre
                          [6] => sqlite3
                          [7] => zlib
                          [8] => bcmath
                          [9] => calendar
                          [10] => ctype
                          [11] => curl
                          [12] => dom
                          [13] => hash
                          [14] => filter
                          [15] => ftp
                          [16] => gd
                          [17] => gettext
                          [18] => SPL
                          [19] => session
                          [20] => json
                          [21] => mbstring
                          [22] => mcrypt
                          [23] => mysql
                          [24] => mysqli
                          [25] => standard
                          [26] => Phar
                          [27] => posix
                          [28] => Reflection
                          [29] => imap
                          [30] => SimpleXML
                          [31] => sockets
                          [32] => exif
                          [33] => tokenizer
                          [34] => xml
                          [35] => xmlreader
                          [36] => xmlwriter
                          [37] => zip
                          [38] => cgi-fcgi
                          [39] => PDO
                          [40] => SQLite
                          [41] => pdo_mysql
                          [42] => pdo_sqlite
                          [43] => ionCube Loader
                          [44] => eAccelerator
                      )


                      What gives? Is that a bad message? Which package provides the mg_ereg function?

                      The Login snippets should check for that function!