WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#15903 closed defect (bug) (fixed)

Don't use self_admin_url() on ms-users list

Reported by: ocean90 Owned by: ryan
Milestone: 3.1 Priority: high
Severity: major Version: 3.1
Component: Network Admin Keywords: has-patch
Focuses: multisite Cc:

Description

self_admin_url() returns only the network url, if is_network_admin() is true.

The problem, if we have an AJAX request is_network_admin() is always false.

On network/users I have on page 2 a user which I want to grant super admin privileges. But it's not possible because it the edit link is linked to wp-admin/user-edit.php and not to wp-admin/network/user-edit.php.

The fix would be to use network_admin_url() here, because the ms-user list class is used only in the network admin.

Attachments (4)

15903.patch (1.6 KB) - added by ocean90 4 years ago.
alt.15903.diff (543 bytes) - added by scribu 4 years ago.
PHP4 compat
15903.diff (516 bytes) - added by scribu 4 years ago.
Fix notice
define.15903.diff (1.1 KB) - added by scribu 4 years ago.

Download all attachments as: .zip

Change History (15)

@ocean904 years ago

comment:1 @PeteMall4 years ago

  • Keywords commit added

comment:2 @scribu4 years ago

  • Keywords commit removed

A better approach would be to make is_network_admin() smarter. Incoming patch.

comment:3 @nacin4 years ago

Arguably, an approach to top that would be to create network/admin-ajax.php, but that was not implemented after some discussion a while ago.

Would rather not mess with network_admin at this stage.

comment:4 @scribu4 years ago

alt.15903.diff makes is_network_admin() check the screen object for ajax requests.

comment:5 @nacin4 years ago

You can't chain in PHP4.

@scribu4 years ago

PHP4 compat

comment:6 @scribu4 years ago

Forgot. Updated patch.

It would make r16194 unnecessary too.

comment:7 @nacin4 years ago

  • Owner set to ryan
  • Status changed from new to assigned

comment:8 @ryan4 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [17077]) Check is_network in the screen object for AJAX requests. Props scribu. fixes #15903

@scribu4 years ago

Fix notice

comment:9 @scribu4 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

I forgot that set_current_screen() calls is_network_admin(). This causes a notice, which can cause AJAX requests to fail. Spotted by garyc40 in IRC.

15903.diff fixes it.

comment:10 @scribu4 years ago

Wondering wether it would be better to define WP_NETWORK_ADMIN instead.

@scribu4 years ago

comment:11 @ryan4 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [17080]) Define net and user admin constants for fetch-list case. Props scribu. fixes #15903

Note: See TracTickets for help on using tickets.