Stats: send install_plugins in the widget's current-user capabilities

Open Beginner friendly
#54,188 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
86/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
php, wordpress
Domain
backend

Research direction

Read projects/packages/stats-admin/src/class-odyssey-config-data.php, especially Odyssey_Config_Data::get_current_user_capabilities(). Add install_plugins to the capabilities array alongside activate_plugins; done when the returned capabilities include both so the widget can gate installation and activation separately. The payload names no test, so first inspect nearby tests for this method.

Written by the indexing model from the issue text.

Description

[Package] Stats Admin [Type] Bug

Odyssey_Config_Data::get_current_user_capabilities() (projects/packages/stats-admin/src/class-odyssey-config-data.php) sends activate_plugins but not install_plugins.

The dashboard Stats widget gates its Akismet "Install" button on activate_plugins (Automattic/wp-calypso#115529), which is the wrong capability for installing: when DISALLOW_FILE_MODS is set or file_mod_allowed returns false, core maps install_plugins to do_not_allow and leaves activate_plugins untouched, so an administrator on such a site still sees "Install" and the request fails.

Add install_plugins to the capabilities array so the widget can gate "Install" on it and keep "Activate" on activate_plugins.

Dominant language
PHP
Stars
1.9k
Forks
906
Avg merge
1d 18h
Merged PRs (30d)
793

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Automattic/jetpack

All issues in Automattic/jetpack

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.