Page MenuHomePhabricator

Add a CSS class to target IP user pages
Open, LowPublic


Author: rememberthedot

Please add a CSS class that targets IP user pages. This would be useful for applying custom CSS rules to IP user pages. For example, a user could choose to set "visibility:hidden" on all IP user page links, because IP addresses generally do not use user pages. The CSS to do that could be:

.ns-3.ip-userpage #ca-nstab-user a {

visibility: hidden;


Or the following could be used to make gray, but not remove, links to nonexistant user pages:
.ns-3.ip-userpage a {

color: #7D7D7D;


I've created a patch, based on MediaWiki 1.11.0, that provides this behavior. It adds "ip-userpage" to <body>'s class attribute.

Since this isn't a major change, hopefully you developers will be more willing to implement it ;-)

Version: unspecified
Severity: enhancement



Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:00 PM
bzimport added a project: MediaWiki-Interface.
bzimport set Reference to bz12509.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Jan 5 2008, 2:09 AM

rememberthedot wrote:

SkinTemplate patch

attachment SkinTemplate patch.txt ignored as obsolete

rememberthedot wrote:

MonoBook.php patch

attachment MonoBook patch.txt ignored as obsolete

rememberthedot wrote:

SkinTemplate.php patch

Fixed patch to prevent ip-userpage class from appearing outside the User and User_talk namespaces

attachment SkinTemplate patch.txt ignored as obsolete

brion added a comment.Jan 7 2008, 6:53 PM

That would hide or gray out links that are *on* an IP user page, not links *to an IP user page.

rememberthedot wrote:

Look again. It does nothing of the kind.

rememberthedot wrote:

It could be used to gray out all links on an IP user page, but I doubt anyone will want to do that, and that's not what I intended this code to be used for. I intend to use it to gray out the "user page" tab for IP editors, rather than having it appear in glaring red.

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

sumanah wrote:

Adding the "design" keyword since this is partly a visual design change.

These patches don't apply at all, marking them as obsolete.

pageclass et al seem to have disappeared in one of the recent skin system refactorings, so I don't really know how to apply this to trunk.

Removing design keyword, it's not really needed IMO because the default design isn't changed at all, this'll just enable people to do certain things in their own CSS more conveniently.

sumanah wrote:

rememberthedot, are you interested in revising this patch to work with current trunk? Thanks!

The proper way to do this now in current code:

  • Use userpage-anon and userpage-user for classes, they fit in better with the ns-* page-* pattern that we already have going with classes. ip-userpage is an odd break from that. (note don't use something like page-anonuser since that would conflict with a page titled [[Anonuser]])
  • Code would go in OutputPage::headElement, likely right after the $bodyAttrs['class'] .= ' ' . $sk->getPageClasses( $this->getTitle() ); line.
  • You'd probably move the $this->getTitle() from that to a $title variable and use it in getPageClasses as well.

if ( $title->getNamespace() == NS_USER || $title->getNamespace() == NS_USER_TALK ) {

// Don't show the class on subpages
if ( !$title->isSubpage() ) {
  $bodyAttrs['class'] .= ' ' . ( User::isIP( $this->getTitle() ) ? 'userpage-anon' : 'userpage-user' );


Izno moved this task from Backlog to Change CSS Hook on the CSS board.Sep 7 2018, 4:51 PM