Toksta Chat - Need help to intergrate with Elgg

Hi, i have been trying to set up Toksta Chat to work with my Elgg 1.0 site but have had no luck so far.

I have tried placing the two scripts in the footer.php, and although  the chat bar and "start chat" link are visible, the script is not recognizing the user / friends etc....and also confused how to set this to work for logged in users only.

I have pasted the two scripts below

 area of your source code, transferring necessary user data
//place this script on every page if the user is logged in !!!

$tk_name = "THE_USERNAME"; //<-- please set the username here
$tk_user_id = "THE_USER_ID"; //<-- please set the user ID here
$tk_gender = ""; //<-- optional (the gender of the user can be female or 'male')
$tk_age = ""; //<-- optional (the age of the user e.g. '23')
$tk_single = ""; //<-- optional (is the user single? 'Yes', 'no', '0' = no information)
$tk_profile_url = ""; //<-- optional (url to the users profile)
$tk_pic = ""; //<-- optional (url of the users picture)
$tk_city = ""; //<-- optional (city where the user is located, e.g. 'Berlin')
$tk_zip = ""; //<-- optional (users zip code, e.g. '92553')
$tk_country = ""; //<-- optional (country where the user is located, e.g. 'Germany')

//DO NOT EDIT THE FOLLOWING CODE!
$tk_user_data="name:".$tk_name. ";gender:".$tk_gender. ";age:".$tk_age. ";single:".$tk_single. ";url:".$tk_profile_url. ";pic:".$tk_pic. ";city:".$tk_city. ";tk_zip:".$tk_zip. ";country:".$tk_country;


//implements the js needed by the chatWatcher and to start a chat

$tk_hash = md5($tk_user_id.$tk_user_data."Nkk6uLcrMDGmB5SmJfBs");
$tk_js = "";
echo $tk_js; 
 Chatten";
echo $tk_link;
?> 

Can anyone help with this?

Diane

  • can someone try to explain to me why this script doesn't work?...it seems correct or not!?!!?

    i want  to understand how use this $ for future porpuose:

    i try in this way, but nothing:

     $user_name = $_SESSION['user']->username;   
     $user_guid = $_SESSION['user']->getGUID;


    $tk_name = "$user_name"; //<-- please set the username here
    $tk_user_id = "$user_guid"; //<-- please set the user ID here

     

     

    $owner = $vars['entity']->owner_guid;

    $tk_chat_to_user_id = $owner ; //Replace with user ID
    $tk_link = "<a href=\"javascript:tokstaChat('" . $tk_chat_to_user_id . "')\">Chatta</a>";
    echo $tk_link;

  • I placed mine in the spotlight area of the new theme. :-)

    here is the code I used. Works great, not sure I like the pop up ads. Hope it helps.

     

    <?PHP
    //script for the <BODY> area of your source code, transferring necessary user data
    //place this script on every page if the user is logged in !!!
    $tk_name = $_SESSION['user']->username; //<-- please set the username here
    $tk_user_id = $_SESSION['user']->getGUID(); //<-- please set the user ID here
    $tk_gender = ""; //<-- optional (the gender of the user can be female or 'male')
    $tk_age = ""; //<-- optional (the age of the user e.g. '23')
    $tk_single = ""; //<-- optional (is the user single? 'Yes', 'no', '0' = no information)
    $tk_profile_url = ""; //<-- optional (url to the users profile)
    $tk_pic = ""; //<-- optional (url of the users picture)
    $tk_city = ""; //<-- optional (city where the user is located, e.g. 'Berlin')
    $tk_zip = ""; //<-- optional (users zip code, e.g. '92553')
    $tk_country = ""; //<-- optional (country where the user is located, e.g. 'Germany')

    //DO NOT EDIT THE FOLLOWING CODE!
    $tk_user_data="name:".$tk_name. ";gender:".$tk_gender. ";age:".$tk_age. ";single:".$tk_single. ";url:".$tk_profile_url. ";pic:".$tk_pic. ";city:".$tk_city. ";tk_zip:".$tk_zip. ";country:".$tk_country;


    //implements the js needed by the chatWatcher and to start a chat

    $tk_hash = md5($tk_user_id.$tk_user_data."YOURINFOHERE");
    $tk_js = "<script type='text/javascript' src='http://www.toksta.com/js/w/?tk_hash=" . $tk_hash . "&amp;app_id=340534&amp;app_user_id=".$tk_user_id."&amp;tk_user_data=".rawurlencode($tk_user_data)."'></script>";
    echo $tk_js;
    ?>

                 <?php
    $tk_chat_to_user_id = page_owner_entity()->guid; //Replace with user ID
    $tk_link = "<a href=\"javascript:tokstaChat('" . $tk_chat_to_user_id . "')\">Chat with owner of this page</a>";
    echo $tk_link;
    ?>

     

  • @Brucepro

    Thank you for your help, i now have Toksta chat working with Elgg!!!

    :)

  • This was fun to add.:-)

     

    $tk_profile_url = $vars['url'] . "pg/profile/" . $tk_name . ""; //<-- optional (url to the users profile)
    $tk_pic = $_SESSION['user']->getIcon('small');//<-- optional (url of the users picture)

  • very very thanks Brucepro!!!!

    now it works also for me. i wrote  getGUID  without "( )"...

    for $tk_gender ? .....elgg profile missing about gender.... and with new profile builder isn't possible to have a checkbox for female male...

    byebye

     

  • Yes this works great but what would be even better is if it were added as a pluggin so that "chat now" or whatever showed up as an option when clicking on a members thumbnail. The same as "Add friend" and "Profile" currently does.

  • i can't get picture work:

    $tk_pic = $_SESSION['user']->getIcon('small');//<-- optional (url of the users picture)

    do you have the same problem?

  • For adding 'chat now' in the thumbnails menu, add in links.php :

        <p class="user_menu_friends_of">
            <?php
                $tk_chat_to_user_id = $vars['entity']->guid; //Replace with user ID
                $tk_link = "<a href=\"javascript:tokstaChat('" . $tk_chat_to_user_id . "')\">Chat Now</a>";
                echo $tk_link;
            ?>   
        </p>

  • Hej!

    Anynews of a plugin that does all of the above.

    how much money would it take to get one done???

     

     

  • Can't get the profile picture working, any solutions?