|
||||||||
![]() |
Forum Index > Geeklog France > Les plugins |
New Topic
|
Post Reply
|
Les commentaires dans les plugins avec Geeklog 2 |
|||
| ::Ben |
|
||||||
![]() ![]() ![]() ![]() ![]() Admin ![]() Status: offline ![]() Registered: 18/10/2006 Posts: 117 |
La nouvelle fonction permettant la saisie des commentaires sur la même page nécessite quelques ajustements dans le code des plugins qui utilisent la fonction des commentaires. Tom vient de publier une note à l'attention des développeurs.
A note to all plugin developers:
If your plugin uses comments and you have the Captcha plugin installed you will need to update your code slightly for the function plugin_savecomment_foo You will now need to take into account the constant COMMENT_ON_SAME_PAGE. If the attempt to save a comment by a user errors out (ie due to an incorrect captcha code), if the comment is on the same page as your plugin content then you need to only return the comment form, if it is not then you need to return the whole document. You can see the Staticpage and polls plugin in the repository for an example or see the code below: PHP Formatted Code function plugin_savecomment_polls($title, $comment, $id, $pid, $postmode){ global $_CONF, $_TABLES, $LANG03, $_USER; $retval = ''; $commentcode = DB_getItem ($_TABLES['polltopics'], 'commentcode', "pid = '$id'"); if ($commentcode != 0) { return COM_refresh ($_CONF['site_url'] . '/index.php'); } $ret = CMT_saveComment ($title, $comment, $id, $pid, 'polls', $postmode); if ($ret > 0) { // failure //FIXME: some failures should not return to comment form $retval .= CMT_commentForm ($title, $comment, $id, $pid, 'polls', $LANG03[14], $postmode); if (!defined('COMMENT_ON_SAME_PAGE')) { $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG03[1])); } else { if (!COMMENT_ON_SAME_PAGE) { $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG03[1])); } } } else { // success $retval = COM_refresh ($_CONF['site_url'] . "/polls/index.php?pid=$id"); } return $retval; } |
||||||
|
|||||||
| Content generated in: 0,52 seconds |
|
|
|