Skip to content
This repository has been archived by the owner on Mar 18, 2022. It is now read-only.

Commit

Permalink
Fixed missing action
Browse files Browse the repository at this point in the history
  • Loading branch information
stewartiee committed Jun 23, 2014
1 parent 73a56df commit 21860d7
Showing 1 changed file with 33 additions and 29 deletions.
62 changes: 33 additions & 29 deletions inc/plugins/steamlogin.php
Expand Up @@ -535,52 +535,56 @@ function fix_steam_username()
if($mybb->user['uid'] > 0 && $mybb->usergroup['cancp'])
{

$get_key = $db->fetch_array($db->simple_select("settings", "name, value", "name = 'steamlogin_api_key'"));

if($get_key['value'] != null)
if($mybb->input['action'] == 'fix_steam_username')
{
$get_key = $db->fetch_array($db->simple_select("settings", "name, value", "name = 'steamlogin_api_key'"));

require_once MYBB_ROOT.'inc/class_steam.php';
if($get_key['value'] != null)
{

// Create a new instance of the Steam class.
$steam = new steam;
require_once MYBB_ROOT.'inc/class_steam.php';

// Grab a list of all users.
$users_result = $db->simple_select("users", "uid, loginname", "");
// Create a new instance of the Steam class.
$steam = new steam;

while($user = $db->fetch_array($users_result))
{
// Grab a list of all users.
$users_result = $db->simple_select("users", "uid, loginname", "");

$uid = $user['uid'];
$loginname = $user['loginname'];

if(is_numeric($uid) && (is_numeric($loginname) && strlen($loginname) == 17))
while($user = $db->fetch_array($users_result))
{

// Get the details of the user from their Steam ID.
$user_details = $steam->get_user_info($loginname);
$uid = $user['uid'];
$loginname = $user['loginname'];

// Get the persona from the Steam service.
$personaname = $user_details['personaname'];
if(is_numeric($uid) && (is_numeric($loginname) && strlen($loginname) == 17))
{

// Create an array of data to update.
$update = array();
$update['loginname'] = $personaname;
// Get the details of the user from their Steam ID.
$user_details = $steam->get_user_info($loginname);

// Run the update query.
$db->update_query('users', $update, "uid = '$uid'");
// Get the persona from the Steam service.
$personaname = $user_details['personaname'];

} // close if(is_numeric($uid) && (is_numeric($loginname) && strlen($loginname) == 17))
// Create an array of data to update.
$update = array();
$update['loginname'] = $personaname;

} // close while($user = $db->fetch_array($users_result))
// Run the update query.
$db->update_query('users', $update, "uid = '$uid'");

die("<p>Any user(s) that were missing a Steam name will have now been updated.</p>");
} // close if(is_numeric($uid) && (is_numeric($loginname) && strlen($loginname) == 17))

} else { // close if(!is_null($get_key))
} // close while($user = $db->fetch_array($users_result))

die("<strong>Not Configured</strong> The Steam Login plugin hasn't been configured correctly. Please ensure an API key is set in the Configuration settings.");
die("<p>Any user(s) that were missing a Steam name will have now been updated.</p>");

} else { // close if(!is_null($get_key))

die("<strong>Not Configured</strong> The Steam Login plugin hasn't been configured correctly. Please ensure an API key is set in the Configuration settings.");

} // close else

} // close else
}

} else { // close if($mybb->user['uid'] > 0)

Expand Down

0 comments on commit 21860d7

Please sign in to comment.