Theme The Morning After

The Morning After – Login?

Arun’s The Morning After is a great WordPress theme. However, every blogger is different and has different needs. Therefore, I made some customisations to „satisfy“ my needs.

One of these needs is to have a small control panel in my sidebar that:

f these needs is to have a small control panel in my sidebar that:

  • is only offered if the Administration > Options > General > Membership: Anyone can register box is checked.
  • offers a login / registration form to unregistered visitors (if the mentioned box is checked)
  • displays to a registered user the links to the WordPress Dashboard, the „write new post“ page and to his WordPress profile.
  • gives the a registered user the possibility to log out.

Forunately, I have found the code for those requirements quite fast. I just had to make it ready for The Morning After. If you share my needs for this control panel, here is the tutorial:

siebbar.php

Open the sidebar.php file in your theme editor and insert the following code between the id=“side_categories“ and the h3 headline class=“mast“ Categories

<?php global $user_ID, $user_identity, $user_level ?>
<?php if ( $user_ID ) : ?>
<h3 class="mast">Control panel</h3>
			<ul class="cat">
				<li><a href="<?php bloginfo('url') ?>/wp-admin/">Dashboard</a></li>

				<?php if ( $user_level >= 1 ) : ?>
				<li><a href="<?php bloginfo('url') ?>/wp-admin/post-new.php">Write an article</a></li>
				<?php endif // $user_level >= 1 ?>

				<li><a href="<?php bloginfo('url') ?>/wp-admin/profile.php">Profile</a></li>
				<li><a href="<?php bloginfo('url') ?>/wp-login.php?action=logout&amp;redirect_to=<?php echo urlencode($_SERVER['REQUEST_URI']) ?>">Log out</a></li>
			</ul>

<?php elseif ( get_option('users_can_register') ) : ?>

		<h3 class="mast">Identification</h3>
			<ul class="login">
			<li>
			<form action="<?php bloginfo('url') ?>/wp-login.php" method="post">
				<p class="login">
				<label for="log"><input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="22" /> User</label><br />
				<label for="pwd"><input type="password" name="pwd" id="pwd" size="22" /> Password</label><br />
				<input type="submit" name="submit" value="Send" class="button" />
				<label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> Remember me</label><br />
				</p>
				<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>
			</form>
			</li>

			<li><a href="<?php bloginfo('url') ?>/wp-register.php">Register</a></li>
			<li><a href="<?php bloginfo('url') ?>/wp-login.php?action=lostpassword">Recover password</a></li>
		</ul>
<?php endif // get_option('users_can_register') ?>

style.css

Open the sidebar.php file in your theme editor and insert the following code between the id=“side_categories“ and the h3 headline class=“mast“ Categories:

/* Category List */

#side_categories { margin: 0 0 1em 0; }
ul.login li { list-style: none; }
p.login {text-align:left; }
ul.cat li { padding: 0 0 0.3em 0; margin: 0;}

The result

The control panel for registered users, log-in from for unregistered (and logged out) users.

Screeshot Control Panel
  1. Hi Nick Bohle! This works a treat on my site – thank you so much for continuing to offer advice to others on how to customise their TMA theme!

  2. Francisco

    Help me!
    Hi, my „recent posts“ and „lastest posts“ area displays in asceding order, and I can´t see de lastest post. If, p.ex., I insert more than 5 posts, the 7th post no display, and de „Lastest Posts“ don´t change, never.
    Why? Can you help me?

  3. I have answered you on Arun’s forum.
    cheers

  4. Another thanks. Works like a charm!

  5. Nick
    Exactly what I’ve been looking for. Quick question, how hard would it be to add a ‚members only‘ section for logged in users?

  6. Hi!
    this code should work:
    if ( is_user_logged_in() ) :
    echo ’some stuff for registrants!‘;
    else :
    echo ’some stuff for people not logged in.‘;
    endif;

  7. […] forums for that theme have a lot of customization tips, and one was a Login Sidebar. Unfortunately, this adds code to the theme, which is bad because when you update the theme all the […]

  8. I thought it was clumsy to place this code within a theme that would be updated later, so I turned it into a WordPress widget. You can check the results at the following link:
    http://www.blog.savant.be/work/the-morning-after-login-widget/143/

  9. Thanks Nick. I added the Control panel. Looks pretty good. Have a small issue here. When I try to log out, it gives a message, you are trying to log out of. Please try again
    How do I fix this?

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.