Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: Show Team ID
- Plugin URI: http://blog.ashfame.com/?p=876
- Description: Provides a shortcode to show team id.
- Author: Ashfame
- Author URI: http://blog.ashfame.com/
- License: GPL
- Usage:
- */
- add_shortcode ( 'show_recent_comments_results', 'show_recent_comments_results_handler' );
- function show_recent_comments_results_handler( $atts, $content = null )
- {
- extract( shortcode_atts( array(
- "count" => 10,
- "theid" => $post_id = $GLOBALS['post']->ID,
- "pretty_permalink" => 0
- ), $atts ));
- $output = ''; // this holds the output
- if ( is_user_logged_in() )
- {
- global $current_user;
- get_currentuserinfo();
- $args = array(
- 'post_id' => $theid, // the id
- 'user_id' => $current_user->ID,
- 'number' => $count, // how many comments to retrieve
- 'status' => 'approve'
- );
- $comments = get_comments( $args );
- if ( $comments )
- {
- $output.= "<ul>\n";
- foreach ( $comments as $c )
- {
- $output.= "";
- if ( $pretty_permalink ) // uses a lot more queries (not recommended)
- $output.= '<a href="'.get_comment_link( $c->comment_ID ).'"></a>';
- else
- $output.= 'ID: ';
- $output.= apply_filters('comment_ID',$c-> comment_ID);
- if ( $pretty_permalink ) $output.= '<a href="'.get_settings('siteurl').'/?page_id='.$c->comment_post_ID.'#comment-'.$c->comment_ID.'">Go to team.</a>';
- $output.= "\n";
- }
- $output.= '</ul>';
- }
- else
- {
- $output.= "<ul>";
- $output.= "";
- }
- }
- else
- {
- $output.= "";
- }
- return $output;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement