1

我制作了一个插件,它对我们的 XML 服务器进行身份验证,就像魅力一样。但是现在我正在尝试为 onUserAfterSave 函数制作插件,这样我就可以进行登录后处理,例如将用户分配到其中一个组中。

但是 ik 无法获得基本的工作。

我在 xml 文件中的扩展定义如下所示:

<extension version="3.1" type="plugin" group="user">

和这样的php文件

    // No direct access
    defined('_JEXEC') or die;
    //include_once "functions.php";

    /**
     * HCC XML-RPC login handler plugin
     *
     * @package Joomla.Plugin
     * @subpackage  User.hcc_xml_handler
     * @since 3.1
     */
    class PlgUserhcc_xml_handler extends JPlugin
    {
        /**
        * This plug process the extra login information.
        *
        *
        * @param   array    $user     Holds the new user data.
        * @param   boolean  $isnew    True if a new user is stored.
        * @param   boolean  $success  True if user was succesfully stored in the database.
        * @param   string   $msg      Message.
        *
        * @return  void
        *
        * @since   1.6
        */
        public function onUserAfterSave($user, $isnew, $success, $msg)
        {
            /*
            $debug = $this->params->get('debug', '0');
            if ($debug == '1')
            {$debugfile = $this->params->get('debugfile', '');}
            else{$debugfile = "";}

            $debug = $this->params->get('debug', '0');
            */
            $debug = '1';
            $debugfile = "/disk/site/hcc.nl/poc-groepen/logging/hcc_xml_handler-debug.log";
            if ($debug == '1')
            {
                // set debug log file if debug is enabled
                $debugstartmsg  = "=====================================\n";
                $debugstartmsg .= "= start hcc_xml_handler.php aanroep =\n";
                $debugstartmsg .= "=====================================\n";
                file_put_contents($debugfile, $debugstartmsg, FILE_APPEND | LOCK_EX);
            }

            if (!$success)
            {
                if ($debug == '1')
                {
                    $debugsuccessmsg = "login gelukt" ;
                    file_put_contents($debugfile, $debugsuccessmsg, FILE_APPEND | LOCK_EX);
                }
                return false;
            }
            if ($isnew)
            {
                if ($debug == '1')
                {
                    $debugnewsmsg = "login NEW" ;
                    file_put_contents($debugfile, $debugnewsmsg, FILE_APPEND | LOCK_EX);
                }
            return false;
            }
            if ($debug == '1')
            {
                // set debug log file if debug is enabled
                $debugstopmsg  = "=====================================\n";
                $debugstopmsg .= "=  stop hcc_xml_handler.php aanroep =\n";
                $debugstopmsg .= "=====================================\n";
                file_put_contents($debugfile, $debugstopmsg, FILE_APPEND | LOCK_EX);
            }


        }
    }

我究竟做错了什么 ?

我在日志中看到的错误是:

mysqli_fetch_row() 期望参数 1 为 mysqli_result,布尔值在第 785 行的 /www/libraries/joomla/database/driver/mysqli.php 中给出,引用:https: //someurl.hcc.nl/ mysqli_free_result() 期望参数 1 为是 mysqli_result,在第 828 行的 /www/libraries/joomla/database/driver/mysqli.php 中给出的布尔值,引用者:https ://someurl.hcc.nl/

任何人的想法?

4

1 回答 1

0

我切换到为我完成的 onUserAfterLogin 功能

于 2014-09-10T15:07:25.443 回答