sonoracomm Posted January 1, 2009 Share Posted January 1, 2009 I suggest you just install the module from the firs post, then just edit modules/mod_whmcs/mod_whmcs.php. You have to edit it anyway and it's easy. Here's mine: <?php //Client Login// /** * WHMCS Client Login Module * @package Joomla * @copyright Copyright (C) 2008 Kurt Nelson. All rights reserved. * @license [url]http://www.gnu.org/copyleft/gpl.html[/url] GNU/GPL, see LICENSE.php */ ?> <form method="post" action="https://www.sonoracomm.com/client/dologin.php?goto=clientarea"> Email Address: <input type="text" name="username" size="20" /><br> Password: <input type="password" name="password" size="20" /><br> <input type="submit" value="Login"> </form> Make sure you post to your own server... IHTH, G 0 Quote Link to comment Share on other sites More sharing options...
mysmallbizu Posted January 1, 2009 Share Posted January 1, 2009 I'll see if I can find the download on a machine here... and update it with your code thanks. 0 Quote Link to comment Share on other sites More sharing options...
sonoracomm Posted January 1, 2009 Share Posted January 1, 2009 Here's the link...it's from the very first post in this thread. http://forum.whmcs.com/attachment.php?attachmentid=407&d=1225318263 Also, I added <br> tags after the "Email Address:" and "Password:" text so the input fields always show below the labels. G 0 Quote Link to comment Share on other sites More sharing options...
mysmallbizu Posted January 5, 2009 Share Posted January 5, 2009 I've installed both versions of these plugins for joomla on a 1.58 install and neither one of them appears as a valid plugin when you try to create a module for login. The plugins are active and configured in the Plugin manager however if I try to create a new module neither appear as an available module type... only the default joomla "mod_login" is available? Any suggestions? I really need to get this working! 0 Quote Link to comment Share on other sites More sharing options...
Redundant Posted January 5, 2009 Author Share Posted January 5, 2009 It is an authentication plugin which really doesn't have anything to do with a Module. The plugin simply authenticates against WHMCS database of users instead of Joomla. Although, you can still use Joomla User Database as an authentication database too: When configuring the WHMCS Joomla Auth plugin, there is an "ORDER" to place authentication plugins into. So, once you have that setup, the Default Joomla Login module would work fine. Where you would want a custom Login Module is perhaps to bypass Joomla Auth/Login all together and have the login FORM post the credentials to the WHMCS dologin.php (thus, bypassing Joomla Authentication completely). If all you want is to authenticate against your WHMCS database of users, without redirecting over to WHMCS, then the Joomla Auth Plugin will help in this respect. The user would remain in Joomla and be logged in having been authenticated against the WHMCS Database. If they navigate over to a WHMCS area, they would need to login again (its not a bridge for sessions). For logging directly into WHMCS, you would create a simple form (module), that posts to the WHMCS dologin.php which bypasses all Joomla Login/Authentication. Hope this clears that up...? 0 Quote Link to comment Share on other sites More sharing options...
mysmallbizu Posted January 5, 2009 Share Posted January 5, 2009 the one thing that I'd like to change is the email as username in joomla. this really mucks up a bunch of Joomla specific components. For example commenting software, fireboard, etc. all show the users email address as username. Do you know how this can be changed to reflect the "first name, lastname" from whmcs instead of the email? 0 Quote Link to comment Share on other sites More sharing options...
mysmallbizu Posted January 7, 2009 Share Posted January 7, 2009 I've got both versions of the plugin working thanks for everyones help.... However on some machines, with both ie and ff there is a warning across the top of the broswer when logging in or logging out. Warning: cannot modify header information - headers already send by ( link to authentication plugin.php:0) on line 0 What does this mean and how do I remove it? Any ideas? 0 Quote Link to comment Share on other sites More sharing options...
Redundant Posted January 7, 2009 Author Share Posted January 7, 2009 Heya Not too sure, but did a quick google ... check this out: http://forum.mamboserver.com/showthread.php?t=49427 Perhaps there is some white-space at the end of a file... 0 Quote Link to comment Share on other sites More sharing options...
mysmallbizu Posted January 7, 2009 Share Posted January 7, 2009 still looking. It' s a new install and i went thru the couple of files that I did edit. No white spaces :-( I'll keep on search and see what happens~ 0 Quote Link to comment Share on other sites More sharing options...
mysmallbizu Posted January 7, 2009 Share Posted January 7, 2009 The only warning that come up are when either of the whmcs authentication plugins enabled in Joomla. the other note from the mambo thread stated: "if you use include or require in your page. don't use similar header in current page and included page. This is important header must be top of the codes. Don't use headers bottom of html codes." Is this the case in either of the authentication plugins? I'm not a coder so I wouldn't know what to look for! 0 Quote Link to comment Share on other sites More sharing options...
Metee Posted January 10, 2009 Share Posted January 10, 2009 I tested the very top joomla module and I think it didn't solve a major problem of "Login through of site" Client need to login again when they go to client area. My joomla module also didn't a solution for integrate joomla and WHMCS may be we need to wait "Matt" or other WHMCS's programmer looking for this request. 0 Quote Link to comment Share on other sites More sharing options...
equipc Posted March 1, 2009 Share Posted March 1, 2009 Hi Metee, Is your plugin/module available somewhere ? Thanks, 0 Quote Link to comment Share on other sites More sharing options...
Shaun Posted March 1, 2009 Share Posted March 1, 2009 Hi Metee, Is your plugin/module available somewhere ? Thanks, Try this: JFusion bridge. Its made for this task of linking Joomla! to an external db. So you would get WHMCS -> Joomla 0 Quote Link to comment Share on other sites More sharing options...
equipc Posted March 1, 2009 Share Posted March 1, 2009 Thanks for your reply Shaun, I will test it. 0 Quote Link to comment Share on other sites More sharing options...
Shaun Posted March 1, 2009 Share Posted March 1, 2009 It would be awesome if you could post your results. If your feeling real active you could write a wiki page. Or feel free to email me a quick "what you did" with some screen shots and ill add it to the wiki for you. PM me if you interested 0 Quote Link to comment Share on other sites More sharing options...
equipc Posted March 1, 2009 Share Posted March 1, 2009 I tested the module posted in this topic but it's not really what I want. It gives the ability to login into Joomla with the login/password from WHMCS but don't create a session for WHMCS, so the user have to login twice. Maybe it's possible to add this feature but I don't know how. Now I will test the JFusion one. 0 Quote Link to comment Share on other sites More sharing options...
equipc Posted March 1, 2009 Share Posted March 1, 2009 JFusion is something interesting but the question is How to create a WHMCS session ? 0 Quote Link to comment Share on other sites More sharing options...
mysmallbizu Posted March 11, 2009 Share Posted March 11, 2009 you can't use jfusion... it reads the db correctly BUT you can't access the users password from the whmcs db unless you use the whmcs API. Last time I checked jfusion had no facility for making api calls while access the db 0 Quote Link to comment Share on other sites More sharing options...
bobbravo2 Posted March 16, 2009 Share Posted March 16, 2009 you can't use jfusion... it reads the db correctly BUT you can't access the users password from the whmcs db unless you use the whmcs API. Last time I checked jfusion had no facility for making api calls while access the db That's good to know - so the other direction then: How do we make a WHMCS session? 0 Quote Link to comment Share on other sites More sharing options...
bobbravo2 Posted March 16, 2009 Share Posted March 16, 2009 I have confirmed that the front-end has a Cookie named: PHPSESSID that authenticates the session. The WHMCSUID & SHMCSPW are for the "remember me" option and are not required to authorize the session. We may however, be able to write those 2 cookies using the API to handle the auto-login from joomla! 0 Quote Link to comment Share on other sites More sharing options...
blweb Posted March 23, 2009 Share Posted March 23, 2009 I'd be willing to chip in some money for a jfusion whmcs / joomla. 0 Quote Link to comment Share on other sites More sharing options...
bobbravo2 Posted March 23, 2009 Share Posted March 23, 2009 This is a Joomla! plugin for using the WHMCS database for authenticating users - it DOES NOT authenticate WHMCS users against the Joomla! database Upload to: joomla/plugins/authentication/whmcsauth.php <?php defined('_JEXEC') or die(); jimport('joomla.event.plugin'); /** * External WHMCS Database Authentication Plugin. Based on the example in Joomla! Core * * @package Bridger.Joomla * @subpackage Plugins * @license GNU/GPL */ class plgAuthenticationWhmcsauth extends JPlugin { /** * Constructor * * For php4 compatability we must not use the __constructor as a constructor for plugins * because func_get_args ( void ) returns a copy of all passed arguments NOT references. * This causes problems with cross-referencing necessary for the observer design pattern. * * @param object $subject The object to observe * @param array $config An array that holds the plugin configuration * @since 1.5 */ function plgAuthenticationWhmcsauth(& $subject, $config){ parent::__construct($subject, $config); } /** * This method should handle any authentication and report back to the subject * * @access public * @param array $credentials Array holding the user credentials * @param array $options Array of extra options * @param object $response Authentication response object * @return boolean * @since 1.5 */ function onAuthenticate( $credentials, $options, &$response ) { /* * Here you would do whatever you need for an authentication routine with the credentials * * In this example the mixed variable $return would be set to false * if the authentication routine fails or an integer userid of the authenticated * user if the routine passes */ $plugin =&JPluginHelper::getPlugin('authentication','whmcsauth'); $params = new JParameter( $plugin->params ); $url = $params->get('whmcsapi'); // URL to WHMCS API File $wusername = $params->get('whmcsadminuser'); // WHMCS Admin username $wpassword = $params->get('whmcsadminpass'); // WHMCS Admin password // WHMCS API Call $postfields["username"] = $wusername; $postfields["password"] = md5($wpassword); $postfields["action"] = "getclientsdatabyemail"; $postfields["email"] = $credentials["username"]; $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") { # Record Retrieved OK if ($credentials["password"] == $results["password"]) { $uid = $results['userid']; //store whmcs user ID to be used later to pull the password hash from the WHMCS DB mysql_connect (<WHMCS DATABASE HOST>,<WHMCS DB USERNAME>,"<WHMCS DB UN PASSWORD>"); ##connect to WHMCS database mysql_select_db ('<WHMCS DATABASE NAME>'); # select whmcs database $query = sprintf("SELECT `password` FROM `tblclients` WHERE tblclients.id =%s", #select passsword field from WHMCS DB mysql_real_escape_string($uid)); $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { $whmcspw = $row['password']; } mysql_close(); $days = 5; $time=time()+60*60*24*$days; $whmcspw2 = urldecode($whmcspw); setrawcookie("WHMCSPW",$whmcspw, $time,"/"); setcookie("WHMCSUID",$uid, $time,"/"); $response = JUser::getInstance(); // Bring the user in line with the rest of the system $response->fullname = $results["firstname"]." ".$results["lastname"]; $response->email = $results["email"]; $response->status = JAUTHENTICATE_STATUS_SUCCESS; return true; }else{ $response->status = JAUTHENTICATE_STATUS_FAILURE; $response->error_message = 'Invalid User Name or Password'; return false; } } else { # An error occured echo "The following error occured: ".$results["message"]; $response->status = JAUTHENTICATE_STATUS_FAILURE; $response->error_message = 'Invalid User Name or Password'; return false; } } } ?> Upload to: joomla/plugins/authentication/whmcsauth.xml <?xml version="1.0" encoding="utf-8"?> <install version="1.5" type="plugin" group="authentication"> <name>Authentication - WHMCS</name> <author>Marc Bridger</author> <creationDate>October 2008</creationDate> <copyright>(C) 2005 - 2007 Open Source Matters. All rights reserved.</copyright> <license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license> <authorEmail>pixelbrite@gmail.com</authorEmail> <authorUrl>pixelbrite@gmail.com</authorUrl> <version>1.5</version> <description>WHMCS Authentication Plugin. Modified version of Joomla! Core Authentication Plugin. </description> <files> <filename plugin="whmcsauth">whmcsauth.php</filename> </files> <params> <param name="whmcsapi" type="text" size="20" default="" label="WHMCS API URL" description="URL for the API.PHP file. eg (http://www.yourdomain.com/whmcs/includes/api.php)" /> <param name="whmcsadminuser" type="text" size="20" default="" label="WHMCS Admin Username" description="WHMCS Administrator Username" /> <param name="whmcsadminpass" type="password" size="20" default="" label="WHMCS Admin Password" description="WHMCS Administrator Password" /> </params> </install> KNOWN LIMITATIONS: Logout of Joomla will NOT logout WHMCS You will get locked out of the Joomla ADMIN if you only enable this auth plugin! You may get PHP warning messages about not being able to set the cookies because the headers have already been sent 0 Quote Link to comment Share on other sites More sharing options...
bobbravo2 Posted March 23, 2009 Share Posted March 23, 2009 to do list Clear the WHMCSPW & WHMCSUID cookies on Joomla! logout disable WHMCS logout & only use Joomla! logout 0 Quote Link to comment Share on other sites More sharing options...
redrat Posted March 24, 2009 Share Posted March 24, 2009 OK. I managed to read that without my glasses on. 0 Quote Link to comment Share on other sites More sharing options...
bobbravo2 Posted March 24, 2009 Share Posted March 24, 2009 OK. I managed to read that without my glasses on. LOL - Sorry I have a 30" monitor and I never know what's readable - I wanted to make sure people read the disclaimer before installing it. LOL again 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.