Make WordPress Core

Opened 10 years ago

Closed 10 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:


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 10 years ago.
alt.15903.diff (543 bytes) - added by scribu 10 years ago.
PHP4 compat
15903.diff (516 bytes) - added by scribu 10 years ago.
Fix notice
define.15903.diff (1.1 KB) - added by scribu 10 years ago.

Download all attachments as: .zip

Change History (15)

10 years ago

#1 @PeteMall
10 years ago

  • Keywords commit added

#2 @scribu
10 years ago

  • Keywords commit removed

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

#3 @nacin
10 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.

#4 @scribu
10 years ago

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

#5 @nacin
10 years ago

You can't chain in PHP4.

10 years ago

PHP4 compat

#6 @scribu
10 years ago

Forgot. Updated patch.

It would make r16194 unnecessary too.

#7 @nacin
10 years ago

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

#8 @ryan
10 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

10 years ago

Fix notice

#9 @scribu
10 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.

#10 @scribu
10 years ago

Wondering wether it would be better to define WP_NETWORK_ADMIN instead.

10 years ago

#11 @ryan
10 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.