WordPress.org

Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#9605 closed feature request (duplicate)

screen_options for plugins

Reported by: arena Owned by: arena
Milestone: Priority: high
Severity: normal Version: 2.8
Component: Administration Keywords: has-patch needs-testing
Focuses: Cc:

Description

In order to allow plugins to integrate this new wp feature !

function screen_options($screen) {
	switch ( $screen ) {
		case 'edit':
			$per_page_label = __('Posts per page:');
			break;
		case 'edit-pages':
			$per_page_label = __('Pages per page:');
			break;
		case 'edit-comments':
			$per_page_label = __('Comments per page:');
			break;
		case 'upload':
			$per_page_label = __('Media items per page:');
			break;
		case 'categories':
			$per_page_label = __('Categories per page:');
			break;
		case 'edit-tags':
			$per_page_label = __('Tags per page:');
			break;
		case 'plugins':
			$per_page_label = __('Plugins per page:');
			break;
		default:
			return '';
	}

to be replaced by

function screen_options($screen) {

	$per_page_labels 			= array();
	$per_page_labels['edit'] 		= __('Posts per page:');
	$per_page_labels['edit-pages'] 		= __('Pages per page:');
	$per_page_labels['edit-comments'] 	= __('Comments per page:');
	$per_page_labels['upload'] 		= __('Media items per page:');
	$per_page_labels['categories'] 		= __('Categories per page:');
	$per_page_labels[edit-tags'] 		= __('Tags per page:');
	$per_page_labels['plugins'] 		= __('Plugins per page:');

	
	$per_page_labels = apply_filters('per_page_labels', $per_page_labels, $screen);

	if (!isset($per_page_labels[$screen])) return '';

	$per_page_label = $per_page_labels[$screen];

Attachments (2)

screen_options.diff (1.6 KB) - added by arena 11 years ago.
#9605.diff (700 bytes) - added by arena 11 years ago.
simple and trivial !

Download all attachments as: .zip

Change History (15)

#1 @arena
11 years ago

in the new code,

this line :

	$per_page_labels[edit-tags'] 		= __('Tags per page:');

should be

	$per_page_labels['edit-tags'] 		= __('Tags per page:');

#2 @arena
11 years ago

  • Owner changed from anonymous to arena

#3 @arena
11 years ago

  • Keywords needs-testing added

#4 @arena
11 years ago

  • Milestone changed from Unassigned to 2.8

#5 @ShaneF
11 years ago

  • Keywords commit added; needs-testing removed

No problems here. Good to go!

#6 @Denis-de-Bernardy
11 years ago

  • Keywords tested added

#7 @ryan
11 years ago

screen_options() is pretty worthless to plugins until it can allow them to add arbitrary options. Any patches should be in that direction.

#8 @Denis-de-Bernardy
11 years ago

  • Keywords needs-patch added; has-patch tested commit removed

#9 @hakre
11 years ago

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

Duplicate of: #9657

I like the Idea, it is a little different from the one that I had. #9657 provides a full modularization to even add your own screen_options tab(s).

#10 @arena
11 years ago

  • Keywords has-patch needs-testing added; needs-patch removed
  • Milestone changed from 2.8 to 2.8.1
  • Resolution duplicate deleted
  • Status changed from closed to reopened

I reopened this ticket because #9657 is not active anymore.

Here is a simple fix of what could be done.

See last patch posted : #9605.diff

@arena
11 years ago

simple and trivial !

#11 follow-up: @Denis-de-Bernardy
11 years ago

  • Milestone 2.8.1 deleted
  • Resolution set to duplicate
  • Status changed from reopened to closed

this patch would break plugins that use that function.

please use #9657

#12 in reply to: ↑ 11 @arena
11 years ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

Replying to Denis-de-Bernardy:

this patch would break plugins that use that function.

please use #9657

Sorry, i don't get it !

Using a filter will make no damage, if the filter is properly coded of course !

Being able to add some options in the option screen tab is (should be) complementary to add new tabs !!!

#13 @Denis-de-Bernardy
11 years ago

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

still a dup. I've added your patch to #9657, please keep this one closed. there are too many tickets.

Note: See TracTickets for help on using tickets.