Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8703025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:47:18+00:00 2026-06-13T02:47:18+00:00

I wrote a simple authentication plugin that uses a SOAP webservice to check the

  • 0

I wrote a simple authentication plugin that uses a SOAP webservice to check the username and the password. That works fine.

I wanted to have some parameter like the SOAP password in the admin of joomla. So I have added the params in the xml, it shows fine in the admin. When I try to get the value of it the php, I get:

Fatal error: Call to a member function get() on a non-object

So I compared with other authentication and I do it exactly the same way…. I do not understand why it is so.

Here is the code of the Plugin:

public function __construct() {
    $nusoap = JPATH_SITE . '/plugins/authentication/ers/nusoap/lib/nusoap.php';
    if (! file_exists ( $nusoap )){
                $response->error_message = "No such file";
        return;
            }
    require_once ($nusoap);

}



function onUserAuthenticate($credentials, $options, &$response)
{



        //Without defaults (the plugin crashes on the first get() bellow)
        $webservice = $this->params->get('webservice', '');
        $group      = $this->params->get('group', '');
        $whitepaw   = $this->params->get('whitepaw', '');



        JRequest::checkToken() or die( 'Invalid Token' );
        // For JLog
        $response->type = 'ERS SOAP Webservice';

            // MyCompany does not like blank passwords (So does Joomla ;))
    if (empty($credentials['password'])) {
        $response->status = JAuthentication::STATUS_FAILURE;
        $response->error_message = JText::_('JGLOBAL_AUTH_EMPTY_PASS_NOT_ALLOWED');
        return false;
    }

    if (empty($credentials['username'])) {
        $response->status = JAuthentication::STATUS_FAILURE;
        $response->error_message = JText::_('Please enter a username');
        return false;
    }

           // Add a user to joomla
                function addJoomlaUser($name, $username, $password, $email, $group) {

                            $data = array(
                                "name"=>$name,
                                "username"=>$username,
                                "password"=>$password,
                                "password2"=>$password,
                                "email"=>$email,
                                "block"=>0,
                                "groups"=>array("1","2", $group) // the uer is added into the group "public" and "registered" as well as a group of the user's choice.

                            );

                            $user = clone(JFactory::getUser());
                            //Write to database
                            if(!$user->bind($data)) {
                                throw new Exception("Could not bind data. Error: " . $user->getError());
                            }
                            if (!$user->save()) {
                                throw new Exception("Could not save user. Error: " . $user->getError());
                            }

                        return $user->id;
                }


            // Pour supprimer le cache du web-service
            ini_set('soap.wsdl_cache_enabled', 0);

            // Nouveau Client SOAP
            try {

                // Nouvelle instance de la classe soapClient
                $client = new SoapClient($webservice, array('trace' => true));


                $username = $credentials['username'];
                $password = $credentials['password'];



                $result = $client->CheckLogin(array('whitepaw'=>$whitepaw, 'username'=>$username, 'password'=>$password));

                if($result->isInDB){


                        $name = $result->fname.' '.$result->lname;
                        $email = $result->email;

                        $response->error_message = $username.'<br>'.$password.'<br>'.$name.'<br>'.$email."<br><br>".
                                "<b>Request :</b><br>".htmlentities($client->__getLastRequest())."<br><br>".
                                "<b>RESPONSE :</b><br>".htmlentities($client->__getLastResponse())."<br><br>";

                        if(!$result->email == '' || empty ($result)) {
                            //Todo: check if the user is already in joomla db
                            $user_id = addJoomlaUser($name, $username, $password, $email,$group);
                            $response->status = JAuthentication::STATUS_SUCCESS;
                            //for testing purposes
                            $response->error_message = $user_id;
                      } else {
                           $response->error_message = "The webservice did not return data".$email.'did you see it?';

                       }

                } else {
                    $response->status = JAuthentication::STATUS_FAILURE;
                    $response->error_message = 'You do not have yet an account in <a href="http://my.ersnet.org">myers</a>. Please register.<br>';
                    $response->error_message .= $result->isInDB;

                }
                } catch (Exception $fault) {
                    $response->error_message = $fault->getMessage();
                }




}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:47:19+00:00Added an answer on June 13, 2026 at 2:47 am

    Since you have your own constructor, you need to call the parent constructor like this:

    public function __construct(& $subject, $params = array()) {
        $nusoap = JPATH_SITE . '/plugins/authentication/ers/nusoap/lib/nusoap.php';
        if (! file_exists ( $nusoap )){
                    $response->error_message = "No such file";
            return;
                }
        require_once ($nusoap);
        // call the parent constructor
        parent::__construct($subject, $params);
    }
    

    The parent constructor is where the $this->params object gets set, so if you don’t call it then $this->params is never set. That’s why you get the error saying params is not an object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a working web application that uses username/password SpringSecurity configuration. Now I want
I have simple web application called App that is secured with Windows Authentication. I
I wrote simple class that on the start it just increase the value of
I wrote a simple function, that makes emacs add matching quotes (so when I
I wrote a simple plugin which sets some css code using wp_options. It all
I'm trying to write a simple decorator to check the authentication of a user,
Its a simple login form that I have made using Classic ASP, where the
I have a custom plugin (I didn't write it) that is not working on
i wrote simple 3 functions to scrape titles , description and keywords of simple
I wrote simple load testing tool for testing performance of Java modules. One problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.