Ticket #3903 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Admin header should use bloginfo rather than get_option for blog name

Reported by: jhodgdon Assigned to: anonymous
Priority: normal Milestone: 2.2
Component: Administration Version: 2.1.2
Severity: normal Keywords: has-patch
Cc:

Description

When on the Admin pages of WordPress, admin_header.php puts the blog's name on the screen in big type at the top, by calling get_option('blogname'). This is a problem because it is not really possible to filter this text, to make it look reasonable, and some plugins might want/need to (e.g. Polyglot).

The reason you cannot filter get_option('blogname') is because the options put into the option-setting form from options_general.php (i.e. the General tab of the Options section of the Admin screens) are also derived from get_option. So if you define a filter for get_option_blogname, then that filter will also be used to filter what goes into the option-setting form. But the form needs to display unfiltered actual input so the user can see what is actually in the database.

The solution is to use bloginfo('name') in the admin header in place of get_option('blogname'), because bloginfo can definitely be filtered. Also the blog title displayed on the admin form is then more consistent with the standard used to display the blog's name in the default theme (and many other themes) in the blog header.

Attachments

admin-header-php.diff (1.0 kB) - added by jhodgdon on 03/04/07 16:09:41.
admin-header-php3.diff (1.0 kB) - added by jhodgdon on 04/12/07 21:43:18.
Working patch that filters correctly

Change History

03/04/07 16:09:41 changed by jhodgdon

  • attachment admin-header-php.diff added.

03/04/07 16:10:07 changed by jhodgdon

  • keywords set to has-patch.

03/07/07 02:26:14 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

(In [4982]) Use get_bloginfo to get the blog name. Props jhodgdon. fixes #3903

04/12/07 21:30:05 changed by jhodgdon

  • keywords changed from has-patch to needs-patch.
  • status changed from closed to reopened.
  • resolution deleted.

The applied fix does not work, because get_bloginfo is not filtered any more than get_option is filtered.

I realize why the fix I had suggested was not applied (because bloginfo echos the result, which means the texturize is not really applied), but definitely the fix that was put in is no good either.

Suggestions?

04/12/07 21:30:57 changed by jhodgdon

By the way, I just tested in [5243].

04/12/07 21:43:18 changed by jhodgdon

  • attachment admin-header-php3.diff added.

Working patch that filters correctly

04/12/07 21:44:30 changed by jhodgdon

  • keywords changed from needs-patch to has-patch.

The patch I just added does the filtering correctly, works in [5243], and still applies wp_texturize. Any way it could be added to 2.2?

04/14/07 00:15:25 changed by rob1n

wptexturize() is added as a filter to 'bloginfo' in default-filters.php already.

04/14/07 00:16:40 changed by rob1n

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [5268]) Just use bloginfo(). Props jhodgdon. fixes #3903