how to override files in [mysite]/concrete5/core

Permalink 1 user found helpful
I want to override the guestbook functionality. To be exact, I want to override the `action_form_save_entry()` function on *[mysite]/concrete5/core/controllers/blocks/guestbook.php*

but i can't find any way how to override that file. The documentation [here][1] and [here][2] doesn't show how to override that `/core/` directory. Google search also get misled with the 'core' keyword. Most result just take the 'core' meaning as just what's exist on the `/concrete5/` directory, not the exact true `/concrete5/core`

Looks like that core directory appear only on the newer version. CMIIW.

Btw, maybe I should also tell you what I want to do with that function. Probably you have another workaround for this instead of simply overriding it. I want to add SMS notification functionality to it. So whenever someone submit a new comment, an SMS would be sent to the admin of a particular page.


[1]:http://www.concrete5.org/documentation/introduction/overrides...
[2]:http://www.concrete5.org/documentation/how-tos/developers/change-th...

 
mhawke replied on at Permalink Reply
mhawke
I've never overridden this particular file but try copying 'guestbook.php' and putting it in '[root]/controllers/blocks/guestbook.php'.

The use of the 'core' directory to hold all the major core files is new to 5.6 so old Google results will be confusing in this respect.

Make sure you visit 'Dashboard->System and Settings->Cache and Speed Settings" and turn off all your caching, especially the 'Overrides Cache'. C5 won't even bother to look for your new file unless you turn the overrides cache off. After you have it working, you should turn the overrides cache back on again.
emkamal replied on at Permalink Reply
I've make sure all the caches are turned of and tried to override it these ways:

[root]/controllers/blocks/guestbook.php
[root]/core/controllers/blocks/guestbook.php

none of them works :(
mhawke replied on at Permalink Reply
mhawke
Your second choice listed above is the real 'core' file, correct? Are you saying that changes you make to the core file are still not showing up?
emkamal replied on at Permalink Reply
yup... it's still not overridden... it still use the one from [root]/concrete5/core/...
mhawke replied on at Permalink Reply
mhawke
Did some messing around and here's what worked for me.

Copy:

'[root]/concrete/blocks/guestbook/controller.php'

and save it as:

'[root]/blocks/guestbook/controller.php'

Open '[root]/concrete/core/controllers/blocks/guestbook.php' and copy the entire function you want to modify:

function action_form_save_entry() {
(grab entire function code)
}

and paste it in the 'empty' top section of:

'[root]/blocks/guestbook/controller.php' so the files looks like this:

<?defined('C5_EXECUTE') or die("Access Denied.");
class GuestbookBlockController extends Concrete5_Controller_Block_Guestbook {
function action_form_save_entry() {   
.
(put your changes here)
.
}


Clear as mud?

Thanks goes to Mainio here:
http://www.concrete5.org/community/forums/customizing_c5/override-c...
emkamal replied on at Permalink Reply
neat :) I'll try it out
timtorres replied on at Permalink Reply
timtorres
I've come across the same problem and found an official answer here but haven't tried it yet.
http://www.concrete5.org/documentation/how-tos/developers/overridin...