View Full Version : Login Panel - Modiifcation
jennec
08-01-2005, 09:08 PM
Hi guys, would someone be able to help me out here.
I would like to include an IF statement in the Login_Panel to provide a section with links for users after they have logged in. Specifically I would like to provide links for administrative features to members of the Moderators and Admins groups (i.e. to the control panel of SD and my forum, knowledbase etc).
I will be running SD2.1 by next week, not sure if this would make any difference in code, table structures etc.
I know what I am asking for probably sounds really easy to some of you, its just I have no idea about php syntax or SD table structures.
Tomato_Dance provided a solution for this in SD1.15 but since SD2 was published it does not work and the issues he is having with his site has proved to be a distraction for him. Won't hold it against him though.
Stelly
08-02-2005, 07:14 AM
Yer I was going to have a look into this for you... see if and how it can be done :)
Can you provide a graphical representation of what you want? done in some kind of photo editting software?
Stelly
jennec
08-02-2005, 08:39 AM
Originally posted by Stelly@Aug 2 2005, 08:14 AM
Yer I was going to have a look into this for you... see if and how it can be done :)
Can you provide a graphical representation of what you want? done in some kind of photo editting software?
Stelly
187
Difficult to do at the mo as am at work. but currently I have this type of layout for my logon panel (see attachment).
As you can see I have moved the to the side of the avatar and added icons. What I want to be able to do is to below the avatar and these default options, have a break and then an if statement that would inset a heading called "Admin" and below this icons and links appear in the same format as my login panel. These links would be to the SD Control panel, my knowledge Base Admin Console, Forum Admin console etc.
I would also like to repeat this for Moderators, so that when a moderator logs in they get a header called "Moderator" and Icons for their control panel and other functions specifically for them.
The lay out of the icons etc is the simple part for me, its just the syntax needed for the IF Statement. I.E. if member of "Administrators then . . .
When I get a chance I will provide a series of images, if you need them, to show you what I mean.
Stelly
08-02-2005, 09:43 AM
sounds ok to me... will look into it for you
Tomatos
08-02-2005, 12:48 PM
Here's what I used to provide a link on the Q&A plugin. This link shows only for the admin.
if(in_array(688, $userinfo['pluginadminids']))
*{
* *echo '<tr>
* * * * * * *<td *valign="top" style="padding-right: 10px; padding-bottom: 5px;"><a href="' . RewriteLink('index.php?categoryid=' . $categoryid . '&p688_action=adminanswer') . '">' . $language['answer_question'] . '</a>
* * * * * * *</td>
* * * * </tr>';
* }
*else
*{
* *echo' <hr /> <br />';
*}
It basicly says. If the user has permission to admin the plugin #688 then echo the following, else echo the other.
jennec
08-02-2005, 02:15 PM
I presume that this section would be able to be modified to be a little more general, rather than plugin specific.
if(in_array(688, $userinfo['pluginadminids']))
Which version of SD were you using this on? The code I had stopped working when SD 2 came out. I have managed to loose this code now since upgrading a few times.
Bear in mind that I do not know how to code, but rather I pick things up as I go and try it out. Some times for hours before stumbling on the answer.
Tomatos
08-02-2005, 03:42 PM
Originally posted by jennec@Aug 2 2005, 07:15 AM
I presume that this section would be able to be modified to be a little more general, rather than plugin specific.
if(in_array(688, $userinfo['pluginadminids']))
Which version of SD were you using this on?* The code I had stopped working when SD 2 came out.* I have managed to loose this code now since upgrading a few times.
Bear in mind that I do not know how to code, but rather I pick things up as I go and try it out.* Some times for hours before stumbling on the answer.
202
It should have worked on 2. I haven't tried it on 2.2 yet.
jennec
08-02-2005, 04:54 PM
I found the code I used to use.
* * // Start Code to show link to Admin Controls section if the user is an admin.
* * // Is user admin?
*
*//Get User Session ID for Forum Admin Link
*
* * if($_SESSION['sdusername'] = $DB->query_first("SELECT username FROM " . TABLE_PREFIX . "userprivileges WHERE username = '" . $_SESSION['sdusername'] . "' AND privilegetype = 'Administrator'"))
* * {
* * * * echo '<tr>
* * * * * * * *<td align="center" ><a href="admin/"><img src="Images/icons/controlpanel.gif"/></div>Control Panel</a></div></td>
* *</tr>
* * *<tr>
* * * * * * * *<td align="center" ><a href="kb/admin"><img src="Images/icons/kbadmin.gif"/></div>KB Admin</a></div><td>
* * * * * * </tr>
* * *<tr>
* * * * * * * *<td align="center" ><a href="livehelp/admin"><img src="Images/icons/helpballon.gif"/></div>LiveHelp Admin</a></div><td>
* * * * * * * <tr>
* * *'; * function ForumAdminLinkID()
* * {
* * * *global $session_id;
* * * *$forumadmin = '<td align="center" ><a href="bb/admin/index.php?sid=' . $session_id . '"><img src="Images/icons/phpbb.gif"/></div>Forum Admin</a></div><td>';
* *
* * echo $forumadmin;
*
*}
* * ForumAdminLinkID();'
* *</tr>';
* * * * *
* * } // End: if($_SESSION['sdusername'] = $DB->query_first("SELECT username FROM " . TABLE_PREFIX . "userprivileges WHERE username = '" . $_SESSION['sdusername'] . "' AND privilegetype = 'Administrator'"))
* * // End Code to show link to Admin section if the user is an admin.
I believe that this section is the part that eeds to be modified as the table layouts etc changed from SD 1.15 to 2.
if($_SESSION['sdusername'] = $DB->query_first("SELECT username FROM " . TABLE_PREFIX . "userprivileges WHERE username = '" . $_SESSION['sdusername'] . "' AND privilegetype = 'Administrator'"))
I just don't know what to change.
Stelly
08-03-2005, 12:09 PM
have you two got it sorted? I was going to have a look at it... but let me know pls...
Stelly
All session variables were replaced with a global $userinfo structure when 2.0 was released. So $_SESSION['sdusername'] should be replaced with $userinfo['username']
jennec
08-03-2005, 01:03 PM
Spib, when I do that and change the code to
// Start Code to show link to Admin Controls section if the user is an admin.
* *// Is user admin?
//Get User Session ID for Forum Admin Link
* *if($userinfo['username'] = $DB->query_first("SELECT username FROM " . TABLE_PREFIX . "userprivileges WHERE username = '" . $userinfo['username'] . "' AND privilegetype = 'Administrator'"))
* *{
* * * *echo '<tr>
* * * * * * * <td align="center" ><a href="admin/"><img src="Images/icons/controlpanel.gif"/></div>Control Panel</a></div></td>
* </tr>
* * <tr>
* * * * * * * <td align="center" ><a href="kb/admin"><img src="Images/icons/kbadmin.gif"/></div>KB Admin</a></div><td>
* * * * * *</tr>
* * <tr>
* * * * * * * <td align="center" ><a href="livehelp/admin"><img src="Images/icons/helpballon.gif"/></div>LiveHelp Admin</a></div><td>
* * * * * * *<tr>
* * '; * function ForumAdminLinkID()
* *{
* * * global $session_id;
* * * $forumadmin = '<td align="center" ><a href="bb/admin/index.php?sid=' . $session_id . '"><img src="Images/icons/phpbb.gif"/></div>Forum Admin</a></div><td>';
* *
* *echo $forumadmin;
}
* *ForumAdminLinkID();'
* </tr>';
* * * *
* *}
// End: if($userinfo['username'] = $DB->query_first("SELECT username FROM " . TABLE_PREFIX . "userprivileges WHERE username = '" . $userinfo['username'] . "' AND privilegetype = 'Administrator'"))
// End Code to show link to Admin section if the user is an admin
I get the following error.
Invalid SQL: SELECT username FROM sd_userprivileges WHERE username = 'jennec' AND privilegetype = 'Administrator'
Error: Table 'subdream.sd_userprivileges' doesn't exist
Error number: 1146
Date: Wednesday 03rd of August 2005 01:00:34 PM
So have the names of the tables changed aswell?
I must admin I didn't read your whole post before so I didn't know that you only wanted to see if the current user was an admin. Here's the correct code to check if the current user is an admin
if($userinfo['adminaccess'] == 1)
{
*echo 'user is an admin';
}
jennec
08-03-2005, 01:24 PM
Originally posted by spib@Aug 3 2005, 02:20 PM
I must admin I didn't read your whole post before so I didn't know that you only wanted to see if the current user was an admin. Here's the correct code to check if the current user is an admin
if($userinfo['adminaccess'] == 1)
{
*echo 'user is an admin';
}
254
Now that was the final peice of my puzzle. All working now.
Thanks to all for all your help.
abcohen
08-03-2005, 03:21 PM
Originally posted by jennec@Aug 3 2005, 09:24 AM
Now that was the final peice of my puzzle.* All working now.*
Thanks to all for all your help.
255
Want to post the final code so others can mod their login panel.
Stelly
08-03-2005, 03:24 PM
yes please post it all to help out the subdreamer community
Stelly
jennec
08-03-2005, 04:41 PM
*****Updated 21 November 2006 to reflect changes in SD 2.4*****
Open file www.yoursite.com/plugins/P10_mi_loginPanel/loginpanel.php (http://www.yoursite.com/plugins/P10_mi_loginPanel/loginpanel.php)
On line 33 of subdreamer v 2.4 loginpanel.php replace
// $cppath has already gone through rewritelink (or $sdurl added) in the integration files
$myaccount = '<a href="' . $cppath . '">' . $language['my_account'] . '</a>';
if($usersystem)
{
if($userinfo['loggedin'])
{
echo '<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>' . $language['welcome_back'] . ' ' . $userinfo['username'] . '</td>
</tr>';
if(isset($avatar))
{
echo '<tr>
<td><br />' . $avatar . '</td>
</tr>';
}
echo '<tr>
<td><br />'.iif(strlen($cppath) > 0, $myaccount, '').'</td>
</tr>';
if($settings['Display Admin Link'] &&
($userinfo['adminaccess'] ||
count($userinfo['pluginadminids']) > 0 ||
count($userinfo['custompluginadminids']) > 0))
{
echo '<tr>
<td><a href="' . RewriteLink(ADMIN_PATH . '/index.php') . '">' . $language['admin_panel'] . '</a></td>
</tr>';
}
echo '<tr>
<td><a href="' . RewriteLink('index.php?categoryid=' . $categoryid . '&logout=1') . '">' . $language['logout'] . '</a></td>
</tr>';
if($settings['Show PMs'] == 1)
{
echo '<tr>
<td><br/>';
require('./plugins/p10_mi_loginpanel/pminfo.php');
echo ' </td>
</tr>';
}
echo '</table>';
}
else
with
// $cppath has already gone through rewritelink (or $sdurl added) in the integration files
$myaccount = '<a href="' . $cppath . '"><img src="IMAGE HERE"/><br/>' . $language['my_account'] . '</a>';
if($usersystem)
{
if($userinfo['loggedin'])
{
echo '<table border="0" cellspacing="0" cellpadding="0" align="Center">
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td colspan="3"><div align="center"><strong>' . $language['welcome_back'] . ' ' . $usersystem['username'] . '</strong></div></br></td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>';
if(isset($avatar))
{
echo '<tr align="Center" valign="Center">
<td align="Center" valign="Center"><div align="center" valign="Center">' . $avatar . '</div></td>';
}
echo '<tr align="Center" valign="Center">
<td align="Center" valign="Center"><div align="center" valign="Center"></div></td>
<td width="10%"></td>
<td align="center"><div align="center">'.iif(isset($cppath), $myaccount, '').'<br /><br/><a href="' . RewriteLink('index.php?categoryid=' . $categoryid . '&logout=1') . '"><img src="images/icons/logouttrans.gif"/><br/>' . $language['logout'] . '</a></div></td>
</tr>';
if($settings['Display Admin Link'] &&
($userinfo['adminaccess'] ||
count($userinfo['pluginadminids']) > 0 ||
count($userinfo['custompluginadminids']) > 0))
{
echo '<tr>
<td colspan="3"><div align="center"> </td>
</tr>
<tr>
<td colspan="3"><div align="center"><strong>Administrators Options</strong></div></td>
</tr>
<tr>
<td colspan="3"><div align="center"> </td>
</tr>
<tr>
<td width="45%"><div align="Center"><a href="LINK HERE" target="_blank"><img src="IMAGE HERE"/></a></div></td>
<td width="10%"> </td>
<td align="Center" width="45%"><div align="Center"><a href="LINK HERE"><img src="IMAGE HERE"/></a></div></td>
</tr>
<tr>
<td align="Center"><div align="Center"><a href="LINK HERE" target="_blank">LINK NAME HERE</a></div></td>
<td width="10%"> </td>
<td align="Center"><div align="Center"><a href="LINK HERE" >LINK NAME HERE</a></div></td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td width="45%"><div align="Center"><a href="LINK HERE" target="_blank"><img src="IMAGE HERE"/></a></div></td>
<td width="10%"> </td>
<td align="Center" width="45%"><div align="Center"><a href="LINK HERE"><img src="IMAGE HERE"/></a></div></td>
</tr>
<tr>
<td align="Center"><div align="Center"><a href="LINK HERE" target="_blank">LINK NAME HERE</a></div></td>
<td width="10%"> </td>
<td align="Center"><div align="Center"><a href="LINK HERE" >LINK NAME HERE</a></div></td>
</tr>
';
}
if($settings['Show PMs'] == 1)
{
echo '<tr>
<td colspan="3" align="center"><br/>';
require('./plugins/p10_mi_loginpanel/pminfo.php');
echo ' </td>
</tr>';
}
echo '</table>';
}
else
You can add any table structure you like, but it is generally best to contiue the structure that is already in place.
Below is the modified Subdreamer v2.4 loginpanel.php code, which includes a reorganised table structure to make use of the free space on the login panel, and the changes made to combat the Vbulletin cookie problem. Just replace the text "LINK NAME HERE/LINK HERE/IMAGE HERE" to add your own links and images to this section.
<?php
// +---------------------------------------------+
// | Copyright © 2003 – 2005 Subdreamer, LLC |
// | http://www.subdreamer.com |
// | This file may not be redistributed. |
// +---------------------------------------------+
if(!defined('IN_SUBDREAMER'))
{
die("Hacking attempt!");
}
function p10_LoginPanel()
{
global $DB, $categoryid, $userinfo, $inputsize, $usersystem, $loginerrors;
// get settings
$settings = GetPluginSettings(10);
if($userinfo['loggedin'] == 1 AND $settings['Display Avatar'] == 1)
{
$avatar = ForumAvatar($userinfo['userid'], $userinfo['username']);
}
// Get Language
$language = GetLanguage(10);
$regpath = ForumLink(1);
$cppath = ForumLink(2);
$pwdpath = ForumLink(3);
// $cppath has already gone through rewritelink (or $sdurl added) in the integration files
$myaccount = '<a href="' . $cppath . '"><img src="images/icons/accounttrans.gif"/><br/>' . $language['my_account'] . '</a>';
if($usersystem)
{
if($userinfo['loggedin'])
{
echo '<table border="0" cellspacing="0" cellpadding="0" align="Center">
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td colspan="3"><div align="center"><strong>' . $language['welcome_back'] . ' ' . $usersystem['username'] . '</strong></div></br></td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>';
if(isset($avatar))
{
echo '<tr align="Center" valign="Center">
<td align="Center" valign="Center"><div align="center" valign="Center">' . $avatar . '</div></td>';
}
echo '<tr align="Center" valign="Center">
<td align="Center" valign="Center"><div align="center" valign="Center"></div></td>
<td width="10%"></td>
<td align="center"><div align="center">'.iif(isset($cppath), $myaccount, '').'<br /><br/><a href="' . RewriteLink('index.php?categoryid=' . $categoryid . '&logout=1') . '"><img src="images/icons/logouttrans.gif"/><br/>' . $language['logout'] . '</a></div></td>
</tr>';
if($settings['Display Admin Link'] &&
($userinfo['adminaccess'] ||
count($userinfo['pluginadminids']) > 0 ||
count($userinfo['custompluginadminids']) > 0))
{
echo '<tr>
<td colspan="3"><div align="center"> </td>
</tr>
<tr>
<td colspan="3"><div align="center"><strong>Administrators Options</strong></div></td>
</tr>
<tr>
<td colspan="3"><div align="center"> </td>
</tr>
<tr>
<td width="45%"><div align="Center"><a href="LINK HERE" target="_blank"><img src="IMAGE HERE"/></a></div></td>
<td width="10%"> </td>
<td align="Center" width="45%"><div align="Center"><a href="LINK HERE"><img src="IMAGE HERE"/></a></div></td>
</tr>
<tr>
<td align="Center"><div align="Center"><a href="LINK HERE" target="_blank">LINK NAME HERE</a></div></td>
<td width="10%"> </td>
<td align="Center"><div align="Center"><a href="LINK HERE" >LINK NAME HERE</a></div></td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td width="45%"><div align="Center"><a href="LINK HERE" target="_blank"><img src="IMAGE HERE"/></a></div></td>
<td width="10%"> </td>
<td align="Center" width="45%"><div align="Center"><a href="LINK HERE"><img src="IMAGE HERE"/></a></div></td>
</tr>
<tr>
<td align="Center"><div align="Center"><a href="LINK HERE" target="_blank">LINK NAME HERE</a></div></td>
<td width="10%"> </td>
<td align="Center"><div align="Center"><a href="LINK HERE" >LINK NAME HERE</a></div></td>
</tr>
';
}
if($settings['Show PMs'] == 1)
{
echo '<tr>
<td colspan="3" align="center"><br/>';
require('./plugins/p10_mi_loginpanel/pminfo.php');
echo ' </td>
</tr>';
}
echo '</table>';
}
else
{
if(count($loginerrors))
{
foreach($loginerrors as $key => $value)
{
echo $value . '<br />';
}
}
echo '<form action="' . RewriteLink('index.php?categoryid=' . $categoryid) . '" method="post">
<input type="hidden" name="login" value="login" />
<table border="0" cellspacing="0" cellpadding="0">
<tr><td style="padding-bottom: 4px;">' . $language['username'] . '</td></tr>
<tr><td style="padding-bottom: 4px;"><input name="loginusername" type="text" size="'.$inputsize.'" /></td></tr>
<tr><td style="padding-bottom: 4px;">' . $language['password'] . '</td></tr>
<tr><td style="padding-bottom: 4px;"><input name="loginpassword" type="password" size="'.$inputsize.'" /></td></tr>
<tr><td style="padding-bottom: 4px;"><input class="checkbox" type="checkbox" name="rememberme" checked="checked" /> ' . $language['remember_me'] . '</td></tr>
<tr><td><input type="submit" name="Submit now" value="' . strip_tags($language['login']) . '" /></td></tr>';
// $regpath has already gone through rewritelink (or $sdurl added) in the integration files
if(isset($regpath))
{
echo '<tr>
<td><br />' . $language['not_registered'] . '<br /><a href="' . $regpath . '">' . $language['register_now'] . '</a></td>
</tr>';
}
// $pwdpath has already gone through rewritelink (or $sdurl added) in the integration files
if(isset($pwdpath))
{
echo '<tr>
<td><br /><a href="' . $pwdpath . '">' . $language['forgot_password'] . '</a></td>
</tr>';
}
echo '</table>
</form>';
}
}
else
{
echo 'User System is turned off. Please turn it on to display the login panel.';
}
}
p10_LoginPanel();
?>
Attached is how my login panel looks now after a little modification.
Hug_It
08-03-2005, 05:26 PM
Very nice!
Stelly
08-04-2005, 09:23 AM
I have to admit that looks pretty sweet :)
Stelly
geiri
08-06-2005, 02:35 AM
Sweet :D
duylamng
08-06-2005, 11:44 AM
please help for guide to do same this....
tokenyank
08-21-2005, 08:39 PM
Does this only work for phpbb based usergroups?
I've just tried it with vB and I'm getting t_string errors
tokenyank
08-21-2005, 08:44 PM
This is what I'm getting:
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/mumsonli/public_html/sdtest/plugins/p10_mi_loginpanel/loginpanel.php on line 164
This is my file:
<?php
// +---------------------------------------------+
// | * * Copyright © 2003 – 2005 Subdreamer, LLC |
// | * * [url=http://www.subdreamer.com]http://www.subdreamer.com[/url] * * * * * * * |
// | * * This file may not be redistributed. * * |
// +---------------------------------------------+
if(!defined('IN_SUBDREAMER'))
{
*die("Hacking attempt!");
}
function p10_LoginPanel()
{
*global $DB, $categoryid, $dbname, $userinfo, $sdurl, $inputsize,
* * * * $usersystem, $loginerrors, $cppath, $regpath, $pwdpath;
*// forum information
*$forumdbname = $usersystem['dbname'];
*$forumname * = $usersystem['name'];
*$forumpath * = $usersystem['folderpath'];
*$tableprefix = $usersystem['tblprefix'];
*// display avatar?
*$displayavatar = $DB->query_first("SELECT value FROM " . TABLE_PREFIX . "pluginsettings WHERE pluginid = '10' AND title = 'Display Avatar'");
*if($userinfo['loggedin'] == 1 AND $displayavatar['value'] == 1)
*{
* *// switch to forum database
* *if($dbname != $forumdbname)
* * *$DB->select_db($forumdbname);
* *// get users avatar
* *if($forumname == 'vBulletin 2')
* *{
* * *$useravatar = $DB->query_first("SELECT userid, avatarid FROM " . $tableprefix . "user WHERE username = '" . addslashes($userinfo['username']) . "'");
* * *// custom avatar?
* * *if( ($useravatar['avatarid'] == 0) AND ($customavatar = $DB->query_first("SELECT * FROM " . $tableprefix . "customavatar WHERE userid = '" . $useravatar['userid'] . "'")) )
* * *{
* * * *$avatar = '<img src="./plugins/p10_mi_loginpanel/avatar.php?userid=' . $useravatar['userid'] . '" />';
* * *}
* * *else if($useravatar['avatarid'] != 0)
* * *{
* * * *$getavatar = $DB->query_first("SELECT avatarpath FROM " . $tableprefix . "avatar WHERE avatarid = '" . $useravatar['avatarid'] . "'");
* * * *$avatar = '<img src="' . $sdurl . $forumpath . $getavatar['avatarpath'] . '" />';
* * *}
* *}
* *else if($forumname == 'vBulletin 3')
* *{
* * *$useravatar = $DB->query_first("SELECT userid, avatarid FROM " . $tableprefix . "user WHERE username = '" . $userinfo['username'] . "'");
* * *// custom avatar?
* * *if( ($useravatar['avatarid'] == 0) && ($customavatar = $DB->query_first("SELECT * FROM " . $tableprefix . "customavatar WHERE userid = '" . $useravatar['userid'] . "'")) )
* * *{
* * * *$avatar = '<img src="'.$usersystem['folderpath']."image.php?u=".$u seravatar['userid'].'" />';
* * *}
* * *else if($useravatar['avatarid'] != 0)
* * *{
* * * *$getavatar = $DB->query_first("SELECT avatarpath FROM " . $tableprefix . "avatar WHERE avatarid = '" . $useravatar['avatarid'] . "'");
* * * *$avatar = '<img src="' . $sdurl . $forumpath . $getavatar['avatarpath'] . '" />';
* * *}
* *}
* *else if($forumname == 'phpBB2')
* *{
* * *// get avatar settings
* * *$avatarpath * * * *= $DB->query_first("SELECT config_value FROM " . $tableprefix . "config WHERE config_name = 'avatar_path'");
* * *$avatargallerypath = $DB->query_first("SELECT config_value FROM " . $tableprefix . "config WHERE config_name = 'avatar_gallery_path'");
* * *$useravatar = $DB->query_first("SELECT user_avatar, user_avatar_type FROM " . $tableprefix . "users
* * * * * * * * * * * * * * * * * * WHERE username = '" . $userinfo['username'] . "' ");
* * *if(strlen($useravatar['user_avatar']))
* * *{
* * * *switch($useravatar['user_avatar_type'])
* * * *{
* * * * *case 1: *// uploaded avatar in avatars folder
* * * * * *$avatar = '<img src="' . $sdurl . $forumpath . $avatarpath['config_value'] . '/' . $useravatar['user_avatar'] . '" />';
* * * * *break;
* * * * *case 2: *// an external link to an avatar (offsite)
* * * * * *$avatar = '<img src="' . $useravatar['user_avatar'] . '" />';
* * * * *break;
* * * * *case 3: *// uploaded avatar in the avatars -> gallery folder
* * * * * *$avatar = '<img src="' . $sdurl . $forumpath . $avatargallerypath['config_value'] . '/' . $useravatar['user_avatar'] . '" />';
* * * * *break;
* * * *}
* * *}
* *}
* *else if($forumname == 'Invision Power Board 2')
* *{
* * *$useravatar = $DB->query_first("SELECT avatar_location, avatar_size, avatar_type FROM " . $tableprefix . "member_extra WHERE id = '" . $userinfo['userid'] . "'");
* * *if($useravatar['avatar_type'] == 'local' AND strlen($useravatar['avatar_location']))
* * *{
* * * *$avatar = '<img src="' . $sdurl . $forumpath . 'style_avatars/' . $useravatar['avatar_location'] . '" />';
* * *}
* * *else if($useravatar['avatar_type'] == 'url')
* * *{
* * * *$avatar = '<img src="' . $useravatar['avatar_location'] . '" />';
* * *}
* * *else if($useravatar['avatar_type'] == 'upload')
* * *{
* * * *$avatar = '<img src="' . $sdurl . $forumpath . 'uploads/' . $useravatar['avatar_location'] . '" />';
* * *}
* *}
* *else if($forumname == 'Simple Machines Forum 1')
* *{
* * *$useravatar = $DB->query_first("SELECT avatar FROM " . $tableprefix . "members WHERE ID_MEMBER = '" . $userinfo['userid'] . "'");
* * *if(substr($useravatar['avatar'], 0, 4) == 'http')
* * *{
* * * *$avatar = '<img src="' . $useravatar['avatar'] . '" />';
* * *}
* * *else if(strlen($useravatar['avatar']))
* * *{
* * * *$avatar = '<img src="' . $sdurl . $forumpath . 'avatars/' . $useravatar['avatar'] . '" / >';
* * *}
* *}
* *// switch back to subdreamer database
* *if($dbname != $forumdbname)
* * *$DB->select_db($dbname);
*}
*// Get Language
*$language = GetLanguage(10);
*// $cppath has already gone through rewritelink (or $sdurl added) in the integration files
*$myaccount = '<a href="' . $cppath . '">' . $language['my_account'] . '</a>';
*if($usersystem)
*{
* *if($userinfo['loggedin'])
* *{
* * *echo '<table border="0" cellspacing="0" cellpadding="0">
* * * * * *<tr>
* * * * * * *<td>' . $language['welcome_back'] . ' ' . $userinfo['username'] . '</td>
* * * * * *</tr>';
* * *if(isset($avatar))
* * *{
* * * *echo '<tr>
* * * * * * * *<td><br />' . $avatar . '</td>
* * * * * * *</tr>';
* * *}
* * *echo '<tr>
* * * * * * *<td><br />'.iif(isset($cppath), $myaccount, '').'</td>
* * * * * *</tr>
* * * * * *<tr>
* * * * * * *<td><a href="' . RewriteLink('index.php?categoryid=' . $categoryid . '&logout=1') . '">' . $language['logout'] . '</a></td>
* * * * * *</tr>
// Start Code to show link to Admin Controls section if the user is an admin.
// Is user admin?
* if($userinfo['adminaccess'] == 1)
* {
* * * echo '<tr>your table structure here</tr>';
}
// End:if($userinfo['adminaccess'] == 1)
// End Code to show link to Admin section if the user is an admin
* echo '</Table>';
</table>';
* *}
* *else
* *{
* * *if(count($loginerrors))
* * *{
* * * *foreach($loginerrors as $key => $value)
* * * *{
* * * * *echo $value . '<br />';
* * * *}
* * *}
* * *echo '<form action="' . RewriteLink('index.php?categoryid=' . $categoryid) . '" method="post">
* * * * * *<input type="hidden" name="login" value="login" />
* * * * * *<table border="0" cellspacing="0" cellpadding="0">
* * * * * *<tr><td style="padding-bottom: 4px;">' . $language['username'] . '</td></tr>
* * * * * *<tr><td style="padding-bottom: 4px;"><input name="loginusername" type="text" size="'.$inputsize.'" /></td></tr>
* * * * * *<tr><td style="padding-bottom: 4px;">' . $language['password'] . '</td></tr>
* * * * * *<tr><td style="padding-bottom: 4px;"><input name="loginpassword" type="password" size="'.$inputsize.'" /></td></tr>
* * * * * *<tr><td style="padding-bottom: 4px;"><input class="checkbox" type="checkbox" name="rememberme" checked /> ' . $language['remember_me'] . '</td></tr>
* * * * * *<tr><td><input type="submit" name="Submit now" value="' . strip_tags($language['login']) . '" /></td></tr>';
* * *// $regpath has already gone through rewritelink (or $sdurl added) in the integration files
* * *if(isset($regpath))
* * *{
* * * *echo '<tr>
* * * * * * * *<td><br />' . $language['not_registered'] . '<br /><a href="' . $regpath . '">' . $language['register_now'] . '</a></td>
* * * * * * *</tr>';
* * *}
* * *// $pwdpath has already gone through rewritelink (or $sdurl added) in the integration files
* * *if(isset($pwdpath))
* * *{
* * * *echo '<tr>
* * * * * * * *<td><br /><a href="' . $pwdpath . '">' . $language['forgot_password'] . '</a></td>
* * * * * * *</tr>';
* * *}
* * *echo '</table>
* * * * * *</form>';
* *}
*}
*else
*{
* *echo 'User System is turned off. Please turn it on to display the login panel.';
*}
}
p10_LoginPanel();
?>
utw-mephisto
08-28-2005, 04:56 AM
looks like it, I have vb and cannot use it either ..
jennec
08-30-2005, 12:35 PM
OK. You have placed the code in the wrong place. In an original loginpanel.php you should search for this code:
*if($usersystem)
*{
* *if($userinfo['loggedin'])
* *{
* * *echo '<table border="0" cellspacing="0" cellpadding="0">
* * * * * *<tr>
* * * * * * *<td>' . $language['welcome_back'] . ' ' . $userinfo['username'] . '</td>
* * * * * *</tr>';
* * *if(isset($avatar))
* * *{
* * * *echo '<tr>
* * * * * * * *<td><br />' . $avatar . '</td>
* * * * * * *</tr>';
* * *}
* * *echo '<tr>
* * * * * * *<td><br />'.iif(isset($cppath), $myaccount, '').'</td>
* * * * * *</tr>
* * * * * *<tr>
* * * * * * *<td><a href="' . RewriteLink('index.php?categoryid=' . $categoryid . '&logout=1') . '">' . $language['logout'] . '</a></td>
* * * * * *</tr>
* * * * * *</table>';
then replace it with this:
*if($usersystem)
*{
* *if($userinfo['loggedin'])
* *{
* * *echo '<table border="0" cellspacing="0" cellpadding="0">
* * * * * *<tr>
* * * * * * *<td>' . $language['welcome_back'] . ' ' . $userinfo['username'] . '</td>
* * * * * *</tr>';
* * *if(isset($avatar))
* * *{
* * * *echo '<tr>
* * * * * * * *<td><br />' . $avatar . '</td>
* * * * * * *</tr>';
* * *}
* * *echo '<tr>
* * * * * * *<td><br />'.iif(isset($cppath), $myaccount, '').'</td>
* * * * * *</tr>
* * * * * *<tr>
* * * * * * *<td><a href="' . RewriteLink('index.php?categoryid=' . $categoryid . '&logout=1') . '">' . $language['logout'] . '</a></td>
* * * * * *</tr>'; *
// Start Code to show link to Admin Controls section if the user is an admin.
// Is user admin?
* *if($userinfo['adminaccess'] == 1)
* *{
* * * *echo '<tr>your table structure here</tr>';
* * *
} // End: if($userinfo['adminaccess'] == 1)
// End Code to show link to Admin section if the user is an admin
* *echo '</Table>';
The above code does not include any links, but if you know a little html you can create any links you like here. The image of my login panel has a completely modified table structure hence why it has icons and links to the right of the avatar and also in two seperate columns below the avatar. I have posted a copy of the the code I am using on my website (http://www.tecnocom.co.uk/forum/showthread.php?t=8)
kristoz
08-31-2005, 06:47 AM
Thanx alot my login panel looks now
http://img393.imageshack.us/img393/8453/login7xc.jpg
Greg Thimmes
10-02-2005, 05:11 PM
How do I make this so my Admin and Mods can have this? I don't want my mods to be able to go into the categories and such.
voidet
11-09-2005, 11:51 AM
Really nice work :)
Just wondering how you could determine whether a user is from another type of user group, even a custom user group?
Neska
11-13-2005, 01:47 AM
Could u attack ur loginpanel.php here so i can download it and just remplace thinks i need? I tried to make what u said and it doesn't work for me, so I guess i am doing something wrong.
Thanks :)
jennec
11-14-2005, 08:52 AM
<div class='quotetop'>QUOTE(jennec @ Aug 30 2005, 12:35 PM) 938</div>
The image of my login panel has a completely modified table structure hence why it has icons and links to the right of the avatar and also in two seperate columns below the avatar. I have posted a copy of the the code I am using on my website (http://www.tecnocom.co.uk/vb/showthread.php?t=8)
[/b]
valdet
07-07-2006, 03:02 PM
I dont have the forum inegration configured.
so my question is can my admin login panel look like jennec and kristoz's?
i looked through the code jennec gave in his website but the icons are not aligned so well like they are in the two mentioned cases?
Hey Jennec, I love the mod you have made of the Login Panel. Can you help me ? I have copied your loginpanel.php from your website and It's all working perfectly apart from I can't get the profile/my account link to appear ? I have the Logout link and the rest of the admin links working.
Any help is much appreciated !
jennec
11-20-2006, 10:23 AM
I dont have the forum inegration configured.
so my question is can my admin login panel look like jennec and kristoz's?
i looked through the code jennec gave in his website but the icons are not aligned so well like they are in the two mentioned cases?
Hi,
Yes. The login panel in SD is not related to any type of integration with any other products. The changes I provided above can have any type of table srtucture and links you like in it. So you are only limited by your imagination. I tend to keep mine simple, otherwise it becomes difficult to administer later on.
jennec
11-20-2006, 10:25 AM
Hey Jennec, I love the mod you have made of the Login Panel. Can you help me ? I have copied your loginpanel.php from your website and It's all working perfectly apart from I can't get the profile/my account link to appear ? I have the Logout link and the rest of the admin links working.
Any help is much appreciated !
Which versin of SD are you running this on? I think that the profile lnk may have changed in the SD 2.4, but I am not sure, so will have to investigate this.
Can you please also post the code you are using so i can check it out.
Thanks.
Hey Jennec, Im running the latest Subdreamer 2.4 . I have attached a copy of the code im using for the login panel but like i said, I can't get the profile button to appear and the buttons are all over the place. ? The Logout button appears but it is in the wrong place and the profile button still doesn't appear ?
You can check out my site at www.clublandedinburgh.com/subdreamer
and I have set up a test login for you with the username ' Goi ' and
Password ' panda69 ' .......without the exclamation marks.
The site is nowhere near finished yet but i hope you can help with the login Panel.
Thanks for any help
jennec
11-21-2006, 12:52 PM
Hey Jennec, Im running the latest Subdreamer 2.4 . I have attached a copy of the code im using for the login panel but like i said, I can't get the profile button to appear and the buttons are all over the place. ? The Logout button appears but it is in the wrong place and the profile button still doesn't appear ?
. . .
Hi there. The code in the txt file you attached is not from SD 2.4. I had a similar issue when upgrading, that not all the files I was FTP'ing up to my site actually over wrote the ones that were already there. Strange as it had worked perfectly well previously.
Anyway. Re-upload the 2.4 updates, or even just the login panel plugin. You should see the difference between previous loginpanel.php files and th 2.4 version, as it has been cut down as lot and is using functinos held elsewhere in the system that were not present before.
I have attached a copy of my 2.4 version of the loginpanel.php file, with the modifications that I use without any problems. You should notice in this file that I have tidied up the table structure and included the PM Notifications at the bottom. Hopefully you will not have any more problems
jennec
11-21-2006, 02:14 PM
FYI, I have updated the instructions in this thread (http://www.subdreamer.org/forum/showpost.php?p=255&postcount=16)to reflect the changes in SD 2.4.
Great! Thanks Jennec. much appreciated !
Edit :: Im getting a problem when using the new code. there are 2 avatars showing up instaed of 1 ?
jennec
11-21-2006, 03:33 PM
Great! Thanks Jennec. much appreciated !
Edit :: Im getting a problem when using the new code. there are 2 avatars showing up instaed of 1 ?
On line 58 remove ' . $avatar . '. Don't remove it from line 54 or you will not get any avatars showing at all.
I have amended the code earlir in the thread to stop this happening for others.
Thanks Jennec that worked perfectly. Just a couple things tho.
I removed the line 58 code and the avatar was in the wrong place. So I put it back and removed the Line 54 code and then it worked, I think you have got the two lines mixed up. Thanks Great hack!
Do you know if it's possible to have a default Avatar with this hack? I have set up a default Avatar in PHPBB2 and I just need it to appear in the login panel ? It appears in an unmodified login panel but not in your modified version?
Last thing , Can you have a look at the attached picture and tell me how I can get the Avatar and buttons up a couple spaces in the login panel. They seem to be quite far down.
Great work,
Thanks !
jennec
12-01-2006, 07:51 AM
If you can post the code you are using, I can check it for any erroneous line breaks etc. Which should help with the line spacing around the "Welcome Back Message"
As far as I'm aware the default avatar should work with this hack, as it is only a layout change, there is no changes to the original code in the loginpanel.php. So I can look through you code for that too, if you can post it here.
Thanks for the reply.
I have attached my Loginpanel file for you to have a look at.
Thanks again for any help you can give me.
CJ
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.