How is Vantage getting user ID/Usernames for the dashboard pages.
On my site I am allowing users to submit articles and want to display their post stats together with their other stats in their dashboard pages.
Here is the code I am using;
Code:
<li>Total Articles: <?php echo get_the_author_posts(); ?>
<?php $articles = get_the_author_posts(); ?>
<?php if ($articles > 0): ?>
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>">See all</a>
<?php endif; ?></li>
The problem I am having is that until someone actually has a post or listing of their own, the above code puts in the stats for the last person to post something. Also, regardless of whether they have posted anything or not, if you view someones (or they view their own) favourites list or reviews page it shows the same problem. See pics below;
Screen Shot 2013-03-21 at 9.36.56 AM.jpg
Screen Shot 2013-03-21 at 9.37.21 AM.jpg
So what I want to know is does Vantage use some special tags or function to get the user id or username that I could using in my mod to make this work properly?
I have checked the template files and found this in dashboard.php;
Code:
function va_count_user_posts( $user_id , $status ) {
global $wpdb;
return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = %d AND post_type = %s AND post_status = %s", $user_id, VA_LISTING_PTYPE, $status ) );
}
Is it something to do with this? Could I alter that slightly to make my mod work?