Skip to content

Instantly share code, notes, and snippets.

Created November 29, 2012 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4165936 to your computer and use it in GitHub Desktop.
Save anonymous/4165936 to your computer and use it in GitHub Desktop.
DeTube Author Page
<?php
/**
* Author Template
*
* The template for displaying Author Profile pages.
*
* @package deTube
* @subpackage Template
* @since deTube 1.0
*/
/* Loads the "Author Filter Template" based on the query var "filter_type"
* If current page has variable key "filter_type" in the query, load the appropriate template and return.
*/
$filter_type = get_query_var('filter_type');
if($filter_type == 'user_added') {
get_template_part('author-added');
return;
} elseif($filter_type == 'user_liked') {
get_template_part('author-liked');
return;
}
// Get the ID of current user so we can use it later.
$user_id = dp_get_queried_user_id();
get_header(); ?>
<div id="main"><div class="wrap cf">
<div id="content" role="main">
<?php // Author Box ?>
<div id="item-header" role="complementary">
<?php locate_template( array( 'members/single/member-header.php' ), true ); ?>
</div><!-- #item-header -->
<?php // Recently Added
$link = add_query_arg('filter_type', 'user_added', get_author_posts_url($user_id));
$args = array(
'view' => 'grid-medium',
'title' => __('Recently Added', 'dp'),
'link' => $link,
'author' => $user_id,
'post_type' => 'post',
'ignore_sticky_posts' => true,
'posts_per_page' => 2
);
dp_section_box($args);
?>
<?php // Liked Videos
$link = add_query_arg('filter_type', 'user_liked', get_author_posts_url($user_id));
$args = array(
'view' => 'grid-small',
'title' => __('Liked Videos', 'dp'),
'link' => $link,
'post_type' => 'post',
'ignore_sticky_posts' => true,
'posts_per_page' => 6,
'filter_type' => 'user_liked',
'filter_user' => $user_id
);
dp_section_box($args);
?>
</div><!-- end #content -->
<!-- DO NOT REMOVE! <?php bp_profile_field_data( array('user_id'=>get_the_author_meta( 'ID' ),'field'=>'About Me' )); ?>-->
<?php get_sidebar(); ?>
</div></div><!-- end #main -->
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment