dokufreaks / plugin-discussion

Add a comments section to DokuWiki pages
https://www.dokuwiki.org/plugin:discussion
GNU General Public License v2.0
35 stars 26 forks source link

Feature suggestion : Allowing editong of any field for admins. #329

Open chtiland opened 1 year ago

chtiland commented 1 year ago

Hi,

Allows admin or moderator to edit all fields of any comment would be useful (eg. if someone post its full name and didn't realized that it was published).

I tried to modify a comment by editing json file, but discussion disappears when doing so (checksum control somewhere ???, I don't have time to find why this happen, plugin feature or something else ?)

I don't know why this plugin became more and more restrictive for admins (few years ago it begun with the disappearance of IP, and no option to enable or not this feature, and that was really useful to create some IP filters).

Thanks

Klap-in commented 1 year ago

With quick look back in the history, I do not see were the ip-addresses were visible. Sure you do not confuse another plugin?

I removed ip-adresses now completely in #333, because it was implemented messy and it mixes with the user-id field.

The data format used for storing the comments is serialized PHP array. The best is to use php functions to open, unserialize, modify the user, serialize and store again.

//some code suggestion based on save() in action.php (NOT TESTED).
$pageid = '....';
// get discussion meta file name
$file = metaFN($pageid, '.comments');
$data = unserialize(io_readFile($file, false));

$cid = '...comment id....';

$data['comments'][$cid]['user']['name'] = ...
$data['comments'][$cid]['user']['mail'] = ...
//etc...

$date = time();
$data['comments'][$cid]['date']['modified'] = $date;
$type = 'ec'; // edit comment

// save the comment metadata file
io_saveFile($file, serialize($data));
//$this->addLogEntry($date, $pageid, $type, '', $cid);

So you recommend still storing regardless privacy considerations.

At the moment the ip-adresses are still stored temporary in the comment-changelog, which hold a number of recent changes. But that changelog is not accessible via the interface so far i know.

chtiland commented 1 year ago

Hello @Klap-in

I don't confused with another plugin, because that the one I choose on my first installation and never used another one (nor external one). I think IP was displayed in admin section of discussion, but it was available in 2013 (some old hidden posts I kept) 😄

I care about privacy, but I decided to valid each post in discussions, less spams. But sometimes, some posts or replies (injuries...) in discussions needs more than just deleting them and that's where IP of author is required (block IP or pursuits).

In fact, it would be nice to have IP only for admin, but, for privacy reason, best way would to keep this IP for "hidden" post and when clicking on "Show", IP can be removed (not more required).

Of course, if this feature is implemented, I would add a specific message to prevent and explain how, when and why their IP will be temporarily stored.

Thanks for tip to modify json, I didn't even think about php serialization... I probably was too tired 😋

About the comment-changelog, where this file is stored ? I found none in my meta folders, only json comments.

Thanks, Fabrice

Klap-in commented 1 year ago

Changelog with number of changes (number of changes kept is set with the recent Configuration setting) is stored in $conf['metadir'].'/_comments.changes'