Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] How to - custom script on profile save for custom db field

9 years 1 month ago - 9 years 1 month ago #270945 by NicolasGuy
Hello,

May be it's a stupid question, but I can't find any explaination on how I can do that.

I need to populate 3 fields using google API from adress fields created with CB.

Theses field have to be populated with custom rules I'm creating.

Question : where, inside CB, I can put my custom PHP code in order to have the field correctly populate ? (lat / lng etc... from user adress) ?
I'd like them be check & insert while registering and profiles updates.

If I have to create my own plugin, why not, but where's the doc ? (the only one found is a hello_world plugin, from 2006)

thanks for help
Last edit: 9 years 1 month ago by nant.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
9 years 1 month ago #270957 by krileon
CB Auto Actions acting on the after registration and after profile update triggers with a Code action and Method set to PHP. This will execute your custom PHP and you can update the user object from there using CB API. Example as follows.

Code:
$cbUser = new UserTable(); $cbUser->load( '[user_id]' ); $cbUser->set( 'FIELD_NAME', 'VALUE' ); $cbUser->store();

It can also be done as follows.

Code:
$cbUser = CBuser::getUserDataInstance( '[user_id]' ); $cbUser->set( 'FIELD_NAME', 'VALUE' ); $cbUser->store();

The below might also work with latest CB Auto Actions nightly.

Code:
$user->set( 'FIELD_NAME', 'VALUE' ); $user->store();


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: NicolasGuy

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

9 years 1 month ago #270960 by NicolasGuy
just what I needed thanks

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

Moderators: beatnantkrileon
Powered by Kunena Forum