View Single Post
durangod
Senior Member
Join Date: Mar 2016
Location: SW USA
Old 03-11-2016 , 20:15   Re: [RELEASE] SourceBans++ (v1.5.4.2) [Updated: 2016-03-09]
#616

Ok folks here is the Mod for Steam Login:

Name: Steam Login Option Mod

What does it do: It allows admin to select weather to show or not to show the steam login link on the login form. This is done by means of selection the option in admin panel - web panel settings - features. If the item is checked the steam signon will show, if it is not checked it will not. And the steam page has been locked down from direct public execution only while the selection is off.

See the image attached to show you the location of the new item setting.

Be sure you always use ONLY either notepad, programmers notepad, or notepad++ to edit code files. Normal word processing software's have hidden codes which will mess up your code files.

Of course the dev of this plugin is welcome to add this to the core production release if they choose.
I have included the zip file with the files you need. Please refer to the files for changes even though i will go over this below in detail. Also remember that all mods will be removed whenever you update the main plugin and the mods will have to be replaced.

Ok lets go:

Lets do the template files first.

Open themes/<theme name>/page_admin_settings_features.tpl

Code:
<!-- added for steam login option mod -->
  <tr>
   <td valign="top"><div class="rowdesc">{help_icon title="Enable Steam Login" message="Check this box, if you want to enable the Steam login button on the login form."}Enable Steam Login</div></td>
      <td>
       <div align="left">
          <input type="checkbox" name="enable_steamlogin" id="enable_steamlogin" />
       </div>
       <div id="enable_steamlogin.msg" class="badentry"></div>
      </td>
  </tr>
<!-- end steam login option mod -->
open themes/<theme_name>/page_login.tpl

This is for the default theme - the others original codes are a bit different so watch carefully and do not replace those with this new code, it will require you to mod it a bit or use part of the old code.

old code
Code:
<center><a href="steamopenid.php"><img src="images/steamlogin.png"></a></center>
new code

Code:
 -{if $steamlogin_show == 1}-
<center><a href="steamopenid.php"><img src="images/steamlogin.png"></a></center>
-{/if}-
open pages/admin.settings.php
3 changes in this file

PHP Code:
//added for steam login option mod

   
$steamloginopt = (isset($_POST['enable_steamlogin']) && $_POST['enable_steamlogin'] == "on" 0);

// end steam login option mod 
you dont have to copy the //NEW CODE that is just for your reference
however do include the //modified comment above your change

PHP Code:
//modified for steam login option mod
//ORIGINAL CODE
(" . (int)$adminrehash . "'config.enableadminrehashing')");

//NEW CODE 
(" 
. (int)$adminrehash ", 'config.enableadminrehashing'),
(" 
. (int)$steamloginopt ", 'config.enablesteamlogin')"); 
now all the way toward the bottom of the file is this last addition

PHP Code:

/* added for steam login option mod */
$('enable_steamlogin').checked = <?php echo $GLOBALS['config']['config.enablesteamlogin']?>;
/* end steam login option mod */


Open pages/page.login.php

Right BEFORE This Code:

PHP Code:

$theme
->assign('redir'"DoLogin('".(isset($_SESSION['q'])?$_SESSION['q']:'')."');"); 
Add this NEW CODE:

PHP Code:

//added for steam login option mod

$steam_conf_value get_steamenabled_conf($confvalue);

$theme->assign('steamlogin_show',  $steam_conf_value);

//end steam login option mod 


open includes/user-functions.php


PHP Code:

/**
 * added for the steam login option mod
 * checks the value of the config setting
 * called by  steamopenid.php 
 * called by pages/pages.login.php
 * @param int 1 or 0
 * @return int 
 */
function get_steamenabled_conf($value)
{
 
$settingvalue "config.enablesteamlogin";
 
$query $GLOBALS['db']->GetRow("SELECT `value` FROM `" DB_PREFIX "_settings` WHERE `setting` = '$settingvalue'");
 
$value intval($query['value']);
return 
$value;

open steamopenid.php
two additions in this file

PHP Code:
// added for steam login option mod
include_once('includes/user-functions.php');

$steam_conf_value get_steamenabled_conf($confvalue);

if(
$steam_conf_value 0)
{
//end steam login option mod 
all the way to the bottom of the file

PHP Code:
//added for steam login option mod
//else if the steam config is 0
}else{
       
header("location: ./");
       exit;
      }
//close else 
//end steam login option mod 
Database

manual insert into sb_settings
setting = config.enablesteamlogin
value = 1

or run this sql (fill in your db info in the sql

INSERT INTO `YOURDBPREFIX_YOURDBNAME`.`sb_settings` (`setting`, `value`) VALUES ('config.enablesteamlogin', '1');

refresh your cache from admin and your all set, try it out and let me know if you have any issues.

Thanks dave

attached files

features_ss.jpg (shows the new feature item in settings)

steam_signon_mod.zip (modified files)
Attached Images
File Type: jpg features_ss.jpg (33.8 KB, 219 views)
Attached Files
File Type: zip steam_signon_mod.zip (11.3 KB, 139 views)
__________________
Freedom is never free!

Last edited by durangod; 02-09-2017 at 19:11. Reason: spelling and clarifications
durangod is offline