Skip to content

General Development Introduction

jfusion edited this page Mar 26, 2016 · 1 revision

#1. Advantages of writing a Joomla bridge with JFusion

Writing a Joomla bridge has never been this easy. The revolutionary JFusion framework allows you to create an advanced bridge with minimal effort. A JFusion plugin can be written that contains basic code to retrieve user information and put it into a format that JFusion can recognize. JFusion can use this plugin to integrate the users of both softwares and even visually integrate the two sites. You can even integrate multiple softwares into Joomla. As more features are added to the JFusion framework, all different plugin softwares can benefit from these enhancements. Doesn't that sound great?

#2. How does the JFusion login work?

* The user can use any Joomla login module that calls the default Joomla login routine.
* Joomla passes the credentials to the JFusion authentication plugin

##JFusion authentication plugin

* The auth plugin looks up the user in the JFusion master plugin
* Then it will try out the different password encryption methods that are enabled to find a match.
* If a valid password match is found it will return the good news and Joomla will run the JFusion user plugin
* If no valid password is found, the user will be denied access and an error message is returned

#JFusion user plugin

* The plugin get the user information from the Master JFusion plugin
* It checks to see if a joomla user exists and creates one if needed. Then a Joomla session is created 
* Then it will loop through the enabled JFusion slaves.
* For each slave it will create or update the user and create a session for that software
* The user plugin returns it success and the user will be logged into all the softwares

#3. The file structure of a JFusion Plugin

The JFusion plugin functions have been split up over 5 different files. These files can be packaged into a ZIP archive and this can be uploaded into the JFusion plugin installer. Here is a breakdown of the JFusion plugin files:

* auth.php -> authentication plugin functions, such as password checks
* admin.php -> all backend functions, such as usersync functions
* jfusion.xml -> contains XML params for the plugin
* forum.php -> activity module, pm links and discuss bot related functions.
* user.php -> user plugin functions, such as get user information functions
* public.php -> front end functions such as registration URLs and visual integration

To make your life as easy as possible, we have created a blank JFusion plugin for you that you can use as a template to start creating your own plugin. You can download this from: (link coming soon - may be announced via the developer's newsletter soon)(sign up for the developer's newsletter on jfusion.org's homepage.)

#4. Deciding on a name for your plugin

You will need a unique name for your JFusion plugin, that can be used for the JFusion framework to call its functions. It is best that you chose a short name, that must be all in lowercase. It can also not contain spaces or special characters. Now for each of the PHP files change the return 'sample'; in getJname() to your new name, also change the 'sample' in the class name on the top to your new name. Then open the XML file to change the name parameter. You are now ready to start coding on the JFusion plugin functions :)

#5. Your parameters XML file for your JFusion plugin

Open the jfusion.xml file for your standard parameters. You can see that we already have put in basic set of paramaters, such as the database settings and your software's path. Most likely you do not have to change these parameters. However if you need additional parameters set in the JFusion component you can add them here.

#6. Using the JFusion Factory to get a database connection or parameters object

JFusion is environmentally friendly and recycles its classes and objects. This results in a minimal server load and a fast running application.

Database Objects:To get a database connection to your software you can use the following code:

$db = JFusionFactory::getDatabase($this->getJname());

This is a standard Joomla database object. You can find more information about using this object on:

http://api.joomla.org/Joomla-Framework/Database/JDatabase.html

Parameter Objects:To get the parameters for your jFusion plugin, please use the following code:

$params = JFusionFactory::getParams($this->getJname()); $myvalue = $params->get('myvalue') //a sample of how to get parameters

This returns a standard Joomla parameters object. You can find more information about using this object on:

http://api.joomla.org/Joomla-Framework/Parameter/JParameter.html

Accessing your own plugin files: If you need to access your JFusion plugin function you can get your class with the following code:

require_once(JPATH_ADMINISTRATOR .DS.'components'.DS.'com_jfusion'.DS.'models'.DS.'model.factory.php'); $JFusionUser = JFusionFactory::getUser('your_plugin_name');

The JFusion factory has the following functions:

* getPublic($jname) -> get the JFusion Public Class for the plugin name (load the public.php file)
* getAdmin($jname) -> get the JFusion Admin Class for the plugin name (load the admin.php file)
* getForum($jname) -> get the JFusion Forum Class for the plugin name (load the forum.php file)
* getAuth($jname) -> get the JFusion Auth Class for the plugin name (load the auth.php file)
* getUser($jname) -> get the JFusion User Class for the plugin name (load the user.php file)
* getDatabase($jname) -> get a Database Object for the plugin name
* getParams($jname) -> get a Database Object for the plugin name

This concludes the introduction into the JFusion Plugin Development. Please check out other documentation on writing the code in each of the 5 PHP files that are in the plugins.

#7. Jfusion API

The Jfusion API documentation is available at http://api.jfusion.org/. Don't hesitate to talk to other developers in the Developer's http://www.jfusion.org/index.php/forums/viewforum.php?f=16.

#8. Jfusion Development Center

Be sure to check out the JFusion Development Center at: http://code.jfusion.org/secure/Dashboard.jspa. Bugs and Issues - http://code.jfusion.org/browse/JFUSION

Happy Coding!