We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19534
    • 183 Posts
    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
      • 28215
      • 4,149 Posts
      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
        • 19534
        • 183 Posts
        Thank you once again! (I like this forum!!!)
          Add-On to easily manage your multilingual sites: Babel