Created
June 4, 2012 03:14
-
-
Save thefuxia/2866124 to your computer and use it in GitHub Desktop.
T5 Comment moderation links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php # -*- coding: utf-8 -*- | |
/** | |
* Plugin Name: T5 Comment moderation links | |
* Version: 2012.06.04 | |
* Author: Thomas Scholz <info@toscho.de> | |
* Author URI: http://toscho.de | |
* License: MIT | |
* License URI: http://www.opensource.org/licenses/mit-license.php | |
*/ | |
if ( ! function_exists( 't5_comment_mod_links' ) ) | |
{ | |
add_filter( 'edit_comment_link', 't5_comment_mod_links', 10, 2 ); | |
/** | |
* Adds Spam and Delete links to the Sdit link. | |
* | |
* @wp-hook edit_comment_link | |
* @param string $link Edit link markup | |
* @param int $id Comment ID | |
* @return string | |
*/ | |
function t5_comment_mod_links( $link, $id ) | |
{ | |
$template = ' <a class="comment-edit-link" href="%1$s%2$s">%3$s</a>'; | |
$admin_url = admin_url( "comment.php?c=$id&action=" ); | |
// Mark as Spam. | |
$link .= sprintf( $template, $admin_url, 'cdc&dt=spam', __( 'Spam' ) ); | |
// Delete. | |
$link .= sprintf( $template, $admin_url, 'cdc', __( 'Delete' ) ); | |
return $link; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment