rmccny Posted July 22, 2008 Share Posted July 22, 2008 I've spent the past two days working on a vB user account sync to tie WHMCS and vB together. The biggest challenge so far is that neither vBulletin, nor WHMCS makes doing so very easy, although I do lean in favor of vBulletin since it has a robust hooks system. Anyhow, I've got a system in place that I'm in the process of tweaking and testing that might hopefully work for others. Here's what it does: From WHMCS: User registers in WHMCS --> Account is created in vBulletin (via CURL using WHMCS actionhook, kind of messy) User changes info in WHMCS --> Info is sync'd with vB (via include using WHMCS actionhook/Direct MySQL Query) Admin changes info in WHMCS --> Info is sync'd with vB (very messy, see below/Direct MySQL Query) From vBulletin: User changes info in vB -- Info is sync'd with WHMCS (via Hook/Direct MySQL Query) Admin changes info in vB -- Info is sync'd with WHMCS (via Hook/Direct MySQL Query) Fields Sync'd: E-Mail (2-Way) Password (2-Way) Birthdate (If you create custom fields in WHMCS, 2-Way) Gender (If you create custom fields in WHMCS & vBulletin, 2-Way) Location (vB custom field, one-way population from client city/state during account creation) This integration also will allow the client to choose their username during the signup process. The vBulletin Hooks DO NOT use the WHMCS API. I have found it to be a bit sluggish on my system for some reason so I chose to directly manipulate the WHMCS database for the few fields I touch. I won't be developing any reverse account creation, I'd rather force all registration through WHMCS so I have disabled registrations on my forum. Why is "Admin changes info in WHMCS" very messy? Well, there are no actionhooks called when an admin makes changes to a client profile for whatever reason. So basically what I had to do is create a landing point for submissions from admin/clientsprofile.php to handle the updates. Why is "User registers in WHMCS" kind of messy? For the same reason as above. I decided NOT to use a custom field for the forum username since you cannot easily make a custom WHMCS field non-editable after registration. This mod will post the register.php form to a different file first before passing it onto register.php. This allows for forum username availability checks before handing off to WHMCS. It is also possible to do single sign-on for both as well, but I will need to work with Matt for that since it requires access to the code. I'm in the process of testing now. My forum is not live yet, so I have the ability to break it as much as needed. I'm posting ahead of the release to gauge interest, and also see who wants to help test this before a general release. Thanks. 0 Quote Link to comment Share on other sites More sharing options...
WHMCS CEO Matt Posted July 22, 2008 WHMCS CEO Share Posted July 22, 2008 I think you might want to check the admin changes info in WHMCS again. There is an action hook run - it's the same one as run when a client changes info - called ClientDetailsEdit. Likewise when a user registers, the ClientSignup hook is run. Matt 0 Quote Link to comment Share on other sites More sharing options...
goddess_dix Posted July 22, 2008 Share Posted July 22, 2008 wow...this is VERY cool! i would love the option to integrate vb into whmcs for a peer support fourm at some point... i'll be watching this one. 0 Quote Link to comment Share on other sites More sharing options...
rmccny Posted July 22, 2008 Author Share Posted July 22, 2008 Matt, I'll go back and retest the hook call from admin to see if I missed anything. Also, sent you a PM about some other stuff. Goddess, I just have to put the finishing touches on the initial sync script and it'll be ready for testing. 0 Quote Link to comment Share on other sites More sharing options...
rmccny Posted July 22, 2008 Author Share Posted July 22, 2008 Update: I replaced my actionhooks.php with a fresh one and it is now being called correctly without having to relay through a handler. Not sure what changed, since I was always calling the save handler as an external include from actionhooks.php, but who cares, it's working now. 0 Quote Link to comment Share on other sites More sharing options...
othellotech Posted July 22, 2008 Share Posted July 22, 2008 Why is "User registers in WHMCS" kind of messy? For the same reason as above. I decided NOT to use a custom field for the forum username since you cannot easily make a custom WHMCS field non-editable after registration. We've "fudged" pending (hopefully/eventually) WHMCS adding a new "client-editable" variation to tblcustomfields for times you want the client (or admin) to specify on the orderform, but not change in the clientarea, or to tell them details of things like serial numbers and not let them change it ... For some we have 2 fields one of whch is admin only in the tbl and another which is normal, copying the data between them at signup and then a cron job to compare them and reset back every day - for things like their VAT number, where we *might* want them to update it but need to know they have done so - the client detail update email including custom fields woudl fix that ... And for other things in the client area setting it to .value not .input for that customfield-id - sadly this means 160 if statements in various tpl's 0 Quote Link to comment Share on other sites More sharing options...
othellotech Posted July 22, 2008 Share Posted July 22, 2008 looking forward to seeing our code for this, as I'm tempted to add another box to the client dashboard of "your posts from the forum" ... 0 Quote Link to comment Share on other sites More sharing options...
rmccny Posted July 23, 2008 Author Share Posted July 23, 2008 I'm currently re-working the sync to work as an add-on module in WHMCS admin. The inital Sync will be WHMCS --> vBulletin. There is no way to do the reverse since vB passwords are stored using 1-way encryption. I'm also adding a manual account assignment option too. I'm waiting to hear back from Matt with answers to a couple questions before I attempt any kind of release. Othello, I too wish the WHMCS custom fields had the functionality that vBulletins do. There are so many things I've had to hack together either with php code in templates, or wrappers for stock files. Don't get me wrong, it's an awesome product, but the two big suggestions I would make would be to enhance the custom fields and expand the hooks system to include more hook points. 0 Quote Link to comment Share on other sites More sharing options...
rmccny Posted July 24, 2008 Author Share Posted July 24, 2008 Here's an update... Additions: Added WHMCS actionhook for DeleteClient called via CURL (must be to properly initialize vBulletin). When a client gets deleted in WHMCS the linked vBulletin account can be automatically deleted as well. This feature can be disabled. vBLink Sync: The WHMCS to vBulletin Sync Tool This is pretty much complete and is built as a WHMCS admin module. This utility is only run once, when the bridge has been installed (it can be periodically run however, if you continue to allow forum registration). If it can't find a matching e-mail address in the vB database it will create a new vB user with the first part of the clients e-mail address as the username. If a matching e-mail address is found then the vB user is linked to the corresponding WHMCS account. The sync tool will also automatically add the required column in the vBulletin database for associating clients. The manual account link tool is also finished, as is a "Trial Sync" feature which goes through the motions of syncing without actually making changes. This should be finished and ready to go within a day. 0 Quote Link to comment Share on other sites More sharing options...
DataHosts Posted July 24, 2008 Share Posted July 24, 2008 Look forward to seeing it as I am working on a loginshare for FusionBB and WHMCS 0 Quote Link to comment Share on other sites More sharing options...
Redundant Posted July 24, 2008 Share Posted July 24, 2008 Curious if either of you use Joomla and are going to tie it in as well? 0 Quote Link to comment Share on other sites More sharing options...
Troy Posted July 24, 2008 Share Posted July 24, 2008 I have thought about doing this myself, but since someone else is (yay!) let me suggest an option I would like to see: First and Last name used instead of first portion of email address as the vbulletin username. I'd just as soon have everyone use their real names on our forum, (well if and when we put a forum up, that is, which is if and when WHMCS integration becomes available.) 0 Quote Link to comment Share on other sites More sharing options...
rmccny Posted July 25, 2008 Author Share Posted July 25, 2008 Troy, excellent suggestion, and one I decided to take. I have added the ability to choose how usernames are generated in both the sync tool, and new user signup stage, as well as a few different ways to assemble the clients name into a username. I'm the the process of packaging the add-on at the moment. 0 Quote Link to comment Share on other sites More sharing options...
rmccny Posted July 26, 2008 Author Share Posted July 26, 2008 RC1 has been released! http://forum.whmcs.com/showthread.php?p=68864#post68864 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.