Kayako Loginshare Script - Includes Drupal, Interspire and Wordpress with more coming

Discussion in 'Using your helpdesk' started by BrettW, Nov 28, 2010.

  1. BrettW

    BrettW Member

    Hello!

    We have a small team that is working to integrate different systems. So far we have successfully integrated -

    Drupal
    Interspire Shopping Cart
    Magento
    WHMCS
    Wordpress

    with more coming soon.

    Working on next:
    vBulletin

    The project is located here - kayako-loginshare - Project Hosting on Google Code

    The license is MIT, so feel free to take what I have done and modify and use for your own needs. I would like to see the community take this project and modify it to include other systems. It would be nice to have a centralized project with multiple people working on the same thing.

    I am not the worlds best coder (possibly the worst), so you will not hurt my feelings if you tell me it is the worst POS ever written, but it does work. I wrote it to be VERY simple to follow, so anyone should be able to look at it and know what is going on. It is also modular, so it is VERY easy to add other systems. The hard part is understanding how other systems hash out their user passwords. Most are using salt, but all systems can be done. I was working on Joomla, but I was having a hard time understanding their salting hash, but I will get that soon.

    If you have a specific system that you want more than anything else, let me know and I will start working on what the community thinks it needs next.

    Download Script Directly

    If you have any questions, please feel free to ask.
  2. BrettW

    BrettW Member

    I just got WHMCS working with the API and have vBulletin mostly working. I will release the code in a little bit.
  3. indesigns

    indesigns Established Member

    Brent, there are some many people that are using kayako with whmcs. Check out the discussions here http://forums.kayako.com/f211/kayako-v4-whmcs-28190/.
  4. BrettW

    BrettW Member

    I have released the script that now features WHMCS as an option.

    See update above.
  5. danielgwood

    danielgwood Member

  6. George1710

    George1710 New Member

    Thanks for download link..
  7. silebis

    silebis Established Member

    Hi Brett i made function for Magento login into your auth script. Login from test.php is successfull, but when i login directly from kayako i get

    Code:
    [Warning]: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set (LoginShare/class.SWIFT_LoginShare.php:95)
    Did you meet with this?

    If you would i can commit my script into your repository.
  8. BrettW

    BrettW Member

    I will setup the repository over the next couple of days and allow people to commit to it. As for the error, I have not seen that before. Can you post what you have added in the auth.php file?
  9. silebis

    silebis Established Member

    hi my code is

    auth.php
    PHP:
    if ($system == 'magento') {
        
        
        
    $proxy = new SoapClient($magUrl);
        
    $sessionId $proxy->login($magUser$magKey);
         
         
        
    $result mysql_query("SELECT entity_id FROM mag_customer_entity WHERE email='$username' LIMIT 1");
        while(
    $row mysql_fetch_array($result)) {
            if(!empty(
    $row) ) {
                
    //var_dump($proxy->call($sessionId, 'customer.info', $row["entity_id"]));
                
                
    $results $proxy->call($sessionId'customer.info'$row["entity_id"]);
                
                
                list(
    $s,$salt) = explode(":",$results["password_hash"]);            
                
    $passhash md5($salt.$password).':'.$salt;
                
                if(
    $passhash === $results["password_hash"]) {
                    
                    
    $firstname $results["firstname"];
                    
    $lastname$results["lastname"];
                    
                    
    $fullname "$firstname" " "$lastname";
                    
    $email$results["email"];
                    
                    
                    
    $resultsA $proxy->call($sessionId'customer_address.info'$results["default_billing"]);
                    
    //var_dump($resultsA);
                    
    $phone$resultsA["telephone"];
                    
                    
    $authUser 'yes';
                } else {
                    
    $authUser 'no';
                }
            } else {
                
    $authUser 'no';
            }
        
        }
    }
  10. BrettW

    BrettW Member

    I wonder if the $sessionId is messing with something from the Kayako side. It could also be the SoapClient() function. I know your code is cleaner, but have you thought about using the database and pulling the data manually? I have not really looked at magento, but it may need to be done like that in order for there to not be any conflicts with kayako. I will look at the API docs later and see what I can come up with.

    I don't have time right now to download and install the app, but when I do, I will play around with it. I see no reason why that would not work.
  11. BrettW

    BrettW Member

    Jamie,

    If you happen to read this, can you tell us if session sharing is going to be available in the future? I would love for users to be able to login once and not have to worry about logging in again.

    I would also like to see kayako extended a bit to include address, city, state zip for indavidual users along with the ability to cross that information. It would also be nice to have the ability to cross data to custom fields as well.

    Just my thought.

    Thanks!
  12. BrettW

    BrettW Member

    I think I may have found the problem. I still have not tested this, but it might work.

    Look here - Magento - Wiki - Introduction

    I'm sure that is where you got the test script from. Have a look at the bottom on the script, you will see.
    PHP:
    // If you don't need the session anymore
    $client->endSession($session);
    Try implementing that and see if that fixes it.
  13. silebis

    silebis Established Member

    Hi Brett
    i test your suggestion but without success - same error. I think that error is in kayako app, because, when i set loginshare to blank script or script that returns only xml output, always gets same.

    quick question: what url you have in User Staff>Users LoginShare URL?
  14. BrettW

    BrettW Member

    I have http://www.domain.com/auth/auth.php

    It is in the root directory of my main domain.

    Also, can you tell me what version of kayako you are using?

    I am using 4.01.87 at the moment.

    Edit: Nevermind, I see it in your signature.
  15. silebis

    silebis Established Member

    ;-) upgraded to 4.01.91 with same
  16. BrettW

    BrettW Member

    What version of PHP are you running? Is the server running in safe mode?
  17. silebis

    silebis Established Member

  18. silebis

    silebis Established Member

    Hi all, solutions for curl bug is for file class.SWIFT_LoginShare.php before line 95 insert one if.

    PHP:
    if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off'))
    curl_setopt($_curlHandleCURLOPT_FOLLOWLOCATION1);
  19. MatiasCandy

    MatiasCandy New Member

    These are great but how do you see it if they are already logged into say vBulletin? I would like to have one single login once they come to the site.

    Is this possible?
  20. BrettW

    BrettW Member

    That is why I was asking Jamie about the session sharing. With the current system and API's, it is not possible.

Share This Page