MyBB Community Forums

Full Version: Mark Forum As Read redirects to "You shouldn't be here"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Why does clicking the Mark Forums as Read button redirect me to a page that says "You shouldn't be here"?

http://mysticrp.us
Does it do this on the default theme?
(2016-02-22, 01:05 PM)Ben C Wrote: [ -> ]Does it do this on the default theme?



Yes
Hi,

This doesn't seem to be a core language entry (or in fact a string in any core files). Can you list your plugins?
(2016-02-22, 01:47 PM)Euan T Wrote: [ -> ]Hi,

This doesn't seem to be a core language entry (or in fact a string in any core files). Can you list your plugins?

[Image: c9257e6eb5.png]
(2016-02-22, 03:00 PM).m. Wrote: [ -> ]https://github.com/stewartiee/Steam-Open.../issues/25

I did add the API
It looks like a bug in the plugin to me. There's some dodgy logic going on, so I'm opening an issue. However, the author hasn't been active in a while and the plugin doesn't seem to be maintained anymore. Try changing the code found here: https://github.com/stewartiee/Steam-Open...n.php#L535 to the following:

function fix_steam_username()
{
    global $db, $mybb;
    if($mybb->input['action'] == '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)
            {
                require_once MYBB_ROOT.'inc/class_steam.php';
                // Create a new instance of the Steam class.
                $steam = new steam;
                // Grab a list of all users.
                $users_result = $db->simple_select("users", "uid, loginname", "");
                while($user = $db->fetch_array($users_result))
                {
                    $uid = $user['uid'];
                    $loginname = $user['loginname'];
                    if(is_numeric($uid) && (is_numeric($loginname) && strlen($loginname) == 17))
                    {
                        // Get the details of the user from their Steam ID.
                        $user_details = $steam->get_user_info($loginname);
                        // Get the persona from the Steam service.
                        $personaname = $user_details['personaname'];
                        // Create an array of data to update.
                        $update = array();
                        $update['loginname'] = $personaname;
                        // Run the update query.
                        $db->update_query('users', $update, "uid = '$uid'");
                    } // close if(is_numeric($uid) && (is_numeric($loginname) && strlen($loginname) == 17))
                } // close while($user = $db->fetch_array($users_result))
                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
        } else { // close if($mybb->user['uid'] > 0)
            die("You shouldn't be here...");
        } // close else
    }
} // close function

I haven't tested, but that should work.
(2016-02-22, 04:32 PM)Euan T Wrote: [ -> ]It looks like a bug in the plugin to me. There's some dodgy logic going on, so I'm opening an issue. However, the author hasn't been active in a while and the plugin doesn't seem to be maintained anymore. Try changing the code found here: https://github.com/stewartiee/Steam-Open...n.php#L535 to the following:

function fix_steam_username()
{
    global $db, $mybb;
    if($mybb->input['action'] == '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)
            {
                require_once MYBB_ROOT.'inc/class_steam.php';
                // Create a new instance of the Steam class.
                $steam = new steam;
                // Grab a list of all users.
                $users_result = $db->simple_select("users", "uid, loginname", "");
                while($user = $db->fetch_array($users_result))
                {
                    $uid = $user['uid'];
                    $loginname = $user['loginname'];
                    if(is_numeric($uid) && (is_numeric($loginname) && strlen($loginname) == 17))
                    {
                        // Get the details of the user from their Steam ID.
                        $user_details = $steam->get_user_info($loginname);
                        // Get the persona from the Steam service.
                        $personaname = $user_details['personaname'];
                        // Create an array of data to update.
                        $update = array();
                        $update['loginname'] = $personaname;
                        // Run the update query.
                        $db->update_query('users', $update, "uid = '$uid'");
                    } // close if(is_numeric($uid) && (is_numeric($loginname) && strlen($loginname) == 17))
                } // close while($user = $db->fetch_array($users_result))
                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
        } else { // close if($mybb->user['uid'] > 0)
            die("You shouldn't be here...");
        } // close else
    }
} // close function

I haven't tested, but that should work.


Thanks! It worked. Btw, what was wrong with it?
The order of the if statements was wrong. It hooks into the misc.php page for any action and if the user was logged in or couldn't access the ACP (not sure why those conditions, but I've kept them), it stopped execution. The change I provided makes this only happen on pages related to the plugin.