WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#9002 closed defect (bug) (duplicate)

Custom columns not populated for user edit screen

Reported by: PeteHoliday Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7
Component: Administration Keywords:
Focuses: Cc:

Description

While the "manage_posts_columns" filter is properly called, custom columns are not populated properly.

Custom columns for other edit screens are populated by firing an action typically out of a switch statement. For custom columns in the post edit screen, this switch statement is located in template.php at line 1322. The default case (line 1482) fires the 'manage_posts_custom_column' action.

The analogous switch statement for the users edit screen can be located at line 1843 of template.php. This switch statement lacks a default case, where the 'manage_users_custom_column' action should be fired. The default case should probably be inserted between lines 1869 and 1870.

Change History (2)

#1 @PeteHoliday
9 years ago

  • Milestone changed from 2.8 to 2.7.1

I took a look at this function in the 2.71 beta and decided to see if I could make this work. Because of the way this function operates (by returning a value rather than outputting directly), it seems that this needs to be done with a filter.

If the following code is added after line 1871 in wp-admin/includes/template.php, the missing functionality is restored:

	break;
default:
	$custom_column = array(
		'column_name'  => $column_name,
		'user_id'      => $user_object->ID,
		'contents'     => ''
	);
	$custom_column = apply_filters('manage_users_custom_column', $custom_column);
	$r .= "<td>{$custom_column[contents]}</td>";
	break;

I'm not sure what the procedure is for submitting this change for inclusion in 2.7.1 or a future version.

Note: the initial break; statement is required to end the 'posts' case and is included intentionally.

#2 @ryan
9 years ago

  • Milestone 2.7.1 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

See #8788

Note: See TracTickets for help on using tickets.