Guest User

Untitled

a guest
Oct 19th, 2015
86
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. select * from (
  2. SELECT
  3.     if(com.comment_approved = '1' and com.user_id > 0, com_u.display_name, u.display_name) as display_name,
  4.     com.comment_author,
  5.     if(p.post_type = 'reply', t.post_title, p.post_title) as title,
  6.     if(com.comment_approved = '1', com.comment_ID, p.ID) as post_id,
  7.     if(com.comment_approved = '1', com.user_id, p.post_author) as author_id,
  8.     if(com.comment_approved = '1', unix_timestamp(com.comment_date), unix_timestamp(p.post_date)) as post_date,
  9.     if(com.comment_approved = '1', SUBSTRING(com.comment_content, 1, 200), SUBSTRING(p.post_content, 1, 200)) as content,
  10.     if(com.comment_approved = '1', 'comment', p.post_type) as type,
  11.     if(p.post_type = 'reply', ifnull(p.post_parent,0), p.ID) as post_parent,
  12.         max(post_date) as max_post_date
  13. FROM `wp_posts` as p
  14. LEFT JOIN `wp_users` as u on u.ID = p.post_author
  15. LEFT JOIN `wp_posts` as t on t.ID = p.post_parent
  16. LEFT JOIN `wp_comments` as com on com.comment_post_ID = p.ID
  17. LEFT JOIN `wp_users` as com_u on com_u.ID = com.user_id
  18. WHERE ((p.post_type = 'reply' OR p.post_type = 'topic' OR p.post_type = 'post')
  19.     AND p.post_status = 'publish'
  20.     AND p.post_content <> '')
  21.     OR com.comment_approved = '1'
  22. GROUP BY post_parent)
  23. ORDER BY max_post_date DESC
  24. LIMIT 0,12
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×