WordPress.org

Ready to get started?Download WordPress

Forums

the_author blank when logged out (6 posts)

  1. ecurbh
    Member
    Posted 4 years ago #

    As long as I am logged in, my template displays the author as "By ecurbh", but as soon as I log out, it only displays "By ".

    <em class="author">by <?php the_author(); ?></em>

    I've tried everything I can think of, editing the display name in the profile, etc., but can't get this to work.

  2. scottkuma
    Member
    Posted 4 years ago #

    I am having the same problem...but this is compunded by the fact that users can only see THEIR public names on posts. All others are blank.

    So if I'm logged in as Admin, I can only see authors for posts that Admin has authored.

    If I'm logged out, ALL authors are blank.

  3. secretsather
    Member
    Posted 4 years ago #

    I am having the exact same problem and am in urgent need of a solution.

    <div class="post" id="post-<?php the_ID(); ?>">
    
    <h1 class="title left"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1><div class="date"><?php the_time('F j, Y'); ?></div><div class="clear"></div>
    
    <div class="entry"><?php the_content('Continue Reading &raquo;'); ?></div>
    
    <p class="postmetadata">Posted in <?php the_category(', ') ?> <strong>|</strong> <?php edit_post_link('Edit',' ','<strong> |</strong>'); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> Posted by: <?php the_author(); ?></p>
    </div><!-- end div post -->
    
    <?php endwhile; else: ?>
    
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    
    <?php endif; ?>
  4. secretsather
    Member
    Posted 4 years ago #

    O.k. here's an update on the problem.

    Using the_author() tag WITHIN the loop will not display the author on the front end. If the author is logged in, they will see his/her name displayed correctly on the front end (e.g. posted by [name here]) while they are logged in.

    No author information is displayed either on the main index or single post (and yes, it is used within the loop)

    For example, the following code will only display a zero ('0'):
    <?php the_author_meta('user_email'); ?>
    <?php the_author_meta('user_login'); ?>
    <?php the_author_meta('user_pass'); ?>
    <?php the_author_meta('user_nicename'); ?>
    <?php the_author_meta('user_email'); ?>
    <?php the_author_meta('user_url'); ?>
    <?php the_author_meta('user_registered'); ?>
    <?php the_author_meta('user_activation_key'); ?>
    <?php the_author_meta('user_status'); ?>
    <?php the_author_meta('display_name'); ?>
    <?php the_author_meta('nickname'); ?>
    <?php the_author_meta('first_name'); ?>
    <?php the_author_meta('last_name'); ?>
    <?php the_author_meta('description'); ?>
    <?php the_author_meta('jabber'); ?>
    <?php the_author_meta('aim'); ?>
    <?php the_author_meta('yim'); ?>
    <?php the_author_meta('user_level'); ?>
    <?php the_author_meta('user_firstname'); ?>
    <?php the_author_meta('user_lastname'); ?>
    <?php the_author_meta('user_description'); ?>
    <?php the_author_meta('rich_editing'); ?>
    <?php the_author_meta('comment_shortcuts'); ?>
    <?php the_author_meta('admin_color'); ?>
    <?php the_author_meta('plugins_per_page'); ?>
    <?php the_author_meta('plugins_last_view'); ?>
    <?php the_author_meta('ID'); ?>

    All authors are displayed correctly on the back end.

    All authors have ALL their information filled out (including display name publicly as..) and has been confirmed by looking @ database entries.

    I believe the problem is theme specific, as blog behaves normally with alternate theme; this being the case, what (possibly) within a theme's code could cause this sort of problem?

  5. secretsather
    Member
    Posted 4 years ago #

    Problem solved.

    In a rare occurrence, a function called within the <head> tag of the header.php accessed another database without switching back to the blogs primary database...

  6. RevelationTravis
    Member
    Posted 4 years ago #

    What was the function and how is it supposed to appear in order for the author field to stop showing up blank when the PHP code <?php the_author(); ?> is used?

Topic Closed

This topic has been closed to new replies.

About this Topic