WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#8246 closed defect (bug) (fixed)

screen_meta and plugins and columns and 2.7beta3 ???

Reported by: arena Owned by:
Milestone: 2.7 Priority: high
Severity: major Version:
Component: Administration Keywords:
Focuses: Cc:

Description

screen_meta($screen)
3209 if ( !meta_box_prefs($screen) && isset($column_screens[$screen]) ) {
3210 manage_columns_prefs($column_screens[$screen]);

How do i set array $column_screens for my specific screen (in fact page plugin ...)

suggestion :

3189 $column_screens = apply_filters('column_screens', $column_screens, $screen);

thanks

Change History (9)

comment:1 in reply to: ↑ description @arena7 years ago

Replying to arena:

screen_meta($screen)
3209 if ( !meta_box_prefs($screen) && isset($column_screens[$screen]) ) {
3210 manage_columns_prefs($column_screens[$screen]);

How do i set array $column_screens for my specific screen (in fact page plugin ...)

suggestion :

3189 $column_screens = apply_filters('column_screens', $column_screens, $screen);

Or another suggestion could be :

$column_screens = array('edit' => 'post', 'edit-pages' => 'page', 'edit-tags' => 'tag', 'categories' => 'category',

'edit-link-categories' => 'link-category', 'link-manager' => 'link', 'users' => 'user', 'upload' => 'media',
'edit-comments' => 'comment', $screen => $screen);

thanks

comment:2 @arena7 years ago

Or another suggestion could be :

$column_screens = array(

'edit' => 'post',
'edit-pages' => 'page',
'edit-tags' => 'tag',
'categories' => 'category',
'edit-link-categories' => 'link-category',
'link-manager' => 'link',
'users' => 'user',
'upload' => 'media',
'edit-comments' => 'comment',
$screen => $screen);

comment:3 @ryan7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [9735]) Key screen meta off of page hook. fixes #8246

comment:4 follow-up: @ryan7 years ago

If your page registers columns with "manage_$pagehook_columns" screen meta should now recognize it.

comment:5 in reply to: ↑ 4 @arena7 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Replying to ryan:

If your page registers columns with "manage_$pagehook_columns" screen meta should now recognize it.

From 2.7beta3

1) Sorry, i don't get it, here is the beginning of screen_meta :

$column_screens = array('edit' => 'post', 'edit-pages' => 'page', 'edit-tags' => 'tag', 'categories' => 'category', 'edit-link-categories' => 'link-category', 'link-manager' => 'link', 'users' => 'user', 'upload' => 'media', 'edit-comments' => 'comment');

	$screen = str_replace('-new', '', $screen);
	$screen = str_replace('-add', '', $screen);
	$meta_screens = array('index' => 'dashboard');

	if ( isset($meta_screens[$screen]) )
		$screen = $meta_screens[$screen];
	$show_screen = false;
	if ( !empty($wp_meta_boxes[$screen]) || !empty($column_screens[$screen]) )
		$show_screen = true;

so how $column_screens can have my page hook ?

2) The other problem is that pagehook value varies

. if you have your own top menu or not ...
. if your page is (due to role and capabilities) in first place as a submenu or not (toplevel) ...
. if it is translated ... (page name)

3) btw in admin-header in the following code :

$hook_suffix = '';
if ( isset($page_hook) )
	$hook_suffix = "$page_hook";
else if ( isset($plugin_page) )
	$hook_suffix = "$plugin_page";
else if ( isset($pagenow) )
	$hook_suffix = "$pagenow";

else if ( isset($plugin_page) ) is never reached because in admin.php you have this code :

if (isset($plugin_page)) {
	if( ! $page_hook = get_plugin_page_hook($plugin_page, $pagenow) ) {
		$page_hook = get_plugin_page_hook($plugin_page, $plugin_page);

comment:6 @ryan7 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Beta3 doesn't have the latest changes. You need to svn update or Tools->Update. The page hook is returned when you register the hook with add_*_page().

Start a thread on wp-hackers with your questions. Trac is not a good place for plugin development discussion.

comment:7 @arena7 years ago

ok ! so i did tweak it but now i am facing another issue :

my hook is toto_page_tata_titi

and in admin-ajax we have :

if ( !preg_match( '/[a-z-]+$/', $page ) ) {

die(-1);

}

so _ is not accepted ...

comment:8 @ryan7 years ago

(In [9759]) Allow underscores in page names for meta box and column requests. see #8246

comment:9 @ryan7 years ago

Underscores are now allowed.

Note: See TracTickets for help on using tickets.