Skip to Content Skip to Menu

🕒 Save Time and Effort with CB Editor Assistant: Effortlessly create and refine content in Joomla 3, 4, & 5.
🎁 Limited Offer: Enjoy a 5-day FREE trial and save up to 30% afterward!

[SOLVED] Is there a "proper" way of adding to a user profile from a form?

  • fribse2011
  • fribse2011
  • OFFLINE
  • Posts: 921
  • Thanks: 79
  • Karma: 8
12 years 1 month ago #215687 by fribse2011
I used a 'Custom Server Side Validation' module in CF4, and entered:
Code:
<?php $user =& JFactory::GetUser(); if ($user->email <> $form->data['email1']) { return false; }; ?>
Then added the store action on the true, and a note on the false result.
That seems to work.
Now I just need to convert the birthday data from "text" field to "date" field.

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.

Please Log in or Create an account to join the conversation.

  • fribse2011
  • fribse2011
  • OFFLINE
  • Posts: 921
  • Thanks: 79
  • Karma: 8
12 years 1 month ago #215690 by fribse2011
I tried with this:
Code:
$birthday = strtotime($form->data['foedsel1']); $cbbirthday = date("Y-m-d", $birthday); $user->cb_birthday = $cbbirthday;
But that just gave me a date of 1970-01-01

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.

Please Log in or Create an account to join the conversation.

  • fribse2011
  • fribse2011
  • OFFLINE
  • Posts: 921
  • Thanks: 79
  • Karma: 8
12 years 1 month ago #215734 by fribse2011
Ahaa, got it sort, Chronoforms is terribly smart, and very neat to 'code' in :-)
So I got the datepicker configured to show the date format in the danish notation, which is:
d/m-Y
Then I used this function to convert it, and it is now store correctly in CB:
Code:
$user->cb_birthday = date_format(date_create_from_format('d/m-Y', $form->data['foedsel1']), 'Y-m-d');

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum