[B]Posting for a friend, he was forced off the computer and begged me to get the ball rolling on this for him. I imagine he will jump in the thread tomorrow as soon as he is out of school.[/B]
When users try to merge there accounts w/ steam account, the following error is encountered:
[CODE]Fatal error: Call to undefined method Steam_ControllerPublic_Register::_associateExternalAccount() in /home/eviltoas/public_html/xenforo/library/Steam/ControllerPublic/Register.php on line 519
[/CODE]
Here is the code:
[CODE]<?php
class Steam_ControllerPublic_Register extends XFCP_Steam_ControllerPublic_Register {
const STEAM_LOGIN = 'https://steamcommunity.com/openid/login';
private $ch = null;
public function actionSteam() {
$assocUserId = $this->_input->filterSingle('assoc', XenForo_Input::UINT);
$redirect = $this->_input->filterSingle('redirect', XenForo_Input::STRING);
$session = XenForo_Application::get('session');
if($this->_input->filterSingle('reg', XenForo_Input::UINT)) {
return $this->responseRedirect(
XenForo_ControllerResponse_Redirect::SUCCESS,
$this->_genUrl()
);
}
// Validate Response
$id = $this->_validate();
if(empty($id)) {
return $this->responseError('Error during authentication. Please try again.');
}
$session->set('steam_id', $id);
$userModel = $this->_getUserModel();
$userExternalModel = $this->_getUserExternalModel();
$stAssoc = $userExternalModel->getExternalAuthAssociation('steam', $id);
if($stAssoc && $userModel->getUserById($stAssoc['user_id'])) {
XenForo_Application::get('session')->changeUserId($stAssoc['user_id']);
XenForo_Visitor::setup($stAssoc['user_id']);
/* Cookies */
$userModel->setUserRememberCookie($stAssoc['user_id']);
return $this->responseRedirect(
XenForo_ControllerResponse_Redirect::SUCCESS,
$this->getDynamicRedirect(false, false)
);
}
$existingUser = false;
if(XenForo_Visitor::getUserId()) {
$existingUser = XenForo_Visitor::getInstance();
} else if($assocUserId) {
$existingUser = $userModel->getUserById($assocUserId);
}
if($existingUser) {
// must associate: matching user
return $this->responseView('XenForo_ViewPublic_Register_Steam', 'register_steam', array(
'associateOnly' => true,
'existingUser' => $existingUser,
'redirect' => $redirect
));
}
if(!XenForo_Application::get('options')->get('registrationSetup', 'enabled')) {
$this->_assertRegistrationActive();
}
$username = "";
//$xml = simplexml_load_file("http://steamcommunity.com/profiles/{$id}/?xml=1");
$options = XenForo_Application::get('options');
$steamapikey = $options->steamAPIKey;
if(empty($steamapikey)) {
return $this->responseError('Missing API Key for Steam Authentication. Please contact the forum administrator with this error.');
}
if((function_exists('curl_version')) && !ini_get('safe_mode') && !ini_get('open_basedir'))
{
$this->ch = curl_init("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={$steamapikey}&steamids={$id}");
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->ch, CURLOPT_TIMEOUT, 6);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, TRUE);
//curl_setopt($this->ch, CURLOPT_URL, "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={$steamapikey}&steamids={$id}");
ob_start();
$json_object = curl_exec($this->ch);
echo $json_object;
$json_object = ob_get_clean();
$json_object = trim($json_object);
curl_close( $this->ch );
if (strpos($json_object,'response:') !== false) {
$i = 0;
while (($i < 3) || ((strpos($json_object,'response:') !== false))) {
$this->ch = curl_init("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={$steamapikey}&steamids={$id}");
//curl_setopt($this->ch, CURLOPT_URL, "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={$steamapikey}&steamids={$id}");
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->ch, CURLOPT_TIMEOUT, 6);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, TRUE);
ob_start();
$json_object = curl_exec($this->ch);
echo $json_object;
$json_object = ob_get_clean();
$json_object = trim($json_object);
$i++;
sleep(3);
curl_close( $this->ch );
}
}
}
else
{
$json_object=file_get_contents("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={$steamapikey}&steamids={$id}");
if ($json_object === false) {
$i = 0;
while ($json_object === false && $i < 2) {
$json_object = file_get_contents("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={$steamapikey}&steamids={$id}" );
$i++;
sleep(1);
}
}
}
$json_decoded = json_decode($json_object);
if(empty($json_decoded)) {
return $this->responseError('Problem communicating with Steam Community. Please try your registration again.');
}
if(!empty($json_decoded)) {
$username = $json_decoded->response->players[0]->personaname;
if (!isset($json_decoded->response->players[0]->loccountrycode))
{
$location = 'Parts Unknown';
}
if (isset($json_decoded->response->players[0]->loccountrycode))
{
$location = $json_decoded->response->players[0]->loccountrycode;
switch($location){
case "AF": $location = "Afghanistan"; break;
case "AL": $location = "Albania"; break;
case "DZ": $location = "Algeria"; break;
case "AD": $location = "Andorra"; break;
case "AO": $location = "Angola"; break;
case "AG": $location = "Antigua and Barbuda"; break;
case "AR": $location = "Argentina"; break;
case "AM": $location = "Armenia"; break;
case "AU": $location = "Australia"; break;
case "AT": $location = "Austria"; break;
case "AZ": $location = "Azerbaijan"; break;
case "BS": $location = "The Bahamas"; break;
case "BH": $location = "Bahrain"; break;
case "BD": $location = "Bangladesh"; break;
case "BB": $location = "Barbados"; break;
case "BY": $location = "Belarus"; break;
case "BE": $location = "Belgium"; break;
case "BZ": $location = "Belize"; break;
case "BJ": $location = "Benin"; break;
case "BT": $location = "Bhutan"; break;
case "BO": $location = "Bolivia"; break;
case "BA": $location = "Bosnia and Herzegovina"; break;
case "BW": $location = "Botswana"; break;
case "BR": $location = "Brazil"; break;
case "BN": $location = "Brunei"; break;
case "BG": $location = "Bulgaria"; break;
case "BF": $location = "Burkina Faso"; break;
case "BI": $location = "Burundi"; break;
case "KH": $location = "Cambodia"; break;
case "CM": $location = "Cameroon"; break;
case "CA": $location = "Canada"; break;
case "CV": $location = "Cape Verde"; break;
case "CF": $location = "Central African Republic"; break;
case "TD": $location = "Chad"; break;
case "CL": $location = "Chile"; break;
case "CN": $location = "China"; break;
case "CO": $location = "Colombia"; break;
case "KM": $location = "Comoros"; break;
case "CG": $location = "Congo, Republic of the"; break;
case "CD": $location = "Congo, Democratic Republic of the"; break;
case "CR": $location = "Costa Rica"; break;
case "CI": $location = "Cote d'Ivoire"; break;
case "HR": $location = "Croatia"; break;
case "CU": $location = "Cuba"; break;
case "CY": $location = "Cyprus"; break;
case "CZ": $location = "Czech Republic"; break;
case "DK": $location = "Denmark"; break;
case "DJ": $location = "Djibouti"; break;
case "DM": $location = "Dominica"; break;
case "DO": $location = "Dominican Republic"; break;
case "TL": $location = "Timor-Leste"; break;
case "EC": $location = "Ecuador"; break;
case "EG": $location = "Egypt"; break;
case "SV": $location = "El Salvador"; break;
case "GQ": $location = "Equatorial Guinea"; break;
case "ER": $location = "Eritrea"; break;
case "EE": $location = "Estonia"; break;
case "ET": $location = "Ethiopia"; break;
case "FJ": $location = "Fiji"; break;
case "FI": $location = "Finland"; break;
case "FR": $location = "France"; break;
case "GA": $location = "Gabon"; break;
case "GM": $location = "Gambia"; break;
case "GE": $location = "Georgia"; break;
case "DE": $location = "Germany"; break;
case "GH": $location = "Ghana"; break;
case "GR": $location = "Greece"; break;
case "GD": $location = "Grenada"; break;
case "GT": $location = "Guatemala"; break;
case "GN": $location = "Guinea"; break;
case "GW": $location = "Guinea-Bissau"; break;
case "GY": $location = "Guyana"; break;
case "HT": $location = "Haiti"; break;
case "HN": $location = "Honduras"; break;
case "HU": $location = "Hungary"; break;
case "IS": $location = "Iceland"; break;
case "IN": $location = "India"; break;
case "ID": $
[/CODE]
Sorry if Steam chat cut off any code and lastly, I was supposed to include that the dev does not currently support the code.
Thanks for your time,
Borst as surrogate for Peg
Forced off the computer? Are you like, 12?
And we need the entire file to help you.
Fatal error: Call to undefined method.
Your method isn't defined, this means the file that contains it is not included in your program.
Or it's badly spelled, it's a massive clunky method name so idk.
[editline]20th May 2014[/editline]
also why do this
[code]
switch($location){
case "AF": $location = "Afghanistan"; break;
case "AL": $location = "Albania"; break;
case "DZ": $location = "Algeria"; break;
case "AD": $location = "Andorra"; break;
case "AO": $location = "Angola"; break;
case "AG": $location = "Antigua and Barbuda"; break;
case "AR": $location = "Argentina"; break;
case "AM": $location = "Armenia"; break;
case "AU": $location = "Australia"; break;
case "AT": $location = "Austria"; break;
case "AZ": $location = "Azerbaijan"; break;
case "BS": $location = "The Bahamas"; break;
case "BH": $location = "Bahrain"; break;
case "BD": $location = "Bangladesh"; break;
case "BB": $location = "Barbados"; break;
case "BY": $location = "Belarus"; break;
case "BE": $location = "Belgium"; break;
case "BZ": $location = "Belize"; break;
case "BJ": $location = "Benin"; break;
case "BT": $location = "Bhutan"; break;
case "BO": $location = "Bolivia"; break;
case "BA": $location = "Bosnia and Herzegovina"; break;
case "BW": $location = "Botswana"; break;
case "BR": $location = "Brazil"; break;
case "BN": $location = "Brunei"; break;
[/code]
when you could just do this:
$locs = array("BO" => "Belgium");
if (isset($locs[$[$location]])
$location = $locs[$[$location]];
No, i'm not 12, my computer was overcome by aliens. In response to kebab, i did not write this code and i would have asked the developer to fix it but he has dis-continued the code on github.
[QUOTE=MrPegifile;44868482]No, i'm not 12, my computer was overcome by aliens. In response to kebab, i did not write this code and i would have asked the developer to fix it but he has dis-continued the code on github.[/QUOTE]
Then use a maintained one (like [URL="http://xenforo.com/community/threads/steam-community-openid-login.18958/"]this[/URL])?
is that maintained? last post on that thread was 2 years ago
[editline]21st May 2014[/editline]
this thread looks active
[url]http://xenforo.com/community/threads/steam-authentication-integration.42694/page-35[/url]
it looks like the same plugin you're using
[url]http://xenforo.com/community/resources/steam-authentication-integration.1336/[/url]
Sorry, you need to Log In to post a reply to this thread.