Jump to content

Joomla Bridge


tim

Recommended Posts

ok, I've searched and searched, then started over.

There is tons of talk about WHMCS and Joomla, mainly in reference to templates and look/feel.

 

Does anyone know how to combine the username/password database for Joomla & WHMCS?

 

It would be so nice if users could just login to joomla, and be already logged into WHMCS. Just my 2c.

 

:-) Thanks

Tim

Link to comment
Share on other sites

  • 6 months later...
  • Replies 50
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 months later...
  • 2 months later...
  • 4 weeks later...
  • 4 months later...
  • 2 months later...
  • 3 weeks later...
Has this ever been completed? If so, could you please provide us with a link to the bridge? Thanks in advance!

 

Im thinking about doing something now.

More of a module than a bridge. But i have to read the code more.

Its a matter of weather we insert details into the J! db.

 

But i am looking at making some modules that allow you to insert the WHMCS cart and items.

Link to comment
Share on other sites

this is EXTREMELY easy to do. just write a short function to make the following call to the WHMCS API while storing the user's joomla profile info in an array called $DetailArray:

 

$url = "api.php"; # URL to WHMCS API file
$username = "admin"; # Admin username goes here
$password = "admin"; # Admin password goes here
$postfields["username"] = $username;
$postfields["password"] = md5($password);

$postfields["action"] = "addclient"; 
$postfields["firstname"] = $Detail_Array[firstname];
$postfields["lastname"] = $Detail_Array[lastname];
$postfields["companyname"] = $Detail_Array[business];
$postfields["email"] = $Detail_Array[email];
$postfields["address1"] = $Detail_Array[address];
$postfields["address2"] = $Detail_Array[address2];
$postfields["city"] = $Detail_Array[city];
$postfields["state"] = $Detail_Array[state];
$postfields["postcode"] = $Detail_Array[postcode];
$postfields["country"] = "AU";
$postfields["phonenumber"] = $Detail_Array[phone];
$postfields["password2"] = $Detail_Array[password];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);

$data = explode(";",$data);
foreach ($data AS $temp) {
	$temp = explode("=",$temp);
	$results[$temp[0]] = $temp[1];
}

if ($results["result"]=="success") {
	# Result was OK!
	echo("Success, new client id is ". $results["clientid"]);
} else {
	# An error occured
	echo "The following error occured: ".$results["message"];
}

 

then just save the user's $clientID into a field in the joomla user table. You can then submit their username and password to the WHMCS login page using a link on your joomla homepage.

 

We did the same thing on our website, but we dont use Joomla. its the same deal though.

 

I've never actually used Joomla, but if it's writen in PHP with MySQL, then you should be able to use this code (mostly borrowed from the WHMCS API documentation) to do what you want to do.

Link to comment
Share on other sites

This is kinda th idea but most people want to user WHMCS as the master and then have the data goto into Joomla!.

 

Its possible using the plugin auth of Joomla! to make this module.

 

why would people want the WHMCS to be the master account creation page? People use Joomla! so it's the frontend, not the backend.

 

Then again I can't imagine what's going through the heads of people who use Joomla! anyway, so I can't really say much to contribute :P

Link to comment
Share on other sites

@Kl, no think you mis-understand. Shaun is talking from a frontend perpsective.

 

Perhaps a detailed description might help.

 

Imagine that all your dynamic content is on a joomla site, but logins and users management are done using a WHMCS login.

When a user logs into whmcs (either in the WHMCS section or on a WHMCS login box with the Joomla area), WHMCS user info is bridged (& obviously inserted) to Joomla user data.

Sessions/ cookie session handling then allows Joomla content to be displayed that is available only to Joomla registered users. This sessions handling then needs to be maintained between transitions betwwen joomla & WHMCS parts of the site.

tehn all it takes is some good templating to give the 2 parts of the site a cohesive look, eliminating the need to use a joomla wrapper.

 

hope this adds some clarity

Link to comment
Share on other sites

ah yeah i get what you're saying. I chose to build my own user database and my own login/logout/details system (in effect, the same as using Joomla! to manage users) and I didn't wanna use WHMCS' addin content for logging in.

 

Basically I didn't wanna use any WHMCS page content on my system, I just wanted to API as much as possible. If you're willing to use WHMCS addins then I guess it's best to make WHMCS the master credential handler then.

 

Makes sense.

 

edit:

 

the reason being that we are a fully fledged ISP, and WHMCS only handles the hosting part of our services, so people will be making accounts and adding internet services. It's not until they chose "Add Hosting Service" that the WHMCS API is called and duplicates their credentials into a WHMCS account.

Link to comment
Share on other sites

Cheers K. That also makes more sense.

 

There's been so much talk about this topic, that SOME-ONE has to make a start.

For those who are looking to do this, I've come across a piece of code that could open a joomla session from within whmcs (step 2 from my post above).

 

So lets see if we can get a couple of others that know more about coding than I, to run with this towards a bridge.

 

Re user syncing, i have some other code snippets that could be useful, but I'm gonna hang on to them in case there's no community interest from here.

 

Note: I haven't yet got this running, but it comes from a trusted source.

 

//===========================================================================

// START JOOMLA

define( '_VALID_MOS', 1 );

header('Content-Type: text/html; charset=iso-8859-1');

// search for config

if (file_exists('configuration.php')) require_once('configuration.php'); else

if (file_exists('../configuration.php')) require_once('../configuration.php'); else

if (file_exists('../../configuration.php')) require_once('../../configuration.php'); else

if (file_exists('../../../configuration.php')) require_once('../../../configuration.php');

 

require_once($mosConfig_absolute_path.'/includes/joomla.php');

require_once($mosConfig_absolute_path.'/includes/database.php');

require_once($mosConfig_absolute_path.'/includes/sef.php');

require_once( $mosConfig_absolute_path .'/includes/frontend.php' );

 

// load Language

if (file_exists($mosConfig_absolute_path.'/language/' . $mosConfig_lang . '.php'))

include_once($mosConfig_absolute_path.'/language/' . $mosConfig_lang . '.php');

else include_once($mosConfig_absolute_path.'/language/english.php');

 

// Load dB

if ( $mosConfig_db != "")

{

$database = new database( $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix );

}

$mainframe = new mosMainFrame( $database, '', '.' );

// $mainframe->initSession();

// JOOMLA STARTED

//===========================================================================

Link to comment
Share on other sites

@Zorro - Howdy Zorro | I believe that code is from Joomla 1.0. All the "mos" stuff (mosMainFrame, mosConfig, etc) I believe is gone with Joomla 1.5. I need this bridge too, for similar reasons you explained in an earlier post. Well put. I'm starting to work on it, but am hindered by poor PHP skills.

 

To add to mysmallbizu fine list above, here is an outstanding article on Joomla Authentication:

http://docs.joomla.org/Tutorial:Creating_an_Authentication_Plugin_for_Joomla_1.5

 

Seems the largest gap in this bridge is WHMC's lack of a API call to log users in? (Related Link: http://forum.whmcs.com/showthread.php?t=14557&highlight=joomla)

 

plugging away, looking forward to any other thoughts on this...

Edited by Redundant
typos
Link to comment
Share on other sites

@Redundant, yes, sorry should have qualified that I'm using 1.0.x

 

Haven't done the upgrade yet, as not all our in use components were 1.5.x compliant, and am too busy to take the upgrade route yet.

 

So there are a couple of alternatives.

Joomla 1.0.x/ 1.5.x

WHMCS as master or slave (for want of better terms)

Link to comment
Share on other sites

There are open source plugins for both 1.0 and 1.5 that allow for remote mySql authentication. The nice part is that the existing plugins handle all the authentiation issues like sessions/cookies etc... The only reason they dont' work now is because of the way that Whmcs encrypts the passwords.

 

Perhaps this existing code can be used as a base. All that's needed is the inclusion of the whmcs api call to decrypt the password from the whmcs user table.

 

Here are the two existing plugins

 

1.0 MySQL Auth http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,642/Itemid,35/

 

1.5 MySQL Auth 1.5

http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,3444/Itemid,35/

 

I'm currently using amember.com and their joomla plugin to handle my subscriptions and billing for my membership sites... but would love to consolidate my hosting and joomla business billing with whmcs.

 

If anyone wants to learn more about Joomla Membership sites I have videos availalbe at http://www.joomlamembershipsite.com

Link to comment
Share on other sites

@mymallbizu - Heya. Thanks for the links. Big help.

 

I have created an Authentication Plugin which could used some testing.

 

This really doesn't help a whole lot, seeing how it doesn't also log the user into WHMCS. Perhaps someone can help with that. The idea presented in this thread about CURL is interesting, but I do not know CURL...

 

The other issue I guess is the reverse. If the user logs in or out of WHMCS it doesn't affect the login status for the Joomla side of things...

 

Looking forward to anymore thoughts on all this.

Link to comment
Share on other sites

i would like to see something like this. What i was thinking, not sure how i would do this coding isn't my best thing is, to be able to login to joomla and pass login information into whmcs. Could you do the following? I know this isn't very very secure but:

1. user registers on joomla's site.

2. user enters there whmcs username and password into a forum

3. user information is saved into a database.

4. when someone logs into joomla, the information is taken from the database where they entered the whmcs information into it and passes this into the login form on whmcs.

5. they are logged in?

would that work?

just an idea, and not sure if it could even work.

mike

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated