This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

So in order to override the single pages for the profile section of your site you will need to do a few things...

Copy the single pages and controllers and an element from the core...

/concrete/controllers/profile/* /concrete/single_pages/profile/* /concrete/elements/profile/sidebar.php

To your package

/packages/yourPackage/controllers/profile/* /packages/yourPackage/controllers/single_pages/* /packages/yourPackage/elements/sidebar.php

Then in order to get Concrete5 to realise your trying to override those pages from a package... your going to need to add the following to your package installer and call it from the install method.

//update some core package to be associated with this package to allow overrides within the package
    private function overrideSinglePagePackage($pkg){
        $db = Loader::db();

        /*
        You can use these if you want to override the other core single pages

        $p = Page::getByPath('/login');
        $cID = $p->getCollectionID();
        $db->execute('update Pages set pkgID = ? where cID = ?', array($pkg->pkgID, $cID));

        $p = Page::getByPath('/download_file');
        $cID = $p->getCollectionID();
        $db->execute('update Pages set pkgID = ? where cID = ?', array($pkg->pkgID, $cID));

        $p = Page::getByPath('/register');
        $cID = $p->getCollectionID();
        $db->execute('update Pages set pkgID = ? where cID = ?', array($pkg->pkgID, $cID));
        */

        $p = Page::getByPath('/profile');
        $cID = $p->getCollectionID();
        $db->execute('update Pages set pkgID = ? where cID = ?', array($pkg->pkgID, $cID));

        $p = Page::getByPath('/profile/edit');
        $p->update(array('cName'=>'Personal details'));
        $cID = $p->getCollectionID();
        $db->execute('update Pages set pkgID = ? where cID = ?', array($pkg->pkgID, $cID));

        $p = Page::getByPath('/profile/avatar');
        $p->update(array('cName'=>'Profile picture'));
        $cID = $p->getCollectionID();
        $db->execute('update Pages set pkgID = ? where cID = ?', array($pkg->pkgID, $cID));

        $p = Page::getByPath('/profile/messages');
        $p->update(array('cName'=>'Private messages'));
        $cID = $p->getCollectionID();
        $db->execute('update Pages set pkgID = ? where cID = ?', array($pkg->pkgID, $cID));

        $p = Page::getByPath('/profile/friends');
        $cID = $p->getCollectionID();
        $db->execute('update Pages set pkgID = ? where cID = ?', array($pkg->pkgID, $cID));
    }

You need to be sure that in your uninstall method you set the pkgID back to 0 to reassociate the pages with core.

That should be it... you can now tamper with those pages and re-arrange them as you need to!

Loading Conversation