On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hi

    In my registration form I have to fields "first name" and "last name". I don’t want the user to enter his fullname again. So I tried to use a preHook snippet which will generate the fullname property out of these two fields:

    $firstname = $scriptProperties['fields']['firstname'];
    $lastname = $scriptProperties['fields']['lastname'];
    $scriptProperties['fields']['fullname'] = $firstname.' '.$lastname;
    


    Unfortunately the user’s fullname isn’t set to the generated value.

    By the way how can I avoid saving the first and last name in extended fields? Is there away to provide a kind of "ignore fields list"?

    Regards
      Add-On to easily manage your multilingual sites: Babel
    • Quote from: mikrobi at Sep 24, 2010, 12:35 PM

      In my registration form I have to fields "first name" and "last name". I don’t want the user to enter his fullname again. So I tried to use a preHook snippet which will generate the fullname property out of these two fields:
      $firstname = $scriptProperties['fields']['firstname'];
      $lastname = $scriptProperties['fields']['lastname'];
      $scriptProperties['fields']['fullname'] = $firstname.' '.$lastname;
      

      Unfortunately the user’s fullname isn’t set to the generated value.

      First get the latest Login package (1.2.0-pl), then you can use this:

      $fullname = $hook->getValue('firstname').' '.$hook->getValue('lastname');
      $hook->setValue('fullname',$fullname);
      


      By the way how can I avoid saving the first and last name in extended fields? Is there away to provide a kind of "ignore fields list"?
      In the latest Login package, there is an ’excludeExtended’ property you can add to the Register snippet call that takes a comma-separated list of field names to ignore.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
      • Thank you once again! (I like this forum!!!)
          Add-On to easily manage your multilingual sites: Babel