[wp-hackers] trying to understand the Admin API ... changing default values for visible Screen Options

Mindshare Studios info at mindsharestudios.com
Tue Dec 16 18:49:55 GMT 2008


Thanks Tom.... That seems really useless that the Screen Options are not
persistent - I just assumed they would stored in the DB. How handy is it to
have to set your preferences every time you login? Was there any rationale
for making it this way?

Damian Taggart

-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Tom Ransom
Sent: Tuesday, December 16, 2008 10:45 AM
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] trying to understand the Admin API ... changing
default values for visible Screen Options

You'll want to drop a javascript in the wp-admin footer - that does  
what you want.

The relevant code from wp-admin/common.js is

	// screen settings tab
	$('#show-settings-link').click(function () {
		if ( !
$('#screen-options-wrap').hasClass('screen-options-open') ) {
	
$('#contextual-help-link-wrap').addClass('invisible');
		}
		$('#screen-options-wrap').slideToggle('fast', function(){
			if ( $(this).hasClass('screen-options-open') ) {
	
$('#show-settings-link').css({'backgroundImage':'url("images/ 
screen-options-right.gif")'});
	
$('#contextual-help-link-wrap').removeClass('invisible');
				$(this).removeClass('screen-options-open');

			} else {
	
$('#show-settings-link').css({'backgroundImage':'url("images/ 
screen-options-right-up.gif")'});
				$(this).addClass('screen-options-open');
			}
		});
		return false;
	});

----------------------------------------
It doesn't appear that the condition of the Screen Options tab  
persists from session to session. So dropping a custom jQuery code  
should see which class it has when it executes and set the desired  
action. If you want to persist the status - you could have a simple  
Ajax call to a function in your plugin - that stored the status in a  
Option.


- Tom Ransom


On Dec 16, 2008, at 8:11 AM, Mindshare Studios wrote:

> I've been checking out the code in wp-admin/includes/template.php  
> looking
> for a hook that will allow me to set the default visibility for admin
> "Screen Options" in 2.7 via a plugin. Can anyone point me in the right
> direction?
>
>
>
> Thanks,
>
> Damian Taggart
>
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list