Execute php code on record save...

10 posts by 3 authors in: Forums > CMS Builder
Last Post: August 16, 2011   (RSS)

By rcrofoot - July 26, 2011

Hello -

I'd like to be able to automatically execute some PHP code when my client clicks "Save" after modifying a record in CMSB...Is there a built-in event handler somewhere that I could insert my code???

Seems like you can do everything else with CMSB, so why not this!

Thanks in advance for the help...

Rick

Re: [rcrofoot] Execute php code on record save...

By robin - July 27, 2011

Hey Rick,

There is a way, but you'll need to use a plugin which is pretty advanced. If you're up to it the hook to use is: record_postsave

This thread has some good ideas on how to get going with that.
http://www.interactivetools.com/forum/gforum.cgi?post=77541#77541

Hope that helps,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] Execute php code on record save...

By rcrofoot - July 27, 2011

Hi Robin -

Thanks for responding...

I'm having a problem accessing the download for the mysql console plugin...My 2 user names & passwords don't work on that screen...

Could you possibly outline what I need to do??? For instance where is [font "Verdana"]record_postsave and is it a built-in event handler...[/#000000]

[font "Verdana"]Also, might there be a more direct way to do this...Can I add another button (or link) on a section editor page that I can access after I save a record???[/#000000]

[font "Verdana"]Just trying to get this done asap...lots of pressure right now...[/#000000]

[font "Verdana"]Thanks, Rick[/#000000]

Re: [Jason] Execute php code on record save...

By rcrofoot - July 27, 2011

Thanks Jason...This will help alot...

One last question: Where is the record_save hook...In one of the cmsb php pages???[/#000000]

Thanks, Rick

Re: [rcrofoot] Execute php code on record save...

By Jason - July 27, 2011

Hi Rick,

Yes, the hook inside of the cmsb libraries. All it does is after a record is saved it calls a function that will call any plugin functions using that hook.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Execute php code on record save...

By rcrofoot - July 27, 2011

So as I understand it, I'm really creating a plugin and putting it in the plugins folder...

Then in /usr/www/users/brother/cmsAdmin/lib/menus/save.php, after the line doAction('record_postsave', $tableName, $isNewRecord, $oldRecord, $_REQUEST['num']);, I'll be adding addAction('record_postsave', '_pluginName_myFunctionName', null, 4); using my plugin & function name of course...Sounds interesting...Can't wait to try it...Rick

Re: [rcrofoot] Execute php code on record save...

By Jason - July 27, 2011 - edited: August 8, 2011

Hi Rick,

You shouldn't change anything inside save.php or any of the other cmsb files. All of the code I was showing you just goes in your file that you put in the plugins folder.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Execute php code on record save...

By rcrofoot - August 16, 2011

Hi Jason -

Thanks for the tips re: plugins...

I tried a few weeks ago to implement what I needed but was unsuccessful...I'm going to attempt to write the plugin I need one more time, but because I'm under a heavy workload, I may not have the time to focus...

What would the cost be to have you do it...Is there an hourly rate, or a minimum???...I've written the PHP code...I just need a plugin to execute it when user saves a record in CMSB...



OR, is there a detailed tutorial available, that can walk me thru the process of building it myself...

Thanks for the help...Rick

Re: [rcrofoot] Execute php code on record save...

By robin - August 16, 2011

Hey Rick,

If you mail consulting@interactivetools.com with your requirements they can go over the options and cost with you to get you exactly what you need.

We don't have a step by step tutorial yet on building plugins. The best tutorial is to check out how the free ones were made.

Hope that helps,
Robin
Robin
Programmer
interactivetools.com