Advertisement
mgunnin

author.php

Dec 9th, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. <?php
  2. /**
  3. * Author Template
  4. *
  5. * The template for displaying Author Profile pages.
  6. *
  7. * @package deTube
  8. * @subpackage Template
  9. * @since deTube 1.0
  10. */
  11.  
  12. /* Loads the "Author Filter Template" based on the query var "filter_type"
  13. * If current page has variable key "filter_type" in the query, load the appropriate template and return.
  14. */
  15. $filter_type = get_query_var('filter_type');
  16. if($filter_type == 'user_added') {
  17. get_template_part('author-added');
  18. return;
  19. } elseif($filter_type == 'user_liked') {
  20. get_template_part('author-liked');
  21. return;
  22. }
  23.  
  24. // Get the ID of current user so we can use it later.
  25. $user_id = dp_get_queried_user_id();
  26.  
  27. $is_gamer = get_user_meta($user_id, 'is_gamer', true);
  28. if($is_gamer) {
  29. get_template_part('author-template-gamer');
  30. return;
  31. }
  32.  
  33. get_header(); ?>
  34.  
  35. <div id="main"><div class="wrap cf">
  36.  
  37. <div id="content" role="main">
  38.  
  39. <?php // Author Box ?>
  40. <div class="author-box cf">
  41. <?php echo get_avatar($user_id, 64); ?>
  42.  
  43. <div class="data">
  44. <h1 class="display-name"><?php the_author_meta( 'display_name', $user_id ); ?></h1>
  45.  
  46. <div class="meta">
  47. <?php
  48. if($user_registered = get_the_author_meta( 'user_registered', $user_id ))
  49. echo '<span class="joined">'.sprintf(__('Joined %s ago', 'dp'), human_time(strtotime($user_registered))).'</span>';
  50. if($location = get_the_author_meta('location', $user_id))
  51. echo ' <span class="sep">/</span> <span class="location">'.$location.'</span>';
  52. ?>
  53. </div>
  54.  
  55. <div class="links">
  56. <?php
  57. if($twitter = get_the_author_meta('twitter', $user_id))
  58. echo '<a class="twitter" href="'.$twitter.'">'.__('Twitter', 'dp').'</a> ';
  59. if($facebook = get_the_author_meta('facebook', $user_id))
  60. echo '<a class="facebook" href="'.$facebook.'">'.__('Facebook', 'dp').'</a> ';
  61. if($website = get_the_author_meta('url', $user_id))
  62. echo '<a class="website" href="'.$website.'">'.preg_replace('[http://|https://]', '', $website).'</a> ';
  63. ?>
  64. </div>
  65. </div><!-- #author-box .data -->
  66. </div><!-- #author-box -->
  67.  
  68. <?php // Recently Added
  69. $link = add_query_arg('filter_type', 'user_added', get_author_posts_url($user_id));
  70.  
  71. $args = array(
  72. 'view' => 'grid-medium',
  73. 'title' => __('Recently Added', 'dp'),
  74. 'link' => $link,
  75. 'author' => $user_id,
  76. 'post_type' => 'post',
  77. 'ignore_sticky_posts' => true,
  78. 'posts_per_page' => 2
  79. );
  80. dp_section_box($args);
  81. ?>
  82.  
  83. <?php // Liked Videos
  84. $link = add_query_arg('filter_type', 'user_liked', get_author_posts_url($user_id));
  85.  
  86. $args = array(
  87. 'view' => 'grid-small',
  88. 'title' => __('Liked Videos', 'dp'),
  89. 'link' => $link,
  90. 'post_type' => 'post',
  91. 'ignore_sticky_posts' => true,
  92. 'posts_per_page' => 6,
  93. 'filter_type' => 'user_liked',
  94. 'filter_user' => $user_id
  95. );
  96. dp_section_box($args);
  97. ?>
  98.  
  99. </div><!-- end #content -->
  100.  
  101. <?php get_sidebar(); ?>
  102.  
  103. </div></div><!-- end #main -->
  104.  
  105. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement