Discussion Plugin

discussion plugin by Gina Häußge, Michael Klier
Add a comments section to Wiki pages. (previous authors: Esther Brunner)

Last updated on 2009-08-22. Provides Syntax, Helper, Admin, Action.
Compatible with DokuWiki 2009-04-14, 2008-05-05.

Conflicts with sidebar!
Requires pagelist.
Similar to blogtng, disqus.

Tagged with discussion.

    Download

    Description

    The Discussion Plugin adds a discussion section after your wiki page for user comments. This is useful to separate page content and the discussion thereof and also, if you don't want to give normal users the right to edit the page but still want user contributed notes. A second component of this plugin shows a list of all pages in a namespace with a discussion section (called discussion threads) ordered by most recent comments. This allows you to create a very simple discussion forum in your wiki.

    Components

    Discussion Comments

    ~~DISCUSSION~~
    ~~DISCUSSION:off~~
    ~~DISCUSSION:closed~~
    ~~DISCUSSION|Custom Title String~~
    ~~DISCUSSION:closed|Custom Title String~~

    This is the main part of the plugin. By including the ~~DISCUSSION~~ instruction in your wiki page, a discussion section will be appended after the normal wiki page content. To turn it off again, use ~~DISCUSSION:off~~. If you want to show the existing discussion but don't want to allow new comments / replies, use ~~DISCUSSION:closed~~. A custom title can be appended after the separator |.

    After each comment there may be up to three buttons (depending on your rights):

    • Edit: Registered users can edit their comments; admins can edit all comments. To remove a comment, just edit it, clear the text and save the empty comment – like you would do with a wiki page. Attention: If there are replies to a comment, removing it will also remove all replies!
    • Reply: To reply to a comment (vs. commenting on the wiki page content), click the Reply button. The comment entry form will then be placed accordingly.
    • Hide / Show: Admins can deactivate and reactivate comments easily by this button. Hidden comments aren't shown to normal users and are displayed dimmed to admins.

    Of course, the whole DokuWiki syntax can be used in comments as well. But there are problems with headers and footnotes as they may produce conflicting IDs and thus invalid XHTML. I'm looking for a way to either allow only a subset of the wiki syntax or automatically create unique IDs.

    Threads

    {{threads>[namespace]&[flags]}}
    [namespace] the namespace for which you want a discussion thread list; : is the top namespace, . is the same namespace as the page lies in, * the whole wiki required
    [flags] pagelist flags delimited by &, see flags optional

    This displays a list of all pages of the given namespace with a discussion section. The list is sorted by the most recent comment.

    Configuration

    The plugin can be configured using DokuWiki's configuration manager available in the admin menu.

    automatic automatically enables discussions on all pages
    allowguests allow/disallow unregistered users to leave comments
    showguests show/hide comments to unregistered users
    linkmail link username with the supplied mail address
    useavatar display avatars (requires the avatar plugin)
    urlfield allow to submit a homepage URL (will be linked with the name unless linkmail is set)
    addressfield allow to submit a address
    adminimport admin can supply all fields (for import only)
    usecocomment use CoComment tracking (disabled by default)
    wikisyntaxok allow wiki syntax in comments
    threads_formposition position of the new thread form
    subscribe allow comment subscription (uses double opt-in)
    newestfirst Invert the comments display order
    usethreading enable/disable threaded comments
    userealname Display the real name instead of the user name of registered wiki users
    moderate moderate new comments

    Demo

    You can try this plugin using the live demo.

    Bugs / Feature Requests

    Please report bugs or feature requests at the Bug tracker.

    Further Resources

    Changes

    FAQ

    How do I allow plugin formatting within discussions?

    I have DokuWiki formatting allowed in comments. I also have a LaTeX plugin. <math>\sum_x{x+5}</math> is not rendered within a discussion.

    How do I prevent SPAM?

    The plugin has built-in support for the CAPTCHA plugin. Additionally, one might also consider to use the Bad Behavior plugin.

    My dates are shown wrong. What can I do?

    You're probably not running the latest version of the plugin. Try to update to the latest version first.

    Is it possible to show the newest entry on top?

    Yes, use the newestfirst option.

    Can admins subscribe to all discussions?

    If you enable the notify option admins are notified for all comments.

    Where are discussions saved?

    The comments are saved in special meta files inside the <dokuwiki>/data/meta directory. Each page which has a discussion has a corresponding pagename.comments file.

    How can I change the discussion box size?

    You can change the size of the box by using the following CSS class:

    div.dokuwiki div.comment_wrapper {}

    Why do comments not appear in the latest changes list?

    Because it would break DokuWiki's revisions system.

    Alternative: use the pagelist plugin to make an overview of “latest discussion” by using the {{thread>...}} syntax.

    When I use the sidebar plugin the discussions disappear.

    This is a know problem with the sidebar plugin which needs to be fixed by it's author. If you're looking for working alternatives in the meanwhile I suggest to have a look at the sidebarng plugin.

    Is it somehow possible to show all discussions on one page (like in the admin area)?

    Is it possible to only display pages with comments in the discussion area using Threads?

    Discussion

    :!: DO NOT REPORT BUGS/FEATURE REQUEST HERE, USE THE BUG TRACKER :!:

    obfuscating email addresses

    I changed line 690 of action.php to read:

              <code>$head .= $this->email(obfuscate($mail), $showname, 'email fn');</code>

    Now it supports dokuwiki's email obfuscation preferences if you choose to display emails.

    Xavier 11-24-2009

    syntax plugin

    I've added a small syntax plugin that allows you to write

    [[discuss>:some:discussion:somewhere]]

    which will be replaced by xx Comments, linked to

    :some:discussion:somewhere#discussion__section

    if there is a discussion on that page.
    “xx” will be the number of comments on that page.

    I can't upload it here. With a bit of luck, find it here:
    http://pike.kw.nl/files/software/pike/recent/php/dokuwiki/discuss.php.txt

    *-pike

    have only names required for posting a comment

    My DokuWiki installation runs locally and in house so that for me a name would be sufficient and I don't need to worry about spam.

    I had a look at the options but name and email is the simplest thing I can do. Is there a simple way to modify the code in order to have only a name required? (or only a email) — Sebastian Spiess 2008/08/27 00:08

    solved (quick and dirty)

    OK, here is what I did and it seems to work. But as I have not much of a clue regarding PHP it might not be the right way to do it. :-?

    So please FIXMESebastian Spiess 2008/08/27 00:29

    I uncommented line 616 to 621 in the action.php using <!– xxx –>

    <div class="comment_mail">
                    <label class="block" for="discussion__comment_mail">
                      <span><?php echo $lang['email'] ?>:</span>
                      <input type="text" class="edit" name="mail" id="discussion__comment_mail" size="50" tabindex="2" value="<?php echo hsc($_REQUEST['mail'])?>" />
                    </label>
                  </div>

    Further functionality

    About Edit, Delete and Hide buttons: Can the discussion plugin be configured in order to let some non admin user use this buttons in the discussion section?

    Cordially,

    Etienne Fort ~ fortetienne@gmail.com

    Switching off

    Using ~~DISCUSSION:off~~ doesn't work all the time when global discussion is off. I noticed that sometimes it works again adding a newline before and after ~~DISCUSSION:off~~. Any same experiences and how to resolve it are welcome. (version 2008-07-12, DokuWiki 2008-05-05) RH

    Please post bugs at the bug tracker linked on this page. Thanks! — Michael Klier 2009/01/07 12:12

    Prefilled Name + eMail + Date

    How about prefilled Name, eMailadress and Date? My Users (internal DokuWiki) are complaining that they should Type in there Data every Time they want to discuss. Now they are mostly not use it anymore because of that. All of them have their Data correctly in the Wiki user Data, so all what is needed is to take this existing Data and prefill the Form with it.

    2009-02-19 muetze

    When they are logged in to the wiki they don't have to type their credentials. — Michael Klier 2009/05/11 11:45

    After an entry is saved by a logged-in user the message's attribution line contains only the date and no name. With the form present (no one is logged-in) the name shows up fine. Possible bug? Using latest DokuWiki (2009-02-14)

    2009-06-11 ham

    Solve (Quickly but dirty)

    I modified the codes in action.php so that user may comment without logging in, but I don't think it is a good deal, and it may not be safe.
    Are there any configuration options?
    Here are the codes, start from line 805 in action.php

            // for guest/adminimport: show name, e-mail and subscribe to comments fields : LINE 805
            if(!$_SERVER['REMOTE_USER'] or ($this->getConf('adminimport') && auth_ismanager())) {
                // Extra Codes Here
                if(empty($_REQUEST['name'])) 
                    $_REQUEST['name'] = "anonymous";
                if(empty($_REQUEST['mail'])) 
                    $_REQUEST['mail'] = "anonymous@unknown.com";

    So please FIXMERaymond Tian 2009/09/04

    AutoSubmit issue

    After clicking on toolbar “Horizontal Rule” form doing submit. — Mikhail I. Izmestev 2009/05/28

    Probable encoding issue

    Discussion plugin doesn't work for pages edited locally (UTF-8 encoded), then uploaded. It works though when discussion is enabled on every page through the configuration manager, or when the discussion instruction is typed in the wiki directly. — Beñat Dagorret 2009/05/29

    Runaway Comments

    2009-2-14 release: adding a single comment seems to send the wiki off into an infinite loop producing literally hundreds of copies of that comment. Sorry to raise the issue here, but this a serious problem for us. An identical (copy of the) installation on a laptop runs fine (Apache server) but on the main server )IIS goes crazy. Help please!

    comment me

    I add function utf8_encode($s) { return iconv('iso-8859-1', 'utf-8', $s);}

    function utf8_decode($s) { return iconv('utf-8', 'iso-8859-1', $s);} and all work

    Fatal error: Call to undefined function send_redirect() with DokuWiki on Stick

    When saving comment, I always get

    Fatal error: Call to undefined function send_redirect() in 
    C:\xxx\DokuWikiStick\dokuwiki\lib\plugins\discussion\action.php on line 306''.

    After returning back and refreshing page, comment is saved and visible. DokuWiki on Stick version: 2008-05-05 — Jorge, 2009-07-08

    The latest version of the plugin is not compatible with your DokuWiki version.

    Is there an older version, that work on DokuWikiStick? Yes it is older version

    custom title and table of contents

    When using a custom title the table of contents still says “Discussion”. Would be nice to have that changed to the custom title.

    fix for Monobook template

    the Monobook template has the four buttons (reply, hide, …) on each discussion entry vertically arranged - and with that spreading the discussion-entries unnecessary far apart. The following code added to style.css fixes this:

    div.dokuwiki div.comment_buttons form.discussion__reply {
        float: left;
    }
    div.dokuwiki div.comment_buttons form.discussion__edit {
        float: left;
    }
    div.dokuwiki div.comment_buttons form.discussion__toogle {
        float: left;
    }
    div.dokuwiki div.comment_buttons form.discussion__delete {
        float: left;
    }

    Daniel Schranz, 2009-08-14

    This is not an issue with the Plugin - you can't have CSS for every template there is. Add the CSS to the <dokuwiki>/conf/userstyle.css instead. — Michael Klier 2009/08/21 15:43
    Okay sorry, but as far as I see it doesn't change anything for the templates it already worked with and just adds another template for which it works out of the box, too. (sorry if I am mistaken here - by all means I am not a CSS pro) And as I deemed this a more general solution I would have it added to the plugins CSS. Anyway, feel free to add it or ignore it as you like. —Daniel Schranz, 2009-08-23

    NODISCUSSION

    Hi, thanks for the plugin. I have a problem, though. If I add ~~NODISCUSSION:off~~ to the start of the page, the discussion disappears, okay. But then if I decide to turn it back on, that is I get rid off ~~DISCUSSION:off~~ line… the discussion is still not there… As I discovered, I have to manually remove a file from /data/lib/meta to have it back on.

    Arctic Template

    I noticed that whenever you have a discussion page in your wiki page, Index of the sidebar stops working. Namely, instead of open/close a branch it directs to Index page.

    Suggestion: nodiscussion files in namespaces

    I turned on auto discussion feature in configuration, because this is exactly what I need: whenever someone creates a new page, others can add some comments, and create discussions. At the same time, it is quite inconvenient that this feature adds discussion to EVERY single page. For example, there is nothing to discuss on Syntax page, it is just given. Also, I don't want to see discussions on all pages in the root directory. My solution is simple: if there is a namespace s.t. there is nothing to discuss (root, help, sidebar, etc.) I just create a file named 'nodiscussion' (without .txt) in the namespace, and also I added the following three lines in 'lib/plugins/discussion/action.php', function _show (line 313):

        function _show($reply = NULL, $edit = NULL) {
            global $ID;
            global $INFO;
            global $ACT;
            global $conf; // FIRST ADDED LINE
            global $NS; // SECOND ADDED LINE
     
            // get .comments meta file name
            $file = metaFN($ID, '.comments');
     
            if (!$INFO['exists']) return;
            if (!@file_exists($file) && !$this->getConf('automatic')) return false;
            if (!$_SERVER['REMOTE_USER'] && !$this->getConf('showguests')) return false;
            if (@file_exists($conf['datadir'].'/'.utf8_encodeFN(str_replace(':','/',$NS)).'/nodiscussion')) return false; // THIRD ADDED LINE
     
            // load data

    No, whenever there is a file 'nodiscussion' (without extension) in a namespace, no pages in the namespace have discussion section.

    Any comments? Is this a good idea? A there any better solutions?

    This plugin can overwrite pages

    FIXME I installed DokuWiki and this plugin today (09/11/01). Put your mouse into the form field for “new thread” and send it _empty_. Voila: Your original page became replaced with the new thread.

    Please report bugs at the bug tracker linked on this page. I don't monitor this page too frequently. Thanks!
     
    plugin/discussion.txt · Last modified: 2010/01/27 10:24 by chi
     
    Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
    Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
    WikiForumIRCBugsGitXRefTranslate