WordPress.org

Make WordPress Core

Opened 19 months ago

Closed 19 months ago

Last modified 19 months 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 19 months ago.
Add favorites to plugin installer
favorites-updated.diff (2.5 KB) - added by griffinjt 19 months ago.
favorites-updated.2.diff (4.4 KB) - added by griffinjt 19 months ago.
apologies - malformed diff file for first upload
22002.diff (2.7 KB) - added by Japh 19 months ago.
Some fixed typos, and implemented usermeta feature
22002.2.diff (2.7 KB) - added by Japh 19 months 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 19 months ago.
Update wording of user field, eliminate extra space and ugly header
22002.4.diff (2.6 KB) - added by Otto42 19 months 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 19 months ago.
Adds help text for the Favorites link, fixes a couple of help-text typos
22002.6.diff (4.5 KB) - added by Japh 19 months ago.
Switched input field type to 'search'
22002.7.diff (4.4 KB) - added by Japh 19 months ago.
Removed enctype attribute from the form, as per @nacin's recommendation
22002.8.diff (4.8 KB) - added by nacin 19 months ago.
22002.8.1.diff (5.0 KB) - added by DrewAPicture 19 months ago.
Some spaces.

Download all attachments as: .zip

Change History (48)

Otto4219 months ago

Add favorites to plugin installer

comment:1 helenyhou19 months ago

Cool! Surprise: it works. :)

comment:2 Japh19 months ago

  • Cc japh@… added

comment:3 ocean9019 months ago

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

comment:4 Otto4219 months 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 mordauk19 months ago

  • Cc pippin@… added

comment:6 mordauk19 months ago

Very cool.

comment:7 griffinjt19 months ago

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

comment:8 scribu19 months ago

  • Milestone changed from Awaiting Review to 3.5

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

comment:9 sabreuse19 months ago

+eleventy

comment:10 follow-up: Japh19 months 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?

griffinjt19 months ago

apologies - malformed diff file for first upload

comment:11 Otto4219 months 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 griffinjt19 months ago

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

comment:13 Japh19 months ago

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

comment:14 Otto4219 months 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 nacin19 months 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 DrewAPicture19 months 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

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

Version 0, edited 19 months ago by DrewAPicture (next)

comment:17 Otto4219 months ago

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

comment:18 DrewAPicture19 months 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 Otto4219 months 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 DrewAPicture19 months 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 Otto4219 months 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.

Japh19 months ago

Some fixed typos, and implemented usermeta feature

comment:22 Japh19 months ago

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

Japh19 months ago

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

Otto4219 months ago

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

Otto4219 months ago

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

DrewAPicture19 months ago

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

comment:23 DrewAPicture19 months ago

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

Japh19 months ago

Switched input field type to 'search'

comment:24 Japh19 months ago

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

Last edited 19 months ago by Japh (previous) (diff)

comment:25 nacin19 months ago

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

Japh19 months ago

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

comment:26 Japh19 months ago

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

nacin19 months ago

comment:27 nacin19 months ago

  • Keywords commit added

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

DrewAPicture19 months ago

Some spaces.

comment:28 DrewAPicture19 months 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 nacin19 months ago

  • Keywords 2nd-opinion removed

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

comment:30 westi19 months ago

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

comment:31 georgestephanis19 months 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 Otto4219 months ago

User name search is now case-insensitive.

comment:33 pento19 months ago

  • Cc gary@… added

comment:34 nacin19 months 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 husobj19 months ago

  • Cc ben@… added

comment:36 maor19 months ago

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