Joomla 3 Lis users in usergroup module - joomla

Anyone know of such a module?
Basically I want to dynamically load the users in certain usergroups inside an article with the loadmodule option.

Ended up building myself.
modfile:
<?php
defined('_JEXEC') or die;
// Include the latest functions only once
require_once __DIR__ . '/helper.php';
$shownumber = $params->get('shownumber', 10);
$groupnumber = $params->get('group', 4);
$names = ModUsersUsergroupHelper::getUsers($params);
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8');
require JModuleHelper::getLayoutPath('mod_users_usergroup', $params->get('layout', 'default'));
helper:
<?php
defined('_JEXEC') or die;
/**
* Helper for mod_users_usergroup
*
* #package Joomla.Site
* #subpackage mod_users_usergroup
*
* #since 1.6
*/
class ModUsersUsergroupHelper
{
/**
* Get users in a certain usergroup
*
* #param \Joomla\Registry\Registry $params module parameters
*
* #return array The array of users
*
* #since 1.6
*/
public static function getUsers($params)
{
$db = JFactory::getDbo();
$groupId = $params->get('group', 2);
$query = $db->getQuery(true)
->select($db->quoteName(array('u.id', 'u.name', 'u.username', 'u.registerDate')))
->order($db->quoteName('u.registerDate') . ' DESC')
->from('#__users AS u')
->join('INNER', '#__user_usergroup_map AS ugm ON ugm.user_id = u.id')
->where('ugm.group_id =' . $db->quote($groupId));
$db->setQuery($query, 0, $params->get('shownumber'));
try
{
return (array) $db->loadObjectList();
}
catch (RuntimeException $e)
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
return array();
}
}
}

I am not aware of such an extension but you could include some code in a Custom HTML module using Sourcerer or similar to achieve the desired result.
The Custom HTML module can then be displayed in an article using loadmodule.
For some example code see: https://stackoverflow.com/a/20743966

Related

Create custom plugin joomla with custom ordering on install

Is the a trick to set my custom plugin to load the final plugin in joomla?
I want to set order on install and not after.
Is s there a custom params to set in xml like order="xxx" ?
I just found the answer by adding in the xml file
<scriptfile>script.php</scriptfile>
And in the script file
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Script file of yourplugin component.
*/
class plgSystemyourplginInstallerScript
{
/**
* method to run after an install/update/uninstall method.
*/
public function postflight($type, $parent)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$fields = array(
$db->quoteName('ordering').' = '.(int) 999,
);
$conditions = array(
$db->quoteName('element').' = '.$db->quote('wraprotect'),
$db->quoteName('type').' = '.$db->quote('plugin'),
);
$query->update($db->quoteName('#__extensions'))->set($fields)->where($conditions);
$db->setQuery($query);
$db->execute();
// $parent is the class calling this method
// $type is the type of change (install, update or discover_install)
}
}
Don't forget to edit your plugin name
And in joomla 1.5 edit #__extensions to #__plugins
And delete the line $db->quoteName('type').' = '.$db->quote('plugin')

Component Install: DB function reports no errors

When trying to install a component I am getting this error.
Component Install: DB function reports no errors
Error installing component
I am getting this error quite often on a test system when trying to install a component which uses SQL updates and causes first time when installing an error (even not SQL related, such a missing file from the manifest file).
Here are some steps on how to fix this, by manually uninstalling the component, as from the Extension manager the installation may / will fail.
Find the id of your extension (you may also find multiple entries)
SELECT *
FROM `#__extensions`
WHERE `name` LIKE '%myextensionname%'
LIMIT 0 , 30
Remove from #__schemas the entries for extension, where extension_id is the previous found id. Remove also any entries for non existing extensions:
Remove any assets for your extension:
SELECT *
FROM `#__assets`
WHERE `name` LIKE '%myextensionname%'
LIMIT 0 , 30
Remove any menu entries:
SELECT *
FROM #__menu
WHERE link LIKE '%myextensionname%'
LIMIT 0 , 30
Reinstall.
Not tested but this is the general idea I would use.
<?php
/**
* A JApplicationCli application built on the Joomla Platform
*
* To run this place it in the cli folder of your Joomla CMS installation (or adjust the references).
*
* #package Joomla.CleanupFailedInsall
* #copyright Copyright (C) 2013 Open Source Matters. All rights reserved.
* #license GNU General Public License version 2 or later; see LICENSE
*/
/*
* This application cleans up database leftovers from a failed install
*
* To run from the command line type
* php cleanupfailedinstall.php -e='extensionname'
*/
if (!defined('_JEXEC'))
{
// Initialize Joomla framework
define('_JEXEC', 1);
}
#ini_set('zend.ze1_compatibility_mode', '0');
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Load system defines
if (file_exists(dirname(__DIR__) . '/defines.php'))
{
require_once dirname(__DIR__) . '/defines.php';
}
if (!defined('JPATH_BASE'))
{
define('JPATH_BASE', dirname(__DIR__));
}
if (!defined('_JDEFINES'))
{
require_once JPATH_BASE . '/includes/defines.php';
}
// Get the framework.
require_once JPATH_LIBRARIES . '/import.php';
// Get the framework.
require_once JPATH_LIBRARIES . '/import.legacy.php';
// Bootstrap the CMS libraries.
require_once JPATH_LIBRARIES . '/cms.php';
// Import the configuration.
require_once JPATH_CONFIGURATION . '/configuration.php';
// Uncomment this if you want to log
/*
// Include the JLog class.
jimport('joomla.log.log');
// Add the logger.
JLog::addLogger(
// Pass an array of configuration options
array(
// Set the name of the log file
'text_file' => 'test.log.php',
// (optional) you can change the directory
'text_file_path' => 'logs'
)
);
// start logging...
JLog::add('Starting to log');
*/
/**
* Cleanup Failed Install
*
* #package Joomla.Shell
*
* #since 1.0
*/
class CleanupFailedInstall extends JApplicationCli
{
public function __construct()
{
// Note, this will throw an exception if there is an error
// System configuration.
$config = new JConfig;
// Creating the database connection.
$this->db = JDatabase::getInstance(
array(
'driver' => $config->dbtype,
'host' => $config->host,
'user' => $config->user,
'password' => $config->password,
'database' => $config->db,
'prefix' => $config->dbprefix,
)
);
// Call the parent __construct method so it bootstraps the application class.
parent::__construct();
require_once JPATH_CONFIGURATION . '/configuration.php';
}
/**
* Entry point for the script
*
* #return void
*
* #since 1.0
*/
public function doExecute()
{
// Long args
$extensionname = $this->input->get('extensionname', null,'STRING');
// Short args
if (!$extensionname)
{
$extensionname = $this->input->get('e', null, 'STRING');
}
$extensionTable = new JTableExtension();
$extensionId = $extensionTable->find(array('name', $extensionname));
// This block taken from the platform component install adapter with minor moifications
// Remove the schema version
$query = $db->getQuery(true)
->delete('#__schemas')
->where('extension_id = ' . $extensionId);
$db->setQuery($query);
$db->execute();
// Remove the component container in the assets table.
$asset = JTable::getInstance('Asset');
if ($asset->loadByName($extensionname))
{
$asset->delete();
}
$extenstionTable->delete($extensionId);
$this->removeAdminMenus($extensionId);
// Remove categories for this component
$query->clear()
->delete('#__categories')
->where('extension=' . $db->quote($exensionname), 'OR')
->where('extension LIKE ' . $db->quote($extensionname . '.%'));
$db->setQuery($query);
$db->execute();
// Clobber any possible pending updates
$update = JTable::getInstance('update');
$uid = $update->find(array('element' => $row->element, 'type' => 'component', 'client_id' => 1, 'folder' => ''));
if ($uid)
{
$update->delete($uid);
}
}
/**
* Taken from the core installer component adapter
* Method to remove admin menu references to a component
*
* #param object &$row Component table object.
*
* #return boolean True if successful.
*
* #since 3.1
*/
protected function _removeAdminMenus($extensionId)
{
$db = JFactory::getDbo();
$table = JTable::getInstance('menu');
// Get the ids of the menu items
$query = $db->getQuery(true)
->select('id')
->from('#__menu')
->where($db->quoteName('client_id') . ' = 1')
->where($db->quoteName('component_id') . ' = ' . (int) $extensionId);
$db->setQuery($query);
$ids = $db->loadColumn();
// Check for error
if (!empty($ids))
{
// Iterate the items to delete each one.
foreach ($ids as $menuid)
{
if (!$table->delete((int) $menuid))
{
$this->setError($table->getError());
return false;
}
}
// Rebuild the whole tree
$table->rebuild();
}
return true;
}
}
JApplicationCli::getInstance('CleanupFailedInstall')->execute();
This an error / typo free version of what #Elin proposed (in case somebody wants to take this further). This solution did NOT work for me, but I think it has something in it.
<?php
/**
* A JApplicationCli application built on the Joomla Platform
*
* To run this place it in the cli folder of your Joomla CMS installation (or adjust the references).
*
* #package Joomla.CleanupFailedInsall
* #copyright Copyright (C) 2013 Open Source Matters. All rights reserved.
* #license GNU General Public License version 2 or later; see LICENSE
*/
/*
* This application cleans up database leftovers from a failed install
*
* To run from the command line type
* php cleanupfailedinstall.php -e='extensionname'
*/
if (!defined('_JEXEC'))
{
// Initialize Joomla framework
define('_JEXEC', 1);
}
#ini_set('zend.ze1_compatibility_mode', '0');
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Load system defines
if (file_exists(dirname(__DIR__) . '/defines.php'))
{
require_once dirname(__DIR__) . '/defines.php';
}
if (!defined('JPATH_BASE'))
{
define('JPATH_BASE', dirname(__DIR__));
}
if (!defined('_JDEFINES'))
{
require_once JPATH_BASE . '/includes/defines.php';
}
// Get the framework.
require_once JPATH_LIBRARIES . '/import.php';
// Get the framework.
//require_once JPATH_LIBRARIES . '/import.legacy.php';
// Bootstrap the CMS libraries.
require_once JPATH_LIBRARIES . '/cms.php';
// Import the configuration.
require_once JPATH_CONFIGURATION . '/configuration.php';
// Uncomment this if you want to log
/*
// Include the JLog class.
jimport('joomla.log.log');
// Add the logger.
JLog::addLogger(
// Pass an array of configuration options
array(
// Set the name of the log file
'text_file' => 'test.log.php',
// (optional) you can change the directory
'text_file_path' => 'logs'
)
);
// start logging...
JLog::add('Starting to log');
*/
/**
* Cleanup Failed Install
*
* #package Joomla.Shell
*
* #since 1.0
*/
class CleanupFailedInstall extends JApplicationCli
{
public function __construct()
{
// Note, this will throw an exception if there is an error
// System configuration.
$config = new JConfig;
// Creating the database connection.
$this->db = JDatabase::getInstance(
array(
'driver' => $config->dbtype,
'host' => $config->host,
'user' => $config->user,
'password' => $config->password,
'database' => $config->db,
'prefix' => $config->dbprefix,
)
);
// Call the parent __construct method so it bootstraps the application class.
parent::__construct();
require_once JPATH_CONFIGURATION . '/configuration.php';
}
/**
* Entry point for the script
*
* #return void
*
* #since 1.0
*/
public function execute()
{
// Long args
$extensionname = $this->input->get('extensionname', 'urlaubsrechner', 'STRING');
// Short args
if (!$extensionname)
{
$extensionname = $this->input->get('e', null, 'STRING');
}
require_once JPATH_LIBRARIES . '/joomla/database/table/extension.php';
$extensionTable = new JTableExtension($this->db);
$extensionId = $extensionTable->find(array('name' => $extensionname));
if (! $extensionId)
{
throw new Exception('Could not find extension with name: ' . $extensionname);
}
// This block taken from the platform component install adapter with minor modifications
// Remove the schema version
$query = $this->db->getQuery(true)
->delete('#__schemas')
->where('extension_id = ' . $extensionId);
$this->db->setQuery($query);
$this->db->execute();
// Remove the component container in the assets table.
$asset = JTable::getInstance('Asset');
if ($asset->loadByName($extensionname))
{
$asset->delete();
}
$extensionTable->delete($extensionId);
$this->_removeAdminMenus($extensionId);
// Remove categories for this component
$query->clear()
->delete('#__categories')
->where('extension=' . $this->db->quote($extensionname), 'OR')
->where('extension LIKE ' . $this->db->quote($extensionname . '.%'));
$this->db->setQuery($query);
$this->db->execute();
// Clobber any possible pending updates
$update = JTable::getInstance('update');
$uid = $update->find(array('element' => $extensionTable->element, 'type' => 'component', 'client_id' => 1, 'folder' => ''));
if ($uid)
{
$update->delete($uid);
}
}
/**
* Taken from the core installer component adapter
* Method to remove admin menu references to a component
*
* #param object &$row Component table object.
*
* #return boolean True if successful.
*
* #since 3.1
*/
protected function _removeAdminMenus($extensionId)
{
$db = JFactory::getDbo();
$table = JTable::getInstance('menu');
// Get the ids of the menu items
$query = $db->getQuery(true)
->select('id')
->from('#__menu')
->where($db->quoteName('client_id') . ' = 1')
->where($db->quoteName('component_id') . ' = ' . (int) $extensionId);
$db->setQuery($query);
$ids = $db->loadColumn();
// Check for error
if (!empty($ids))
{
// Iterate the items to delete each one.
foreach ($ids as $menuid)
{
if (!$table->delete((int) $menuid))
{
$this->setError($table->getError());
return false;
}
}
// Rebuild the whole tree
$table->rebuild();
}
return true;
}
}
JApplicationCli::getInstance('CleanupFailedInstall')->execute();

How to test a Magento Block

I want to test a Magento block function. I don't know, how to call the function outside .phtml files. Does anybody know a function like getModel() for blocks?
I found
getBlockSingleton()
But, it is deprecated and I can't get it to work.
Let's say your Magento root is your web root. In your Magento root, create a test.php file. You'll be able to access it at http://base_url/test.php.
ini_set('display_errors',true); //PHP has such friendly errors, show them!
include 'app/Mage.php'; //include the helper class/bootstrap file
Mage::setIsDeveloperMode(true); //flag to render Magento's traces
Mage::app();
/**
Instantiate the app. Note that this is different from Mage::run()! This can
be skipped given the Mage::app() call below.
*/
//block "type"
$class = 'core/bar';
//block instance
$block = Mage::app()->getLayout()->createBlock($class);
if (is_object($block)) die("Okay! ".get_class($block));
/**
* If script execution reaches this point, there is one of
* two problems:
*
* 1) bad/missing config
* 2) bad path based on filename
*/
//the xpath which is used
$xpath = 'global/blocks/'.strstr($class,'/',true).'/class';
//a node from config XML (we hope)
$node = Mage::getConfig()->getNode($xpath);
//error condition 1:
if (!$node) die("Bad xpath, check configuration: ".$xpath);
//error condition 2:
$name = uc_words((string) $node . '_' . substr(strrchr($class, '/'), 1));
$file = str_replace('_', DIRECTORY_SEPARATOR, $name.'.php');
$issue = '<br /><br />';
if (!is_readable($file)) {
//no file matching classname
$issue .= "No file found for $file, tried:<pre> - ";
$issue .= str_replace(PATH_SEPARATOR,'/'.$file.'<br /> - ',get_include_path()).$xpath.'</pre>';
} else {
$issue .= "Wrong class name in $file";
}
echo sprintf('Xpath ok, looking for class <span style="font-family: Courier New">%s</span>%s',$name,$issue);
If you just need the block instance itself to test methods on, the following function may do:
/**
* Create block instance for given block classAlias.
*
* #param string $classAlias Magento class alias for this block, e.g. 'catalog/product_price'
*
* #return Mage_Core_Block_Abstract
*/
public static function getBlockInstance($classAlias)
{
$className = Mage::getConfig()->getBlockClassName($classAlias);
$result = new $className;
return $result;
}

How to print collection mysql query in magento

Let's say I have a collection like:
$products = Mage::getModel('catalog/product')
->getCollection()
...
->load();
How do I print the actual MySQL code that gets executed?
You can always view your sql query at a certain point by echoing getSelect as shown:
$products = Mage::getModel('catalog/product')
->getCollection();
echo $products->getSelect();
To change query parameters you want to check out methods like:
$products->addAttributeToSelect('someattribute');
$products->addAttributeToFilter('someattribute', array('eq'=>'1'));
You can print collection using below code:
We can print query of collection using getSelect()->__toString()
$products = Mage::getModel(‘catalog/product’)
->addAttributeToFilter(‘status’, array(‘eq’ => 1));
echo $products->getSelect()->__toString();
Have you seen http://kuldipchudasama.wordpress.com/2012/07/16/magento-print-query-of-collection/?
This works well.
Most other answers here say that $products->getSelect() will do it - this is fine if all you're going to do with it is echo, but in fact getSelect() doesn't just return a string, it returns a Varien_Db_Select object.
Invoking echo on that object automatically triggers its __toString() method, so you just get the SQL string, but try passing it to Mage::log() and you'll get a lot more than you expected.
If you just want to log the SQL, you can use:
Mage::log($products->getSelect()->__toString());
Or how about using the object's own:
$products->printLogQuery(false, true); // don't echo, do log
printLogQuery is defined in lib/Varien/Data/Collection/Db.php.
You can print
$products->getSelect()->assemble();
I work with collections every day. This is without a doubt the correct way.
echo $collection->getSelectSql(true);
If you simple set the first parameter of ->load() to true, like so:
$products = Mage::getModel('catalog/product')
->getCollection()
...
->load(true);
In Magento 2:-
namespace <Company>\<Module>\Block\Adminhtml\Tab\Log;
class Grid
extends \Magento\Backend\Block\Widget\Grid\Extended
{
protected $_collectionFactory;
/**
* Constructor
*
* #param \Magento\Backend\Block\Template\Context $context
* #param \Magento\Backend\Helper\Data $backendHelper
* #param \<Company>\<Module>\Model\ResourceModel\Log\CollectionFactory $collectionFactory
* #param Psr\Log\LoggerInterface $logger
* #param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\<Company>\<Module>\Model\ResourceModel\Log\CollectionFactory $collectionFactory,
\Psr\Log\LoggerInterface $logger,
array $data = []
) {
$this->_logger = $logger;
$this->_collectionFactory = $collectionFactory;
parent::__construct($context, $backendHelper, $data);
}
/**
* {#inheritdoc}
*/
protected function _prepareCollection()
{
$collection = $this->_collectionFactory->create();
$this->_logger->info($collection->getSelect()->__toString());
$this->setCollection($collection);
return parent::_prepareCollection();
}
}
And remember that the collection factory is a magic class that can attaches to every class as Magento 1 wasn't complicated enough.
Step 1-
$result_colletion = print_r($collection->getSelect());
Mage::log($$result_colletion, null, custom_collection.log,true);
Step 2-
After that Login into magento admin section and enable to log setting . Please see below .
System > Configuration > Developer > Log Settings
Step 3-
After that see the log file custom_collection.log in var/log/ folder .
Try following code.
$products = Mage::getModel('catalog/product')
->getCollection();
echo $products->getSelect();

Joomla 1.7 Authentication from external app

My aim is to check that a Joomla username and password is valid from my external application. It is not necessary that the user is logged into the system, just that their account exists.
I decided to create my own authentication plugin based on the Joomla Authentication (JOOMLA_PATH/plugins/authentication/joomla). I only changed the name:
<?php
/**
* #version $Id: joomla.php 21097 2011-04-07 15:38:03Z dextercowley $
* #copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* #license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
defined('_JEXEC') or die;
jimport('joomla.plugin.plugin');
/**
* Joomla Authentication plugin
*
* #package Joomla.Plugin
* #subpackage Authentication.Webservice
* #since 1.5
*/
class plgAuthenticationWebservice extends JPlugin
{
/**
* This method should handle any authentication and report back to the subject
*
* #access public
* #param array Array holding the user credentials
* #param array Array of extra options
* #param object Authentication response object
* #return boolean
* #since 1.5
*/
function onUserAuthenticate($credentials, $options, &$response)
{
jimport('joomla.user.helper');
$response->type = 'Webservice';
// Joomla does not like blank passwords
if (empty($credentials['password'])) {
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = JText::_('JGLOBAL_AUTH_EMPTY_PASS_NOT_ALLOWED');
return false;
}
// Initialise variables.
$conditions = '';
// Get a database object
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id, password');
$query->from('#__users');
$query->where('username=' . $db->Quote($credentials['username']));
$db->setQuery($query);
$result = $db->loadObject();
if ($result) {
$parts = explode(':', $result->password);
$crypt = $parts[0];
$salt = #$parts[1];
$testcrypt = JUserHelper::getCryptedPassword($credentials['password'], $salt);
if ($crypt == $testcrypt) {
$user = JUser::getInstance($result->id); // Bring this in line with the rest of the system
$response->email = $user->email;
$response->fullname = $user->name;
if (JFactory::getApplication()->isAdmin()) {
$response->language = $user->getParam('admin_language');
}
else {
$response->language = $user->getParam('language');
}
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
} else {
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = JText::_('JGLOBAL_AUTH_INVALID_PASS');
}
} else {
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = JText::_('JGLOBAL_AUTH_NO_USER');
}
}
}
I added one more file to my plugin to access the authentication, I called it test_auth.php and it goes like this:
<?php
define('_JEXEC', 1 );
define('JPATH_BASE', 'C:\xampp\htdocs\joomla');
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
include("Webservice.php");
$credentials = array(
'username' => 'test',
'password' => 'test');
$options = array();
$response = array();
$auth = new plgAuthenticationWebservice();
$auth->onUserAuthenticate($credentials, $options, &$response);
var_dump($response);
But when I call it, it get these errors:
Warning: Missing argument 1 for JPlugin::__construct(), called in
C:\xampp\htdocs\joomla\plugins\authentication\Webservice\test_auth.php
on line 25 and defined in
C:\xampp\htdocs\joomla\libraries\joomla\plugin\plugin.php on line 57
Fatal error: Call to a member function attach() on a non-object in
C:\xampp\htdocs\joomla\libraries\joomla\base\observer.php on line 41
What am I doing wrong?
I think I could place all php scripts outside and independent from joomla and work with require_once(JPATH_BASE .DS.'includes'.DS.'defines.php') etc.
Or I could write a plugin, install it with the extension manager and won't struggle with an unavailable joomla framework. But in fact it won't work if I leave out defines.php and framework.php.
I think a guide for plugin creation in Joomla 1.7 would be helpful.
OK, i completely dropped my first try.
Instead I use JOOMLA_ROOT/libraries/joomla/user/authentication.php now (insprired by JOOMLA_ROOT/libraries/joomla/application/application.php).
My test_auth.php looks like this now:
<?php
define('_JEXEC', 1 );
define('DS', DIRECTORY_SEPARATOR);
define('JPATH_BASE', dirname(__FILE__) . DS . '..' . DS . '..' . DS . '..'); // assuming we are in the authorisation plugin folder and need to go up 3 steps to get to the Joomla root
require_once (JPATH_BASE .DS. 'includes' .DS. 'defines.php');
require_once (JPATH_BASE .DS. 'includes' .DS. 'framework.php');
require_once (JPATH_BASE .DS. 'libraries' .DS. 'joomla'. DS. 'user' .DS. 'authentication.php');
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
$credentials = array(
'username' => 'test',
'password' => 'test');
$options = array();
$authenticate = JAuthentication::getInstance();
$response = $authenticate->authenticate($credentials, $options);
if ($response->status === JAUTHENTICATE_STATUS_SUCCESS) {
echo('<br />It works<br />');
}
var_dump($response);
For any improvements I would be deeply grateful!
EDIT: I dismissed the plugin installation. It is a simple external script, which wouldn't be called from Joomla itself. I simply moved it to a new folder in the Joomla root.

Resources