SO网友:J. Doe Cd
Solved with:
function myplugin_comment_columns( $columns )
{
return array_merge( $columns, array(
\'ruolo\' => __( \'Ruolo\' )
) );
}
add_filter( \'manage_edit-comments_columns\', \'myplugin_comment_columns\' );
function myplugin_comment_column( $column, $comment_ID )
{
switch ( $column ) {
case \'ruolo\':
if(get_comment($comment_ID)->user_id != "0")
{
if(get_comment($comment_ID)->user_id != "1")
{
$ruolo = "";
$user_meta=get_userdata(get_comment($comment_ID)->user_id);
$ruolo = "Registrato";
if(in_array(\'vip\', ( array )$user_meta->roles))
$ruolo = "VIP";
if(in_array(\'donator\', ( array )$user_meta->roles))
$ruolo = "Donatore";
}
else
{$ruolo = "Admin";}
echo $ruolo;
}
else
echo "-" ;
break;
}
}
add_filter( \'manage_comments_custom_column\', \'myplugin_comment_column\', 10, 2 );