Page MenuHomePhabricator

Extensions adding menu items to 'user-menu' should not appear under "Pages for logged out editors"
Closed, ResolvedPublic

Description

Background

Because of the way user links was implemented, for anon users the "login" and "create account" menu items inside the user links dropdown are hardcoded, while the "talk" and "contribute" links aren't, and are part of the default 'user-menu' bucket. This should be reversed, "talk" and "contribute" should be hardcoded because Vector22 has a custom label "Pages for logged out editors".

Currently:

Screenshot 2023-02-06 at 2.01.40 PM.png (502×692 px, 45 KB)

Proposed:

Screenshot 2023-02-06 at 1.56.47 PM.png (414×592 px, 38 KB)

Event Timeline

bwang renamed this task from Gadget/extensions adding to 'user-menu' should not appear under to Gadget/extensions adding menu items to 'user-menu' should not appear under .Feb 6 2023, 7:57 PM
bwang renamed this task from Gadget/extensions adding menu items to 'user-menu' should not appear under to Gadget/extensions adding menu items to 'user-menu' should not appear under "Pages for logged out editors".Feb 6 2023, 8:02 PM
bwang updated the task description. (Show Details)

Change 885910 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/skins/Vector@master] Remove custom handling of user links menu items and handle case when anon editor links are disabled

https://gerrit.wikimedia.org/r/885910

. Gadget/extensions adding menu items to 'user-menu' should not appear under "Pages for logged out editors"

Could you share the gadget code being used that's causing this?

Ah I'm not aware of any gadgets that are doing this now, but I was using this example code in LocalSettings.php

$wgHooks['SkinTemplateNavigation::Universal'][] = function ( $skinTemplate, &$links ) {
	$links['user-menu']['extension'] = [
			'link-class' => [ 'ext' ],
			'class' => [ 'ext' ],
			'text' => 'I am an extension',
			'href' => 'https://mediawiki.org'
	];
};
Jdlrobson renamed this task from Gadget/extensions adding menu items to 'user-menu' should not appear under "Pages for logged out editors" to Extensions adding menu items to 'user-menu' should not appear under "Pages for logged out editors".EditedFeb 9 2023, 10:00 PM

Okay so that code can only be used in extensions. It looks like it is working as expected now on current master - the link is appended to the end of the list just as it should be? (and I get the same result before/after https://gerrit.wikimedia.org/r/885910)

Screen Shot 2023-02-09 at 2.01.37 PM.png (289×467 px, 20 KB)

Jdlrobson changed the task status from Open to Stalled.Feb 9 2023, 10:02 PM

Change 885910 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Remove custom handling of user links menu items and handle case when anon editor links are disabled

https://gerrit.wikimedia.org/r/885910