[geeklog-devel] Geeklog 2.0.0 - Comments, Captcha and Plugins

cordiste cordiste at free.fr
Thu Jan 3 08:17:14 EST 2013


Thanks for the note. Mediagallery, dowloads, and filemgmt plugins are concerned.

Ben

2013/1/2 Tom <websitemaster at cogeco.net>:
> 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:
>
> 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;
> }
>
>
>
> _______________________________________________
> geeklog-devel mailing list
> geeklog-devel at lists.geeklog.net
> http://eight.pairlist.net/mailman/listinfo/geeklog-devel
>



More information about the geeklog-devel mailing list