News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Move Login & Register links on the login page.

Started by Dexter1, October 07, 2018, 01:54:54 PM

Previous topic - Next topic

Dexter1

Hey guys iam tryng to move the following links to a new place. I have attached an image.



I hope the image helps =)

Arantor

Not really, no?

Do users have to log into your site in all cases?

Are you even using SMF 2.1? (I think you're using a custom theme for 2.0...)

Dexter1

Hey.

Thanks for the replay. Yes iam using SMF forum script and yes its a coustom theme. No they the do not need to login. The image is the login page. But you do not need to login.

I just want these 2 links
# Logga in
# Registrera

Shown on the navbar to be moved next to the text you can see on the image : Logga in.

d3vcho

Which version of SMF are you using? 2.0.x or 2.1?
"Greeting Death as an old friend, they departed this life as equals"

Dexter1

Hey.

Dammet iam so sorry for missing this info. Iam using :  SMF 2.0.15

Iam new to the code. Hope you guys have some mercy on me. I see now that iam in the wrong thread =)

Arantor

No, I actually can't do that.

If you move login and register to where you are indicating, users will never find them, at least based on your statement that "users don't need to log in". If they don't need to log in, they never go to the page you indicate, until they hit login, except you want to remove the general login button and put it on the login page only.

Dexter1

#6
Hey.

Thanks for youre replay but I solved it hehe. I just changed some lines and it works perfect.
# Login.template.php
# Register.template.php

Login.template.php
<?php
/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines
 * @copyright 2011 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.0.15
 */

// This is just the basic "login" form.
function template_login()
{
global $context$settings$options$scripturl$modSettings$txt;

echo '
<script type="text/javascript" src="'
$settings['default_theme_url'], '/scripts/sha1.js"></script>

<form action="'
$scripturl'?action=login2" name="frmLogin" id="frmLogin" method="post" accept-charset="'$context['character_set'], '" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' $context['session_id'] . '\');"' '''>
<div class="tborder login">
<div class="cat_bar">
<h3 class="catbg">
                <a href="http://localhost/index.php?action=register">
 Registrera</a></h3>
</h3>
</div>
<span class="upperframe"><span></span></span>
<div class="roundframe"><br class="clear" />'
;

// Did they make a mistake last time?
if (!empty($context['login_errors']))
foreach ($context['login_errors'] as $error)
echo '
<p class="error">'
$error'</p>';

// Or perhaps there's some special description for this time?
if (isset($context['description']))
echo '
<p class="description">'
$context['description'], '</p>';

// Now just get the basic information - username, password, etc.
echo '
<dl>
<dt>'
$txt['username'], ':</dt>
<dd><input type="text" name="user" size="20" value="'
$context['default_username'], '" class="input_text" /></dd>
<dt>'
$txt['password'], ':</dt>
<dd><input type="password" name="passwrd" value="'
$context['default_password'], '" size="20" class="input_password" /></dd>
</dl>'
;

if (!empty($modSettings['enableOpenID']))
echo '<p><strong>&mdash;'$txt['or'], '&mdash;</strong></p>
<dl>
<dt>'
$txt['openid'], ':</dt>
<dd><input type="text" name="openid_identifier" class="input_text openid_login" size="17" />&nbsp;<em><a href="'
$scripturl'?action=helpadmin;help=register_openid" onclick="return reqWin(this.href);" class="help">(?)</a></em></dd>
</dl><hr />'
;

echo '
<dl>
<dt>'
$txt['mins_logged_in'], ':</dt>
<dd><input type="text" name="cookielength" size="4" maxlength="4" value="'
$modSettings['cookieTime'], '"'$context['never_expire'] ? ' disabled="disabled"' ''' class="input_text" /></dd>
<dt>'
$txt['always_logged_in'], ':</dt>
<dd><input type="checkbox" name="cookieneverexp"'
$context['never_expire'] ? ' checked="checked"' ''' class="input_check" onclick="this.form.cookielength.disabled = this.checked;" /></dd>';
// If they have deleted their account, give them a chance to change their mind.
if (isset($context['login_show_undelete']))
echo '
<dt class="alert">'
$txt['undelete_account'], ':</dt>
<dd><input type="checkbox" name="undelete" class="input_check" /></dd>'
;
echo '
</dl>
<p><input type="submit" value="'
$txt['login'], '" class="button_submit" /></p>
<p class="smalltext"><input type="hidden" name="'
$context['session_var'], '" value="'$context['session_id'], '" />
<input type="hidden" name="hash_passwrd" value="" />
</div>
<span class="lowerframe"><span></span></span>
</div></form>'
;

// Focus on the correct input - username or password.
echo '
<script type="text/javascript"><!-- // --><![CDATA[
document.forms.frmLogin.'
, isset($context['default_username']) && $context['default_username'] != '' 'passwrd' 'user''.focus();
// ]]></script>'
;
}

// Tell a guest to get lost or login!
function template_kick_guest()
{
global $context$settings$options$scripturl$modSettings$txt;

// This isn't that much... just like normal login but with a message at the top.
echo '
<script type="text/javascript" src="'
$settings['default_theme_url'], '/scripts/sha1.js"></script>
<form action="'
$scripturl'?action=login2" method="post" accept-charset="'$context['character_set'], '" name="frmLogin" id="frmLogin"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' $context['session_id'] . '\');"' '''>
<div class="tborder login">
<div>

</div>'
;

// Show the message or default message.
echo '

<br />
'
'
</p>'
;

// And now the login information.
echo '
<div class="cat_bar">
<h3 class="catbg">
                <a href="http://localhost/index.php?action=register">
 Registrera</a></h3>
</div>
<span class="upperframe"><span></span></span>
<div class="roundframe">
<dl>
<dt>'
$txt['username'], ':</dt>
<dd><input type="text" name="user" size="20" class="input_text" /></dd>
<dt>'
$txt['password'], ':</dt>
<dd><input type="password" name="passwrd" size="20" class="input_password" /></dd>'
;

if (!empty($modSettings['enableOpenID']))
echo '
</dl>
<p><strong>&mdash;'
$txt['or'], '&mdash;</strong></p>
<dl>
<dt>'
$txt['openid'], ':</dt>
<dd><input type="text" name="openid_identifier" class="input_text openid_login" size="17" /></dd>
</dl>
<hr />
<dl>'
;

echo '
<dt>'
$txt['mins_logged_in'], ':</dt>
<dd><input type="text" name="cookielength" size="4" maxlength="4" value="'
$modSettings['cookieTime'], '" class="input_text" /></dd>
<dt>'
$txt['always_logged_in'], ':</dt>
<dd><input type="checkbox" name="cookieneverexp" class="input_check" onclick="this.form.cookielength.disabled = this.checked;" /></dd>
</dl>
<p class="centertext"><input type="submit" value="'
$txt['login'], '" class="button_submit" /></p>
<p class="centertext smalltext"><input type="hidden" name="'
$context['session_var'], '" value="'$context['session_id'], '" />
</div>
<span class="lowerframe"><span></span></span>
<input type="hidden" name="hash_passwrd" value="" />
</div>
</form>'
;

// Do the focus thing...
echo '
<script type="text/javascript"><!-- // --><![CDATA[
document.forms.frmLogin.user.focus();
// ]]></script>'
;
}

// This is for maintenance mode.
function template_maintenance()
{
global $context$settings$options$scripturl$txt$modSettings;

// Display the administrator's message at the top.
echo '
<script type="text/javascript" src="'
$settings['default_theme_url'], '/scripts/sha1.js"></script>
<form action="'
$scripturl'?action=login2" method="post" accept-charset="'$context['character_set'], '"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' $context['session_id'] . '\');"' '''>
<div class="tborder login" id="maintenance_mode">
<div class="cat_bar">
<h3 class="catbg">'
$context['title'], '</h3>
</div>
<p class="description">
<img class="floatleft" src="'
$settings['images_url'], '/construction.png" width="40" height="40" alt="'$txt['in_maintain_mode'], '" />
'
$context['description'], '<br class="clear" />
</p>
<div class="title_bar">
<h4 class="titlebg">'
$txt['admin_login'], '</h4>
</div>
<span class="upperframe"><span></span></span>
<div class="roundframe">
<dl>
<dt>'
$txt['username'], ':</dt>
<dd><input type="text" name="user" size="20" class="input_text" /></dd>
<dt>'
$txt['password'], ':</dt>
<dd><input type="password" name="passwrd" size="20" class="input_password" /></dd>
<dt>'
$txt['mins_logged_in'], ':</dt>
<dd><input type="text" name="cookielength" size="4" maxlength="4" value="'
$modSettings['cookieTime'], '" class="input_text" /></dd>
<dt>'
$txt['always_logged_in'], ':</dt>
<dd><input type="checkbox" name="cookieneverexp" class="input_check" /></dd>
</dl>
<p class="centertext"><input type="submit" value="'
$txt['login'], '" class="button_submit" /></p>
</div>
<span class="lowerframe"><span></span></span>
<input type="hidden" name="'
$context['session_var'], '" value="'$context['session_id'], '" /><input type="hidden" name="hash_passwrd" value="" />
</div>
</form>'
;
}

// This is for the security stuff - makes administrators login every so often.
function template_admin_login()
{
global $context$settings$options$scripturl$txt;

// Since this should redirect to whatever they were doing, send all the get data.
echo '
<script type="text/javascript" src="'
$settings['default_theme_url'], '/scripts/sha1.js"></script>

<form action="'
$scripturl$context['get_data'], '" method="post" accept-charset="'$context['character_set'], '" name="frmLogin" id="frmLogin" onsubmit="hashAdminPassword(this, \''$context['user']['username'], '\', \''$context['session_id'], '\');">
<div class="tborder login" id="admin_login">
<div class="cat_bar">
<h3 class="catbg">
                <a href="http://localhost/index.php?action=register">
 Registrera</a></h3>
</h3>
</div>
<span class="upperframe"><span></span></span>
<div class="roundframe centertext">'
;

if (!empty($context['incorrect_password']))
echo '
<div class="error">'
$txt['admin_incorrect_password'], '</div>';

echo '
<strong>'
$txt['password'], ':</strong>
<input type="password" name="admin_pass" size="24" class="input_password" />
<a href="'
$scripturl'?action=helpadmin;help=securityDisable_why" onclick="return reqWin(this.href);" class="help"><img src="'$settings['images_url'], '/helptopics.gif" alt="'$txt['help'], '" /></a><br />
<input type="submit" style="margin-top: 1em;" value="'
$txt['login'], '" class="button_submit" />';

// Make sure to output all the old post data.
echo $context['post_data'], '
</div>
<span class="lowerframe"><span></span></span>
</div>
<input type="hidden" name="admin_hash_pass" value="" />
</form>'
;

// Focus on the password box.
echo '
<script type="text/javascript"><!-- // --><![CDATA[
document.forms.frmLogin.admin_pass.focus();
// ]]></script>'
;
}

// Activate your account manually?
function template_retry_activate()
{
global $context$settings$options$txt$scripturl;

// Just ask them for their code so they can try it again...
echo '
<form action="'
$scripturl'?action=activate;u='$context['member_id'], '" method="post" accept-charset="'$context['character_set'], '">
<div class="title_bar">
<h3 class="titlebg">'
$context['page_title'], '</h3>
</div>
<span class="upperframe"><span></span></span>
<div class="roundframe">'
;

// You didn't even have an ID?
if (empty($context['member_id']))
echo '
<dl>
<dt>'
$txt['invalid_activation_username'], ':</dt>
<dd><input type="text" name="user" size="30" class="input_text" /></dd>'
;

echo '
<dt>'
$txt['invalid_activation_retry'], ':</dt>
<dd><input type="text" name="code" size="30" class="input_text" /></dd>
</dl>
<p><input type="submit" value="'
$txt['invalid_activation_submit'], '" class="button_submit" /></p>
</div>
<span class="lowerframe"><span></span></span>
</form>'
;
}

// Activate your account manually?
function template_resend()
{
global $context$settings$options$txt$scripturl;

// Just ask them for their code so they can try it again...
echo '
<form action="'
$scripturl'?action=activate;sa=resend" method="post" accept-charset="'$context['character_set'], '">
<div class="title_bar">
<h3 class="titlebg">'
$context['page_title'], '</h3>
</div>
<span class="upperframe"><span></span></span>
<div class="roundframe">
<dl>
<dt>'
$txt['invalid_activation_username'], ':</dt>
<dd><input type="text" name="user" size="40" value="'
$context['default_username'], '" class="input_text" /></dd>
</dl>
<p>'
$txt['invalid_activation_new'], '</p>
<dl>
<dt>'
$txt['invalid_activation_new_email'], ':</dt>
<dd><input type="text" name="new_email" size="40" class="input_text" /></dd>
<dt>'
$txt['invalid_activation_password'], ':</dt>
<dd><input type="password" name="passwd" size="30" class="input_password" /></dd>
</dl>'
;

if ($context['can_activate'])
echo '
<p>'
$txt['invalid_activation_known'], '</p>
<dl>
<dt>'
$txt['invalid_activation_retry'], ':</dt>
<dd><input type="text" name="code" size="30" class="input_text" /></dd>
</dl>'
;

echo '
<p><input type="submit" value="'
$txt['invalid_activation_resend'], '" class="button_submit" /></p>
</div>
<span class="lowerframe"><span></span></span>
</form>'
;
}

?>


Register.template.php

Arantor

Congrats, you managed to hide the link to the login page on the login page. Would love to know how to login.

GigaWatt

"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Dexter1

Hey Guys.

Thanks for the replay. Iam Warning you now that I have the SMF bord on a free based webhosting for the time being and also iam new to this code so dont be that hard on me :)

But if you want to check it out and give me some FeedBack I would love it  :D

hxxp:swero.byethost16.com [nonactive]

Arantor

When I arrive at your site, it doesn't have a theme, just black text on a white background.

I see for bonus points you made the login/registration thing even more confusing, when the login page only says registration, and the registration page only says login... putting things in headers doesn't say "I'm a link", people will just assume it's the title.

Dexter1

#11
Quote from: Arantor on October 08, 2018, 02:04:15 PM
When I arrive at your site, it doesn't have a theme, just black text on a white background.

I see for bonus points you made the login/registration thing even more confusing, when the login page only says registration, and the registration page only says login... putting things in headers doesn't say "I'm a link", people will just assume it's the title.

Hey and thanks for your replay.

Sorry about that I did some last minut edit to the files and forgot to change the code from
<a href="http://

To this
<a href="https://

May you be so kind to try to visit the site again and see if you have the same problem ?

Should work with: https://swero.byethost16.com/

Arantor

I just get told I can't connect to the server.

GigaWatt

You're using the core theme and the security certificate is not issued by a CA.

Switch to the default (Curve).
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Advertisement: