• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Auto generated passwords when creating a new user with Fabrik 3

Matthews

New Member
When using Fabrik to create a new user, is it possible to have the system generate a password for the user as when creating a user via the backend ie. if the password field is left blank, it will automatically create one.

The form is working fine, but I need this functionality to make my system work as I want. There are currently no validations on the password element but still says 'You must enter a password'

Any help is greatly appreciated :)
 
I'm doing this with a calc element and the user form plugin.
PHP:
$user = &JFactory::getUser();
if ($user->id == 0) {
   $length = 7;
  $key = "";
  // define possible characters
  $possible = "0123456789bcdfghjkmnpqrstvwxyzBCDFGHJKLMNPQRTVWXYZ";
  $i = 0;
  while ($i < $length) {
    $char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
      $key .= $char;
      $i++;
  }
  return $key; 
  
}

elseif ($user->id > 0)
{return '***********';}
 
I'd do it with a form submission plugin running on "new" rather than a calc, but that's personal preference.

And just to answer something in the OP ...

There are currently no validations on the password element but still says 'You must enter a password'

That's a J! thing. The JUser API doesn't allow empty passwords for new users, so we catch empty passwords and automatically fail the validation.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top