Advertisement
PhoTonFlinger

Untitled

Nov 11th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 KB | None | 0 0
  1. <?php
  2. /**
  3. * This file is used for listing the posts on profile
  4. */
  5. ?>
  6.  
  7. <?php if ( buddyblog_user_has_posted() ): ?>
  8. <?php
  9. //let us build the post query
  10. if ( bp_is_my_profile() || is_super_admin() ) {
  11. $status = 'any';
  12. } else {
  13. $status = 'publish';
  14. }
  15.  
  16. $paged = bp_action_variable( 1 );
  17. $paged = $paged ? $paged : 1;
  18.  
  19. $query_args = array(
  20. 'author' => bp_displayed_user_id(),
  21. 'post_type' => buddyblog_get_posttype(),
  22. 'post_status' => $status,
  23. 'paged' => intval( $paged )
  24. );
  25. //do the query
  26. query_posts( $query_args );
  27. ?>
  28.  
  29. <?php if ( have_posts() ): ?>
  30.  
  31. <?php while ( have_posts() ): the_post();
  32. global $post;
  33. ?>
  34.  
  35. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  36.  
  37. <div class="author-box">
  38. <?php echo get_avatar( get_the_author_meta( 'user_email' ), '50' ); ?>
  39. <p><?php printf( _x( 'by %s', 'Post written by...', 'buddyblog' ), bp_core_get_userlink( $post->post_author ) ); ?></p>
  40.  
  41. <?php if ( is_sticky() ) : ?>
  42. <span class="activity sticky-post"><?php _ex( 'Featured', 'Sticky post', 'buddyblog' ); ?></span>
  43. <?php endif; ?>
  44. </div>
  45.  
  46. <div class="post-content">
  47.  
  48. <?php if ( function_exists( 'has_post_thumbnail' ) && has_post_thumbnail( get_the_ID() ) ):?>
  49.  
  50. <div class="post-featured-image">
  51. <?php the_post_thumbnail();?>
  52. </div>
  53.  
  54. <?php endif;?>
  55.  
  56. <h2 class="posttitle"> <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'buddyblog' ); ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a> </h2>
  57.  
  58. <p class="date"><?php printf( __( '%1$s <span>in %2$s</span>', 'buddyblog' ), get_the_date(), get_the_category_list( ', ' ) ); ?></p>
  59.  
  60. <div class="entry">
  61.  
  62. <?php the_content( __( 'Read the rest of this entry &rarr;', 'buddyblog' ) ); ?>
  63. <?php wp_link_pages( array( 'before' => '<div class="page-link"><p>' . __( 'Pages: ', 'buddyblog' ), 'after' => '</p></div>', 'next_or_number' => 'number' ) ); ?>
  64. </div>
  65.  
  66. <p class="postmetadata"><?php the_tags( '<span class="tags">' . __( 'Tags: ', 'buddyblog' ), ', ', '</span>' ); ?> <span class="comments"><?php comments_popup_link( __( 'No Comments &#187;', 'buddyblog' ), __( '1 Comment &#187;', 'buddyblog' ), __( '% Comments &#187;', 'buddyblog' ) ); ?></span></p>
  67.  
  68. <div class="post-actions">
  69. <?php echo buddyblog_get_post_publish_unpublish_link( get_the_ID() );?>
  70. <?php echo buddyblog_get_edit_link();?>
  71. <?php echo buddyblog_get_delete_link();?>
  72. </div>
  73. </div>
  74.  
  75. </div>
  76.  
  77. <?php endwhile;?>
  78. <div class="pagination">
  79. <?php buddyblog_paginate(); ?>
  80. </div>
  81. <?php else: ?>
  82. <p><?php _e( 'There are no posts by this user at the moment. Please check back later!', 'buddyblog' );?></p>
  83. <?php endif; ?>
  84.  
  85. <?php
  86. wp_reset_postdata();
  87. wp_reset_query();
  88. ?>
  89.  
  90. <?php elseif ( bp_is_my_profile() && buddyblog_user_can_post( get_current_user_id() ) ): ?>
  91. <p> <?php _e( "You haven't posted anything yet.", 'buddyblog' );?> <a href="<?php echo buddyblog_get_new_url();?>"> <?php _e( 'New Post', 'buddyblog' );?></a></p>
  92.  
  93. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement