• I want to try and modify the loop so that it displays only the posts from a logged in user perspective.

    For example, Fred logs in. Now the page he looks at has a modified loop so that it only displays Fred’s posts.

    Do you know if there’s an extension in the loop to do that? Obviously there’s a way to put a certain author’s posts in the loop by putting in an author ID or that sort of thing. But is there a way to code it so it says, basically “YOUR POSTS”, IE: whoever logs in see’s only their posts so that it dynamically does that the same way for every author who logs in?

Viewing 1 replies (of 1 total)
  • Thread Starter badkarma9000

    (@badkarma9000)

    I could also accomplish this an opposite way by changing where it directs a user who logs in. In other words if the pre-loop code or the loop code don’t have any way to say “You’re currently logged in as you so I’m gonna show you your posts and nobody elses” then another solution would be to change the re-direct after a user logs in.

    For example:

    Fred logs in, and instead of it taking him to the dashboard, it’s coded to send him to his author page. I saw a cool site that said how to do this, but not automatically:

    https://www.kpdesign.net/wordpress/allowing-limiting-user-access-in-wordpress/

    But it’s through manually adding lines of code. IE:

    <strong><?php echo $user_identity ?></strong></li>
    
    <?php get_currentuserinfo(); if ('2' == $user_ID) { ?>
    <li><a href="<?php bloginfo('url') ?>/clients/client1/" rel="nofollow" title="<?php _e('Your account summary'); ?>"><?php _e('Account summary'); ?></a></li>
    <?php } ?>
    
    <?php get_currentuserinfo(); if ('3' == $user_ID) { ?>
    <li><a href="<?php bloginfo('url') ?>/clients/client2/" rel="nofollow" title="<?php _e('Your account summary'); ?>"><?php _e('Account summary'); ?></a></li>
    <?php } ?>
    
    <?php get_currentuserinfo(); if ('4' == $user_ID) { ?>
    <li><a href="<?php bloginfo('url') ?>/clients/client3/" rel="nofollow" title="<?php _e('Your account summary'); ?>"><?php _e('Account summary'); ?></a></li>
    <?php } ?>

    Thus I’d have to add a new block of code to the links everytime a new author is added. We will be adding authors all the time, so it’d be best if that was dynamic and could just

    <?php get_currentuserinfo(); if

    followed up by some “go to THAT AUTHORS page”. I just don’t know if that’s possible.

Viewing 1 replies (of 1 total)
  • The topic ‘User Page’ is closed to new replies.