WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#22002 closed task (blessed) (fixed)

Favorite plugins in the plugin installer

Reported by: Otto42 Owned by: nacin
Milestone: 3.5 Priority: normal
Severity: normal Version:
Component: Upgrade/Install Keywords: has-patch commit
Focuses: Cc:

Description

Show a new Favorites tab in the plugin installer, to allow users to put in a WordPress.org username and see the Favorites of that user, and install them.

API change has been made. Patch to use API change is attached.

Attachments (12)

favorites.diff (2.4 KB) - added by Otto42 3 years ago.
Add favorites to plugin installer
favorites-updated.diff (2.5 KB) - added by griffinjt 3 years ago.
favorites-updated.2.diff (4.4 KB) - added by griffinjt 3 years ago.
apologies - malformed diff file for first upload
22002.diff (2.7 KB) - added by Japh 3 years ago.
Some fixed typos, and implemented usermeta feature
22002.2.diff (2.7 KB) - added by Japh 3 years ago.
Updated to user get_user_option and update_user_meta as per @nacin's advice
22002.3.diff (2.6 KB) - added by Otto42 3 years ago.
Update wording of user field, eliminate extra space and ugly header
22002.4.diff (2.6 KB) - added by Otto42 3 years ago.
Move form into the correct position to match the search form display, so it doesn't push down the results table needlessly
22002.5.diff (4.4 KB) - added by DrewAPicture 3 years ago.
Adds help text for the Favorites link, fixes a couple of help-text typos
22002.6.diff (4.5 KB) - added by Japh 3 years ago.
Switched input field type to 'search'
22002.7.diff (4.4 KB) - added by Japh 3 years ago.
Removed enctype attribute from the form, as per @nacin's recommendation
22002.8.diff (4.8 KB) - added by nacin 3 years ago.
22002.8.1.diff (5.0 KB) - added by DrewAPicture 3 years ago.
Some spaces.

Download all attachments as: .zip

Change History (48)

@Otto423 years ago

Add favorites to plugin installer

comment:1 @helenyhou3 years ago

Cool! Surprise: it works. :)

comment:2 @Japh3 years ago

  • Cc japh@… added

comment:3 @ocean903 years ago

Seems like it returns all plugins if a user exists but has no favorites.

comment:4 @Otto423 years ago

Fixed. That's on the API side. BB_Query has this disconcerting habit of returning all possible results when there are no matches for the given data.

comment:5 @mordauk3 years ago

  • Cc pippin@… added

comment:6 @mordauk3 years ago

Very cool.

comment:7 @griffinjt3 years ago

Updated the patch with typo fixes and a little more relevant documenting for the $page param.

comment:8 @scribu3 years ago

  • Milestone changed from Awaiting Review to 3.5

+1. Without this, favorite plugins are little more than bookmarks.

comment:9 @sabreuse3 years ago

+eleventy

comment:10 follow-up: @Japh3 years ago

I have included a suggested change in my Favorite Plugins plugin which utilises this new API, that is remembering the user. Though perhaps for core, we could do this with a transient?

@griffinjt3 years ago

apologies - malformed diff file for first upload

comment:11 @Otto423 years ago

Japh: If I was going to do that, I'd probably want it to use a cookie or something instead, to keep it browser/user specific instead of storing it on the server-side. Could be weird if you have multiple admins browsing that page.

comment:12 @griffinjt3 years ago

Ok, ignore my patches until I get my trunk install corrected. x.x

comment:13 @Japh3 years ago

Otto42: Yes, I was thinking either cookie or session.

comment:14 @Otto423 years ago

No sessions. Bad mojo with sessions. You'd be downright shocked at the number of hosting setups out there which will break painfully when you even try to use sessions.

comment:15 in reply to: ↑ 10 @nacin3 years ago

  • Component changed from Plugins to Upgrade/Install
  • Type changed from enhancement to task (blessed)

Replying to Japh:

I have included a suggested change in my Favorite Plugins plugin which utilises this new API, that is remembering the user. Though perhaps for core, we could do this with a transient?

This is a worthy addition to this — but simply as a user option (global usermeta) rather than a site option.

comment:16 @DrewAPicture3 years ago

Getting a fatal error Cannot redeclare install_plugins_favorites() clicking 'Add New' from a site's Plugins menu on Multisite:

Fatal error: Cannot redeclare install_plugins_favories() (previously declared in /Users/Drew/Sites/mutrunk/wp-admin/includes/plugin-install.php:183) in /Users/Drew/Sites/mutrunk/wp-admin/includes/plugin-install.php on line 212

EDIT: Applies to favorites-updates.2.diff

Oh, and by the way ... ooooh ahhhh, impressive.

Last edited 3 years ago by DrewAPicture (previous) (diff)

comment:17 @Otto423 years ago

DrewAPicture: Use my patch, not the two broken ones after that. See if that is the problem.

comment:18 @DrewAPicture3 years ago

  • Cc xoodrew@… added

Make that fatal error on 'Add New' from any plugins screen in Multisite including Network Admin with favorites-updated.2.diff

Replying to Otto42:

DrewAPicture: Use my patch, not the two broken ones after that. See if that is the problem.

favorites.diff works for me on Multisite. Spiffy.

comment:19 @Otto423 years ago

Yes, both the "updated" patches from griffinjt are broken, as he pointed out earlier. The original patch is currently the correct one, for now.

comment:20 @DrewAPicture3 years ago

Paired with this, it sure would be nice to be able to install multiple plugins at once though. There's a ticket for that somewhere around here (unless I'm missing something).

comment:21 @Otto423 years ago

Interesting idea, but separate. Anyway, this new screen uses the same listing methodology as all the other pages do (same function calls) so a patch to do multiple installs should affect this in an identical fashion.

@Japh3 years ago

Some fixed typos, and implemented usermeta feature

comment:22 @Japh3 years ago

I implemented at least a preliminary version of username remembrance with usermeta in 22002.diff. Also fixed favories -> favorites typo.

@Japh3 years ago

Updated to user get_user_option and update_user_meta as per @nacin's advice

@Otto423 years ago

Update wording of user field, eliminate extra space and ugly header

@Otto423 years ago

Move form into the correct position to match the search form display, so it doesn't push down the results table needlessly

@DrewAPicture3 years ago

Adds help text for the Favorites link, fixes a couple of help-text typos

comment:23 @DrewAPicture3 years ago

22002.5.diff Adds help text and fixes a couple of typos.

@Japh3 years ago

Switched input field type to 'search'

comment:24 @Japh3 years ago

For the sake of consistency and friendliness to touch devices, 22002.6.diff changes the favourites input field type to 'search'.

Last edited 3 years ago by Japh (previous) (diff)

comment:25 @nacin3 years ago

enctype="multipart/form-data" appears to be copied-pasted from the upload form. This form isn't uploading data, so it can go.

@Japh3 years ago

Removed enctype attribute from the form, as per @nacin's recommendation

comment:26 @Japh3 years ago

Patch 22002.7.diff removes the extra attribute @nacin pointed out.

@nacin3 years ago

comment:27 @nacin3 years ago

  • Keywords commit added

22002.8.diff hides the list table before the initial search and moves to method="get" action="".

@DrewAPicture3 years ago

Some spaces.

comment:28 @DrewAPicture3 years ago

  • Keywords 2nd-opinion added

After a bit of back and forth with @japh seems like searches are only case-insensitive if the username is all lowercase to start with.

For instance, 'markjaquith' works, but 'MarkJaquith' doesn't. 'matt' works but 'Matt' doesn't.

But DrewAPicture and drewapicture both work (username:DrewAPicture).

Consensus seems to be this should be looked at on the API side.

comment:29 @nacin3 years ago

  • Keywords 2nd-opinion removed

Yes, this is just an API thing. Otto42 and I should be able to straighten it out.

comment:30 @westi3 years ago

This is a great enhancement and great use of the WP.org favs

comment:31 @georgestephanis3 years ago

For

$user = isset( $_REQUEST['user'] ) ? stripslashes( $_REQUEST['user'] ) : get_user_option( 'wporg_favorites' );

should we be explicitly checking $_GET instead of $_REQUEST? The form's a get form anyways.

comment:32 @Otto423 years ago

User name search is now case-insensitive.

comment:33 @pento3 years ago

  • Cc gary@… added

comment:34 @nacin3 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [22026]:

Browse and install your wordpress.org plugin favorites from the plugin installer. props Otto42, Japh, DrewAPicture. fixes #22002.

comment:35 @husobj3 years ago

  • Cc ben@… added

comment:36 @maor3 years ago

  • Cc maorhaz@… added
Note: See TracTickets for help on using tickets.