Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $current_user_profile = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
- $lid = $current_user_profile->ID;
- $user_meta_tw_id = $current_user_profile->user_login;
- $dl_tw_url = "http://twitter.com/$user_meta_tw_id";
- $some_email = $current_user_profile->user_email; //Gets Authors email
- $querystr = "
- SELECT a.comment_ID, a.comment_post_ID, a.comment_content, a.comment_date_gmt, a.comment_author_url, b.post_title, b.ID
- FROM $wpdb->comments a, $wpdb->posts b
- WHERE a.comment_post_ID = b.ID
- AND (a.comment_author_email = '$some_email'
- OR a.comment_author_url = '$dl_tw_url')
- AND a.comment_approved = 1
- GROUP BY a.comment_ID
- ORDER BY a.comment_ID DESC
- ";
- $comments_array = $wpdb->get_results($querystr, OBJECT);
- if ($comments_array):
- $cpp = 10; // Comments per page
- $wp_query->found_posts = count($comments_array);
- //echo $wp_query->found_posts;
- $wp_query->max_num_pages = ceil($wp_query->found_posts / $cpp);
- $on_page = intval(get_query_var('paged'));
- if($on_page == 0){ $on_page = 1; }
- $offset = ($on_page-1) * $cpp;
- $wp_query->request = "
- SELECT a.comment_ID, a.comment_post_ID, a.comment_content, a.comment_date_gmt, a.comment_author_url, b.post_title, b.ID
- FROM $wpdb->comments a, $wpdb->posts b
- WHERE a.comment_post_ID = b.ID
- AND (a.comment_author_email = '$some_email'
- OR a.comment_author_url = '$dl_tw_url')
- AND a.comment_approved = 1
- GROUP BY a.comment_ID
- ORDER BY a.comment_ID DESC
- LIMIT $cpp
- OFFSET $offset
- ";
- $pagecomments = $wpdb->get_results($wp_query->request, OBJECT);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement