Hi, I have written the following script for wordpress that simply detects weather the user is logged in, displays a login form if they are not and displays links if they are (with a different set of links for admins). When I moved the cript form index.php in my theme to sidebar .php and added <?php get_sidebar(); ?> it stopped working properly. Would anyone mind helping out here? Script below.
Thanks for any help/support,PHP Code:<?php global $user_ID;
get_currentuserinfo();
if ('' == $user_ID) {
//no user logged in
?>
<form name="loginform" id="loginform" action="http://localhost/Other/wsbeorchids/wp-login.php" method="post">
<div>
<label>Username</label>
<input type="text" name="log" id="user_login" class="input" value="admin" size="20" tabindex="10" />
</div>
<div>
<label>Password</label>
<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" />
</div>
<div class="forgetmenot">
<input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" />
<label>Remember Me</label>
</div>
<div>
<input type="submit" name="wp-submit" class="submit" value="Log In" tabindex="100" />
<input type="hidden" name="redirect_to" value="http://localhost/Other/wsbeorchids/" />
<input type="hidden" name="testcookie" value="1" />
</div>
</form>
<ul>
<li><a href="http://localhost/Other/wsbeorchids/wp-login.php?action=lostpassword">Forgotten Password?</a></li>
<?php wp_register(); ?>
</ul>
<?php
} else {
// user logged in
echo "<ul>";
if ($current_user->user_level == '10') {
?>
<li><a href="<?php bloginfo('url');?>/wp-admin/post-new.php">New Post</a></li>
<li><a href="<?php bloginfo('url');?>/wp-admin/edit-pages.php">Edit Pages</a></li>
<li><a href="<?php bloginfo('url');?>/wp-admin/edit-comments.php">Comment Moderation</a></li>
<li><a href="<?php bloginfo('url');?>/wp-admin/users.php">User Moderation</a></li>
<li><a href="<?php bloginfo('url');?>/wp-admin/options-general.php">Options Panel</a></li>
<?php
} else {
?>
<li>Welcome, <?php echo $current_user->user_firstname . ' ' . $current_user->user_lastname; ?></li>
<li><a href="<?php bloginfo('url'); ?>/wp-admin/profile.php">Edit Profile</a></li>
<li><a href="<?php bloginfo('url'); ?>/wp-admin/tools.php">Install Gears</a></li>
<?php
}
?>
<li><a href="<?php echo wp_logout_url( get_bloginfo('url') );*?>" title="Logout">Logout</a></li>
</ul>
<?php
}
?>
Dan.




Bookmarks