We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

[Answered] add comments section on custom pages | Forum

Kieron H Leader
Kieron H Nov 28 '14
anyone know how i can add the wall comment to a custom page 
The Forum post is edited by Alia May 15 '15
RubenB Apr 9 '15
i'd like to hear this question answered....
Kieron H Leader
Kieron H Apr 9 '15
i ended up putting all my code into a blog post so then it has comments section 
RubenB Apr 10 '15
hmmm. ok. tnx.
but it is not the way i wanted it.
Nickolay Apr 10 '15
describe what you want specificly
RubenB Apr 13 '15
Hi Nickolay

i have made several custom pages. (admin > pages&menus > main menu > add item)

so far so good.
but i would like to incorporate the newsfeed ( the possibility of adding comments by visitors) at the bottom of some of my custom pages. just like one sees in blogs...

i know that i could use the blog feature (plugin) but prefereably not in my case because these custom pages are stable en fixed and need to show up in the menu at all times.

these custom pages are ("why this site" etc....)
see also printscreen. at the bottom you see code i tried to insert but without succes.

RubenB May 3 '15
* bump * nobody can help?
Nickolay May 14 '15
You can do this with a core hack like this in file \ow_system_plugins\base\controllers\static_document.php (actually you can move the same solution to custom plugin Event handler that uses OW_EventManager::ON_AFTER_DOCUMENT_RENDER to modify OW::getResponse()->getMarkup()):

Replacing line:

$this->assign('content', $language->text('base', "local_page_content_{$document->getKey()}"));


// comments hack

$content = $language->text('base', "local_page_content_{$document->getKey()}");

if(($pos = strpos($content, '{comments}')) !== false) {

    $cmpParams = new BASE_CommentsParams('base', 'static-page');

    $cmpParams->setEntityId(substr($document->getKey(), 5));

    $comments = new BASE_CMP_Comments($cmpParams);

    $comments = $comments->render();

    $content = substr_replace($content, $comments, $pos, 10);


$this->assign('content', $content);

This will replace {comments} text in documents where you want to show comments.

The Forum post is edited by Nickolay May 14 '15
Alia Team
Alia May 15 '15

Try  Nickolay's solution and see whether it works for you or not.

The best and right solution will be building a plugin responsible for your custom pages.

It is important to understand that comments ( wall widget)  can't exist all by themselves. They are always attached to certain content ($post): blogs, photos and etc. This content in turn should have an action described within the source code: comment blog, comment photo and etc.

Custom pages are very simple static documents. They don't have any .php functionality behind. They don't have any actions assigned to them. As a result you can't add comments component to them. System simply won't understand where those comments should go, where they should be stored, how to displayed them.

So the ideal solution will be to  develop a plugin that will:

1. create new custom page for you.
2. content of this page should be programatically designed. So let's say the text " About us...what we do" should be added not as text but as certain post ( like event, blog, photo, link).
3. have authorization methods .
4.  have attached wall component.

The main complex task is creating a fully functional plugin that can handle posts.

Attaching the component step itself is quite simple. To add the component you must modify controllers/controller_name.php file of your plugin:

$allow_comments = true;

$cmpParams = new BASE_CommentsParams('lpluginkeyhere', 'post-namehere);

$this->addComponent('comments', new BASE_CMP_Comments($cmpParams));

You must also include {$comments} into views/controllers/controllername_functionname.html file.

You can take "Blogs" plugin you mentioned as an example.
Here is the piece of code from controllers/view.php of this plugin:

$allow_comments = true;
        if ( $post->authorId != OW::getUser()->getId() && !OW::getUser()->isAuthorized('postname') )
            $eventParams = array(
                'action' => 'blogs_comment_blog_posts',
                'ownerId' => $post->authorId,
                'viewerId' => OW::getUser()->getId()
                OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
            catch ( RedirectException $ex )
                $allow_comments = false;
        /* */
        // additional components
        $cmpParams = new BASE_CommentsParams('blogs', 'blog-post');
        $this->addComponent('comments', new BASE_CMP_Comments($cmpParams));

Anil Kumar
Anil Kumar Jun 8 '16
I think we also need to set permission to add comments in install.php page

$authorization = OW::getAuthorization();
$groupName = 'plugin_key';
$authorization->addAction($groupName, 'add_comment');

Celine Dion
Celine Dion Feb 28 '23

Quote from Kieron H i ended up putting all my code into a blog post so then it has comments section 
Hi phrazle! I had to do the same.
siya koli
siya koli Apr 1 '23

Thus, for rich men paying for Call Girls in Chandigarh to discover something new and to get company of most beautiful lady in will be best move to stay away from tension.

The Forum post is edited by siya koli Apr 1 '23
ali Apr 11 '23
В Арт Академи в София, децата могат да се научат на различни техники за рисуване, керамика, крафт с полимерна глина и много други изкуствени дейности. През последните години, училището се е утвърдило като един от най-добрите центрове за изкуство за деца в София. Една от големите предимства на Арт Академи е, че децата не само могат да се забавляват, но и да учат много полезни умения като търпение, точност и творческо мислене. Децата могат да се развиват в своите умения и да изразят своята индивидуалност. В Арт Академи има и опитни учители, които ще насочат децата и ще им помогнат да развият своя талант. Всички материали и оборудване, необходими за изкуството, са на разположение в училището. Арт Академи
Jeffree Star
Jeffree Star Nov 20 '23
The method for adding wall comments to a custom cookie clicker page depends on the specific platform or website you're using. 
The Forum post is edited by Jeffree Star Nov 20 '23
kalvindarwan Dec 21 '23
Your problem may not be with the windshield or rear glass only, but the side window too. Carmichael Fencing Company