oneofayykind Posted June 8, 2010 Share Posted June 8, 2010 Ok guys so I found a lightbox login for wordpress online here http://www.problogdesign.com/how-to/how-to-create-a-wordpress-login-form-overlay/ and I followed the instructions for setting it up which included creating a new login.php file and putting it in my themes folder, adding code to the header.php file, and adding the login link to the comments page. When you click login the lightbox pops up and loads with no problem in both IE and Chrome and you can enter the login credential and click login. If you enter them correctly it redirects back to the page you were on and if you didn't enter them correctly it goes to the wp-login.php page telling you to re-enter because they were wrong. It looks to me like its checking the un/pw properly but when you get redirected back to the comments section of the article page you were on it still looks like you arent logged in. For some reason it doesn't recognize that you are logged in so it won't allow you to post a comment. Besides the link to the actual tutorial here is the code I entered into my php pages: This was added to my header.php file: <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/lightbox/css/lightbox.css" type="text/css" /> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/lightbox/scripts/prototype.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/lightbox/scripts/lightbox.js"></script> Here is my comments.php file (whole thing): <!-- Jump Link --> <a id="comments" href="comments"></a> <?php // Do not delete these lines if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) die ('Please do not load this page directly. Thanks!'); if ( post_password_required() ) { echo '<div class="wpn_nocomments">This post is password protected. Enter the password to view comments.</div>'; return; } ?> <?php if ( have_comments() ) : ?> <!-- Comment List // --> <span class="heading"><a href="#respond">Leave a Comment »</a><?php comments_number('0 Comments', '1 Comment', '% Comments' ); ?></span> <div class="comments"> <ul> <?php wp_list_comments('callback=wpn_huex_comment'); ?> </ul> <div class="navigation" style="padding:10px;"> <div class="clear"></div> <div class="alignleft"> <?php previous_comments_link() ?> </div> <div class="alignright"> <?php next_comments_link() ?> </div> <div class="clear"></div> </div> </div> <!-- // Comment List --> <?php else : ?> <div class="comments"> <?php if ('open' == $post->comment_status) : ?> <!-- Comments are open but no comments // --> <span class="heading">No comments currently exist for this post.</span> <p>Why don't you make one?</P> <?php else : ?> <!-- Comments are closed --> <span class="heading">Comments are closed.</span> <?php endif; ?> </div> <?php endif; ?> <?php if ('open' == $post->comment_status) : ?> <!-- Reply Form // --> <div class="comments"> <div id="respond"> <span class="heading"><a href="http://www.gravatar.com/" target="_blank"><img src="<?php bloginfo('stylesheet_directory'); ?>/img/icon_gravatar.png" alt="" /> Get a Gravatar</a>Leave a Reply</span> <div class="cancel-comment-reply"><img src="<?php bloginfo('stylesheet_directory'); ?>/img/icons/cross.png" /> <?php cancel_comment_reply_link(); ?></div> <?php if ( get_option('comment_registration') && !$user_ID ) : ?> <!-- User needs to login // --> <div class="wpn_logged_in">You must be <a href="<?php echo get_option('siteurl'); ?>/wp-content/themes/<?php echo get_option('template'); ?>/login.php?redirect=<?php the_permalink(); ?>" class="lbOn" title="Log in"><strong>Logged In</strong></a> to post a comment.</div> <!-- // User needs to login --> <?php else : ?> <div class="cform"> <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> <?php if ( $user_ID ) : ?> <!-- User logged in // --> <div class="wpn_logged_in"><span class="wpn_logged_text">Logged in as</span> <img alt="user" src="<?php bloginfo('stylesheet_directory'); ?>/img/icons/tick.png" /> <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a> <img alt="logout" src="<?php bloginfo('stylesheet_directory'); ?>/img/icons/cross.png" /> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Logout</a></div> <!-- // User logged in --> <?php else : ?> <!-- User not logged in // --> <p class="input"><strong>Name:<input name="author" type="text" value="<?php echo $comment_author ? $comment_author : ''; ?>" /></strong> <span class="required">« Required</span></p> <p class="input"><strong>Email Address:<input name="email" type="text" value="<?php echo $comment_author_email ? $comment_author_email : ''; ?>" /></strong> <span class="required">« Required</span></p> <p class="input"><strong>Website URL:<input name="url" type="text" value="<?php echo $comment_author_url ? $comment_author_url : ''; ?>" /></strong> <span class="optional">« Optional</span></p> <!-- // User not logged in --> <?php endif; ?> <?php do_action('comment_form', $post->ID); ?> <p class="input textarea"><strong><textarea name="comment" id="comment" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;">Type your message here...</textarea></strong></p> <p> <input class="sprite" type="submit" value="Submit" /> <strong>You can use these tags:</strong><br /> <?php echo allowed_tags(); ?> </p> <?php comment_id_fields(); ?> <div class="clear"></div> </form> </div> <?php endif; ?> </div> </div> <div class="wpn_box-bottom"></div> <!-- // Reply Form --> <?php endif; ?> Here is the login.php file that I added to my theme folder: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <? $blogurl = "http://www.droidedup.com/testing/droidedup"; $postlink = $_GET['redirect']; ?> </head> <body> <div id="login"> <form name="loginform" id="loginform" action="<?=$blogurl ?>/wp-login.php" method="post"> <p> <label>Username<br /> <input type="text" name="log" id="user_login" class="input" value="" size="20" tabindex="10" /></label> </p> <p> <label>Password<br /> <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label> </p> <p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> Remember Me</label></p> <p class="submit"> <input type="submit" name="wp-submit" id="wp-submit" value="Log In" tabindex="100" /> <input type="hidden" name="redirect_to" value="<?=$postlink ?>#respond" /> <input type="hidden" name="testcookie" value="1" /> </p> </form> <p id="nav"> <a href="<?=$blogurl ?>/wp-login.php?action=lostpassword" title="Password Lost and Found">Lost your password?</a> </p> </div> <p id="backtoblog"><a href="#" class="lbAction" rel="deactivate">Close</a></p> <script type="text/javascript"> try{document.getElementById('user_login').focus();}catch(e){} </script> <link rel="stylesheet" href="<?=$blogurl?>/wp-admin/css/login.css" type="text/css" /> </body> </html> I hope someone is able to point me the right direct with some understand as to why this isn't working the way it should? Or maybe just a solution without a reason why? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.