Replace the login user to the header

Hi,
I’m interesting to move the user login from the left bar to the header on the right side.
I didn’t find the way how to replace it.

You would need familiarity with PHP / Smarty to make this change. Do you have that experience?

The OJS header just calls the common library header from lib/pkp:

So, you could insert the relevant code there:

You would then need to duplicate the logic from the user login block:

1 Like

Thank you for your answer.
I know a few in PHP but I will try do go by your instructions.

I will let you know

I did as you said,
but the user located in the middle of the page

{**
 * templates/common/header.tpl
 *
 * Copyright (c) 2013-2016 Simon Fraser University Library
 * Copyright (c) 2003-2016 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * Common site header.
 *}
{strip}
{translate|assign:"applicationName" key="common.openJournalSystems"}
{include file="core:common/header.tpl"}
<div class="block" id="sidebarUser">
	{if !$implicitAuth || $implicitAuth === $smarty.const.IMPLICIT_AUTH_OPTIONAL}
		<span class="blockTitle">{translate key="navigation.user"}</span>
	{/if}

	{if $isUserLoggedIn}
		{translate key="plugins.block.user.loggedInAs"}<br />
		<strong>{$loggedInUsername|escape}</strong>
		<ul>
			{if $hasOtherJournals}
				<li><a href="{url journal="index" page="user"}">{translate key="plugins.block.user.myJournals"}</a></li>
			{/if}
			<li><a href="{url page="user" op="profile"}">{translate key="plugins.block.user.myProfile"}</a></li>
			<li><a href="{url page="login" op="signOut"}">{translate key="plugins.block.user.logout"}</a></li>
			{if $userSession->getSessionVar('signedInAs')}
				<li><a href="{url page="login" op="signOutAsUser"}">{translate key="plugins.block.user.signOutAsUser"}</a></li>
			{/if}
		</ul>
	{else}
		{if $implicitAuth}
			{if $implicitAuth === $smarty.const.IMPLICIT_AUTH_OPTIONAL}
				<span class="blockTitle">{translate key="user.login.implicitAuth"}</span>
			{/if}
			<a href="{url page="login" op="implicitAuthLogin"}">{translate key="plugins.block.user.implicitAuthLogin"}</a>
			{if $implicitAuth === $smarty.const.IMPLICIT_AUTH_OPTIONAL}
				<span class="blockTitle">{translate key="user.login.localAuth"}</span>
			{/if}
		{/if}
		{if !$implicitAuth || $implicitAuth === $smarty.const.IMPLICIT_AUTH_OPTIONAL}
			{if $userBlockLoginSSL}
				<a href="{$userBlockLoginUrl}">{translate key="user.login"}</a>
			{else}
				<form method="post" action="{$userBlockLoginUrl}">
					<table>
						<tr>
							<td><label for="sidebar-username">{translate key="user.username"}</label></td>
							<td><input type="text" id="sidebar-username" name="username" value="" size="12" maxlength="32" class="textField" /></td>
						</tr>
						<tr>
							<td><label for="sidebar-password">{translate key="user.password"}</label></td>
							<td><input type="password" id="sidebar-password" name="password" value="{$password|escape}" size="12" class="textField" /></td>
						</tr>
						<tr>
							<td colspan="2"><input type="checkbox" id="remember" name="remember" value="1" /> <label for="remember">{translate key="plugins.block.user.rememberMe"}</label></td>
						</tr>
						<tr>
							<td colspan="2"><input type="submit" value="{translate key="user.login"}" class="button" /></td>
						</tr>
					</table>
				</form>
			{/if}
		{/if}
	{/if}
</div>

{/strip}

It looks like you’ve edited the OJS header instead of the shared library header. Instead of looking at templates/common/header.tpl, see lib/pkp/templates/common/header.tpl. The unchanged version should look like the second file I referenced, rather than the first.

Thank you very much for the help.
now I have one more question:
I located the code right after the image code. Now the user login is in the right block, but I want it to be on the rught side next to the image and not below.
How can I change it?

Thank you


You will need to be familiar with HTML and CSS to complete this change.

See in particular, CSS’s box model:
http://www.w3schools.com/css/css_boxmodel.asp
I highly recommend the entire w3schools tutorial.