• 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.

best practice registration form / juser / php / onBeforeProcess

Hello,

I am facing a small problem concerning my registration form.

Currently I am using "JUSER" and "PHP onBeforeProcess"...just an example:

Code:
// insert
$db = JFactory::getDbo();
$query = $db->getQuery(true);

$columns = array( 'edit', 'edit_author', 'edit_datetime', 'edit_ip', 'publish', 'publish_author', 'publish_datetime', 'publish_ip');
$values = array();
// proper escaping/quotes should be done here, and probably in a loop, but cluttered the answer, so omitted it
$values[] = "' 1,'".$uk_id."', '".$datetime."', '{xfabrik_user___edit_ip}', 1,'".$uk_id."', '".$datetime."', '{xfabrik_user___publish_ip}'";

$query->insert($db->quoteName('xfabrik_user'));
$query->columns($columns);
$query->values($values);
$db->setQuery($query);
$db->query();

// exit form
return false;

this will work fine, but fields like {xfabrik_user___publish_ip} or {xfabrik_user___password} will only work correct, when I don't use "return false;". When I delete "return false;" in PHP, password is being encrypted MD5 and IP is stored, but...some fields like "databasejoin" return NULL.

I am looking for best practice to transfer input of fields to database. I hope my question is not confusing. Right now I believe I shouldn't use "return false;" in PHP, but how can I trigger input of fields without loosing those values?

Thank you ;)
 
Should I just update the form in PHP before it is being transfered? For example...Like:

$formModel->updateFormData('sc_user___name', '{sc_user___first_name} {sc_user___last_name}', true);
 
I'm not sure what you are trying to do.
Why are you using a PHP plugin?
Is this on a user registration form? On a edit profile form? Some other form?
 
Simply a registration form with Joomla...yes...I need some custom fields like databasejoin, IP, YesNo, fileupload...I am using JUSER Plugin to sync corresponding fields with Joomla user table. I might also sync with coorejoomla forum (user). I am using PHP onBeforeProcess in order to manipulate some fields. For example:

first_name (visible) + last_name (visible) = name (hidden)
 
As I mentioned, a databasejoin field returns NULL in database, when I go with no PHP onBeforeProcess...it's an integer PK that should be in database on this specific field...currently trying to solve this
 
stupid me...I wasn't paying attention...I sbmitted the form without choosing some value from the drop down for databasejoin. I need more sleep :) Sorry...solved
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top