﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
14562,manage_users_custom_column is both an action and a filter,mikelittle,westi,"In wp-admin/includes/template.php function user_row(), filter 'manage_users_custom_column' is called with 3 parameters and is expected to return the contents for the custom column.

However, in wp-admin/ms-users.php, action 'manage_users_custom_column' is called with two parameters and is expected to echo the contents for the custom column.

They both have the same name which is initially confusing, but worse it breaks WordPress.

I tried using two functions
add_filter( 'manage_users_custom_column', 'function1', 10, 3);
and 
add_action( 'manage_users_custom_column', 'function2', 10, 2);

But *BOTH* functions are called during the filter processing and *BOTH* functions are called during action processing. 

That is, during filter processing, function1 is called with the correct three parameters, then function2 is called with the output of function1 as the first parameter and what should be the first parameter as it's second parameter.

During action processing, function1 is called with the two action parameters (and a warning for the missing third), then function2 is called correctly.

There seem to be two issues here: 
1) the action and the filter should not really have the same name. Ideally custom user column functionality in the two places should be brought into line.

2) a registered action should not be called during filter processing and vice versa, but maybe that's a side effect of the names being the same and the behaviour in those circumstances is not defined.


Code to reproduce:

{{{
add_filter('manage_users_columns', 'add_users_column');
add_filter('wpmu_users_columns', 'add_users_column');
function add_users_column($column_headers) {
	$column_headers['myextra'] = 'My Extra';
	return $column_headers;
}

add_filter('manage_users_custom_column', 'function1', 10, 3);
function function1($default, $column_name, $user_id) {
	error_log( ""function1 called with (default=$default, column_name=$column_name, user_id=$user_id)"" );
	if ('myextra' == $column_name) {
		return ""function1 called with ($default, $column_name, $user_id)"";
	}
	return $default;
}

add_action('manage_users_custom_column', 'function2', 10, 2);
function function2($column_name, $user_id) {
	error_log( ""function2 called with (column_name=$column_name, user_id=$user_id)"" );
	if ('myextra' == $column_name) {
		echo ""(function2 called with $column_name, $user_id)"";
	}
}

}}}
",defect (bug),closed,normal,3.1,Administration,3.0.1,major,fixed,has-patch,scribu@… WordPress@…
