« Return to Thread: row output on wp-admin/users.php

Re: row output on wp-admin/users.php

by Claudio Simeone :: Rate this Message:

Reply to Author | View in Thread

2009/6/12 Dan Cameron <dan@...>:
>> manage_users_custom_column
>
> I should mention that function only works in WP 2.8, looks like someone ran
> into the same problem and fixed it in a more elegant solution.


Hi,

seems that this hook does not work good in 2.8.1. I'm trying to add a
custom column with these functions:

add_filter('manage_users_columns', 'my_user_cols_columns'); // this works
add_action('manage_users_custom_column', my_user_cols_cc'); // this not

function my_user_cols_columns($defaults) {
    $defaults['courses'] = 'My Column';
    return $defaults;
}

function my_user_cols_cc($column, $user) {
if( $column == 'courses' ) {
    echo '=>'.$user;
    }
}

but it seems that the function my_user_cols_cc does not receive the
arguments. Or at least it does not work same as the post columns.
Googling around, I found this post:
http://blog.5ubliminal.com/posts/incoherency-in-wordpress-custom-columns-actions-vs-filters/

So my question is: the issues explained in this post, have been fixed?
If i try to apply this patch to wp-admin/includes/template.php

ob_start(); // Start ob
do_action('manage_users_custom_column', $column_name, $user_object->ID);
$res = ob_get_contents(); // Get ob contents
ob_end_clean(); // Clean ob
$r .= $res; // Append captured output

it passes the column_name, but not the user id. The same as if i modify:

$r .= apply_filters('manage_users_custom_column', '',$column_name,
$user_object->ID);
to
$r .= apply_filters('manage_users_custom_column', $column_name,
$user_object->ID);

is this a bug or I did not understand good how this hook works?

thanks in advance
CLS
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

 « Return to Thread: row output on wp-admin/users.php