Skip to Content Skip to Menu

CB Code Field - Run PHP Script when clicking button

  • alagazam
  • alagazam
  • OFFLINE
  • Posts: 7
  • Thanks: 0
  • Karma: 0
7 years 1 month ago #297563 by alagazam
I want to execute a PHP script inside CB Profile Edit when the user press the "Update" button but don't understand it should be done.

Using CB Code Field runs the PHP script when the Profile Edit form is opened. I would like to run the script when the user click Update.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
7 years 1 month ago #297578 by krileon
That's not what CB Code Field does. It executes the PHP immediately and displays the results. Binding to the update button also isn't PHP, but jQuery with would need to ajax some sort of PHP endpoint to execute server side code like that.

What behavior exactly are you wanting to do when they update their profile? I suggest using CB Auto Actions and a Code action with Method set to PHP on the onAfterUserUpdate trigger to execute code after a profile update operation.


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.

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

  • alagazam
  • alagazam
  • OFFLINE
  • Posts: 7
  • Thanks: 0
  • Karma: 0
7 years 1 month ago #297600 by alagazam

krileon wrote: What behavior exactly are you wanting to do when they update their profile? I suggest using CB Auto Actions and a Code action with Method set to PHP on the onAfterUserUpdate trigger to execute code after a profile update operation.


Ah, okay.

When a user updates the profile I want to run a PHP script that sends some of the updated information to another server.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
7 years 1 month ago #297612 by krileon

When a user updates the profile I want to run a PHP script that sends some of the updated information to another server.

In that case I just recommend using a Code action on onAfterUserUpdate trigger in CB Auto Actions then set Method to PHP. You can then execute whatever PHP you want there. If you need to make a direct HTTP request to a PHP file you can do so with the Request action.


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.

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

Moderators: beatnantkrileon
Powered by Kunena Forum