[wp-hackers] trying to understand the Admin API ...
changing default values for visible Screen Options
Tom Ransom
lists at 1bigidea.com
Tue Dec 16 21:20:05 GMT 2008
I can't presume to speak for the core team. And I need to clarify -
the checkbox that are set within the Screen Options do persist - but
the visibility of the Screen Options area doesn't.
I'd suggest that the thought was - it isn't something that you'd
change often after you get it setup to your preferred layout.
The checkboxes persist from session to session and are managed as an
option -
take a look in wp-admin/includes/template.php
function get_hidden_columns($page) {
$page = str_replace('.php', '', $page);
return (array) get_user_option( 'manage-' . $page . '-columns-
hidden', 0, false );
}
- Tom Ransom
On Dec 16, 2008, at 10:49 AM, Mindshare Studios wrote:
> 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
>
> _______________________________________________
> 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