Results 1 to 2 of 2

Thread: Fatal error: Call to undefined function GetUserIdForUserToken()

  1. #1
    Join Date
    Mar 2012

    Fatal error: Call to undefined function GetUserIdForUserToken()

    This is for a social login script from oneall.com I am at a loss.


    //Check if we have received a connection_token
    if ( ! empty ($_POST['connection_token']))
    //Get connection_token
    $token = $_POST['connection_token'];

    //Your Site Settings
    $site_subdomain = '';
    $site_public_key = '';
    $site_private_key = '';

    //API Access domain
    $site_domain = $site_subdomain.'.api.oneall.com';

    //Connection Resource
    $resource_uri = 'https://'.$site_domain.'/connections/'.$token .'.json';

    //Setup connection
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $resource_uri);
    curl_setopt($curl, CURLOPT_HEADER, 0);
    curl_setopt($curl, CURLOPT_USERPWD, $site_public_key . ":" . $site_private_key);
    curl_setopt($curl, CURLOPT_TIMEOUT, 15);
    curl_setopt($curl, CURLOPT_VERBOSE, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1);
    curl_setopt($curl, CURLOPT_FAILONERROR, 0);

    //Send request
    $result_json = curl_exec($curl);

    if ($result_json === false)
    //You may want to implement your custom error handling here
    echo 'Curl error: ' . curl_error($curl). '<br />';
    echo 'Curl info: ' . curl_getinfo($curl). '<br />';
    //Close connection

    $json = json_decode ($result_json);

    //Extract data
    $data = $json->response->result->data;

    //Check for plugin
    if ($data->plugin->key == 'social_login')
    //Operation successfull
    if ($data->plugin->data->status == 'success')
    //The token of the user that signed in/up using his social network account
    $user_token = $data->user->user_token;

    // 1] Check if you have a userID for this token in your database
    $user_id = GetUserIdForUserToken($user_token);

    // 2.1] If the userID is empty then this is the first time that this user signs in
    if ($user_id === null)
    // 2.1.1] Create a new account (optionally display a form to collect more data about the user).
    // Insert you proprietary account creation code here.

    // 2.1.2] Attach the user_token to the userID of the created account.
    LinkUserTokenToUserId ($user_token, $user_id);
    // 2.2] If you DO have an userID for the user_token then this is a returning visitor
    // 2.2.1] The account already exists

    // 3] You either created a new user or read the details of an existing user from your database
    // 3.1] Setup your session/cookies to login the user
    // 3.2] Forward the user to his account dashboard

  2. #2
    Join Date
    Dec 2005
    The error actually gives you everything you need to know. Take a look at this line:

    PHP Code:
    $user_id GetUserIdForUserToken($user_token); 
    See how it's calling a function named GetUserIdForUserToken()?

    There is no function named GetUserIdForUserToken() that's been declared anywhere in the script, hence the error:

    ...undefined function GetUserIdForUserToken()
    because the function GetUserIdForUserToken() is not defined.

    Does the script come with any other files that are supposed to be require()-d by this file? Perhaps files that contain functions named GetUserIdForUserToken()? If not, then there's nothing that can be done.
    I've switched careers...
    I'm NO LONGER a scientist,
    but now a web developer...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center