Make WordPress Core

Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#61122 closed defect (bug) (fixed)

Missing file wp-admin/user/contribute.php

Reported by: ignatiusjeroe's profile ignatiusjeroe Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 6.6 Priority: normal
Severity: minor Version: 6.3
Component: Help/About Keywords: has-patch
Focuses: multisite Cc:

Description

wp-admin/user/privacy.php
wp-admin/user/freedoms.php
wp-admin/user/credits.php
wp-admin/user/about.php

The above pages all have the same navigation links (see attached image). The navigation contains an URL wp-admin/user/contribute.php. But this file is missing. Result: 404 error

Attachments (1)

Screen Shot 2024-05-02 at 07.51.55.png (159.9 KB) - added by ignatiusjeroe 3 months ago.

Download all attachments as: .zip

Change History (16)

#1 @audrasjb
3 months ago

  • Keywords reporter-feedback added

Hello and thanks for opening this ticket,

I can't reproduce the issue because I can't find any link to wp-admin/user/contribute.php in any About screen (I tested both on a single site and a multisite installation). Could you please be more precise about where the issue is located?

Thanks

#2 follow-up: @TobiasBg
3 months ago

  • Milestone changed from Awaiting Review to 6.6

I can reproduce this when directly going to
https://example.org/wp-admin/user/about.php
where example.org is a multisite installation.
(I couldn't find a way to navigate to these screens though.)

Looks like, this is pretty similar to [56309].

The /wp-admin/user/ directory does indeed contain "wrapper" files for wp-admin/privacy.php, wp-admin/freedoms.php, wp-admin/credits.php, and wp-admin/about.php -- but not wp-admin/contribute.php.

To fix this, a new file wp-admin/user/contribute.php with the content

<?php
/**
 * User Dashboard Contribute administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 * @since 6.6.0
 */

/** Load WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

require ABSPATH . 'wp-admin/contribute.php';

needs to be added.

#3 @TobiasBg
3 months ago

  • Component changed from General to Help/About
  • Keywords reporter-feedback removed
  • Version set to 6.3

#4 in reply to: ↑ description @ignatiusjeroe
3 months ago

Replying to ignatiusjeroe:

wp-admin/user/privacy.php
wp-admin/user/freedoms.php
wp-admin/user/credits.php
wp-admin/user/about.php

The above pages all have the same navigation links (see attached image). The navigation contains an URL wp-admin/user/contribute.php. But this file is missing. Result: 404 error

Sorry for the lack of instructions on how to reproduce the bug. Please visit any of the pages
yoursite.com/wp-admin/user/privacy.php
yoursite.com/wp-admin/user/freedoms.php
yoursite.com/wp-admin/user/credits.php
yoursite.com/wp-admin/user/about.php

Make sure that multisite is enabled, else it wont work. The pages should look something like the attached image (minus the url highlight, that is a dev tool used to illustrate the links on the page). Now click on the link Get involved. This causes an 404 error because there is physical file wp-admin/user/contribute.php

Solution:
create wp-admin/user/contribute.php and copy the content of wp-admin/network/contribute.php into it.

#5 in reply to: ↑ 2 ; follow-up: @ignatiusjeroe
3 months ago

Replying to TobiasBg:

I can reproduce this when directly going to
https://example.org/wp-admin/user/about.php
where example.org is a multisite installation.
(I couldn't find a way to navigate to these screens though.)

Looks like, this is pretty similar to [56309].

The /wp-admin/user/ directory does indeed contain "wrapper" files for wp-admin/privacy.php, wp-admin/freedoms.php, wp-admin/credits.php, and wp-admin/about.php -- but not wp-admin/contribute.php.

To fix this, a new file wp-admin/user/contribute.php with the content

<?php
/**
 * User Dashboard Contribute administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 * @since 6.6.0
 */

/** Load WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

require ABSPATH . 'wp-admin/contribute.php';

needs to be added.

This might not be the right place to pose a question, but you seem knowledgeable on the matter. What is directory wp-admin/user/ used for? I know what the wp-admin/network is used for. But I cant see anywhere in the code where any file in directory wp-admin/user/ is used for. It seems like a deprecated directory. If there is any use-case for it I'd like to know.

#6 @johnjamesjacoby
3 months ago

  • Keywords needs-patch added
  • Owner set to johnjamesjacoby
  • Status changed from new to assigned

#7 in reply to: ↑ 5 @TobiasBg
3 months ago

Replying to ignatiusjeroe:

What is directory wp-admin/user/ used for? I know what the wp-admin/network is used for. But I cant see anywhere in the code where any file in directory wp-admin/user/ is used for. It seems like a deprecated directory. If there is any use-case for it I'd like to know.

I'm actually not sure. The code refers to "User Admin" screens. This is likely a legacy "area" from the pre-Multisite merge (in WordPress 3.0). It doesn't appear that it's used nowadays, so it's indeed possible that this is "soft-deprecated" and only exists for backward compatibility.

This ticket was mentioned in PR #6499 on WordPress/wordpress-develop by @shailu25.


3 months ago
#8

  • Keywords has-patch added; needs-patch removed

#9 @audrasjb
3 months ago

It's indeed a legacy directory. Let's add a contribute.php file in the /user directory, just like we did with the privacy.php file in WP 4.9. See [42116].

The PR looks good to me.

#10 follow-up: @ignatiusjeroe
3 months ago

This directory is deprecated. All files should have @deprecated comment. It took me hours to investigate/study its utility just to find out its not used anymore. Would have saved me hours of work if it was clearly stated its deprecated.

#11 in reply to: ↑ 10 @johnjamesjacoby
3 months ago

Replying to ignatiusjeroe:

This directory is deprecated. All files should have @deprecated comment. It took me hours to investigate/study its utility just to find out its not used anymore. Would have saved me hours of work if it was clearly stated its deprecated.

The user dashboard is not deprecated, which is why it is not stated as such.

It might be old & niche, but there is no alternative, so please do not label it Deprecated/Legacy.

Plugins and non-core services have always been able to extend this, and I have several that do.

There is even a ticket someplace to consider making it available to single-site installations.

The original intent of the User Dashboard was to have a place to redirect a logged-in user (on a multisite installation) who does not have a role on any site to redirect them to.

Agree with @audrasjb on how to address this. Additionally, the new configure.php should be coded like many of the other root admin files with similar overlap, such that it simply includes another file where all of the shared code lives, to avoid having 3 different versions of the same file, strings, etc…

Last edited 3 months ago by johnjamesjacoby (previous) (diff)

#12 @johnjamesjacoby
3 months ago

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

In 58118:

Multisite: Add missing "contribute.php" file to User Dashboard.

This changeset adds a wp-admin/user/contribute.php file to allow the "Get Involved" link to work on User Admin.

This changeset prevents an unintended 404 that occurs when a logged-in user clicks the "Get Involved" link (located in the menu-bar) from inside of the multisite-specific User Dashboard.

Related: r56220, r56309, #23348.

Props ignatiusjeroe, audrasjb, tobiasbg.

Fixes #61122.

Last edited 3 months ago by johnjamesjacoby (previous) (diff)

#13 @shailu25
3 months ago

@johnjamesjacoby i think you forgot to add my user name in Prop List.

Last edited 3 months ago by shailu25 (previous) (diff)

#14 @johnjamesjacoby
3 months ago

@shailu25 my apologies! 🤦‍♂️ I can’t update that commit message, but I will edit the comment here & make sure your props are accounted for elsewhere. 🙏

@SergeyBiryukov commented on PR #6499:


3 months ago
#15

Thanks for the PR! This was merged in r58118.

Note: See TracTickets for help on using tickets.