Feature suggestion: Internal commenting

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Posts: 68
Joined: Mon Oct 12, 2009 11:47 pm

Feature suggestion: Internal commenting

Post by Stosh » Mon Jan 12, 2015 11:15 pm


This is just a feature suggestion. Not something I need, but just something that would be nice to have.

In my glossary (example) I have a set of message editing tags ([comment] blah blah blah [/comment]) that denote that anything between them is a comment, which is stored in the database, but is never displayed when the message is displayed at the outside level.

It is implemented simply by parsing out the entire structure to an empty string when the message is being parsed for display.

Again, not a demand, just thought it would be cool to have (very helpful in the glossary).


User avatar
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Re: Feature suggestion: Internal commenting

Post by garvinhicking » Tue Jan 13, 2015 12:27 pm


Not really sure if there is public demand, but a plugin could very simply do this:

Code: Select all

class serendipity_event_commenthide extends serendipity_event {
    var $title = 'Hide internal comments';
    function introspect(&$propbag) {
        global $serendipity;

        $propbag->add('name',          $this->title);
        $propbag->add('event_hooks',   array('frontend_display' => true));

    function commentify($string) {
        return preg_replace('@\[comment](.+)\[/comment\]@imsU', '', $string);

    function event_hook($event, &$bag, &$eventData, $addData = null) {
        global $serendipity;
        $hooks = &$bag->get('event_hooks');
        if (isset($hooks[$event])) {
            switch($event) {
                case 'frontend_display':
                    $el = array('body', 'extended');
                    foreach ($el as $temp) {
                        if (isset($eventData[$temp['element']]) &&
                            !$eventData['properties']['ep_disable_markup_' . $this->instance] &&
                            !isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) {
                            $element = $temp['element'];
                            $eventData[$element] = $this->commentify($eventData[$element]);
                    return true;

        return false;
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

Post Reply