Skip to content

feat: adjust capabilities#236

Closed
adekbadek wants to merge 4 commits into
trunkfrom
fix/subs-orders-caps
Closed

feat: adjust capabilities#236
adekbadek wants to merge 4 commits into
trunkfrom
fix/subs-orders-caps

Conversation

@adekbadek

@adekbadek adekbadek commented Apr 14, 2025

Copy link
Copy Markdown
Member

All Submissions:

Changes proposed in this Pull Request:

Adjusts caps, so the unavailable menu options are hidden for non-admins.

Dependent on Automattic/newspack-plugin#3920

How to test the changes in this Pull Request:

  1. On trunk,
  2. Create a new author user and log in as them
  3. Observe the Network → Subscriptions and → Orders admin menus are displayed
image
  1. Switch to this branch, observe these items are not displayed
  2. Log in a the site administrator, confirm you can access these and other Network page via the admin menu

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@adekbadek adekbadek requested a review from a team as a code owner April 14, 2025 10:00
@adekbadek adekbadek force-pushed the fix/subs-orders-caps branch from dbe4287 to d8dfad7 Compare April 14, 2025 10:10

@naxoc naxoc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this locally. It does indeed make the menu item go away, but it is also gone for my admin user. Should the capability be added/registered somewhere for it to work?

Comment thread includes/hub/database/class-orders.php Outdated
'capabilities' => [
'create_posts' => 'not_a_real_capability', // Set to a fake capability to remove "add new" button.
'create_posts' => 'not_a_real_capability', // Set to a fake capability to remove "add new" button.
'edit_posts' => \Newspack_Network\Admin::REQUIRED_CAPABILITY,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: it's the same namespace, so \Network_Network\ is not needed

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fixed in aca3096

@adekbadek

Copy link
Copy Markdown
Member Author

I tested this locally. It does indeed make the menu item go away, but it is also gone for my admin user. Should the capability be added/registered somewhere for it to work?

Ah, that's true. This will depend on Automattic/newspack-plugin#3920, then, when it's merged.

@adekbadek adekbadek marked this pull request as draft April 15, 2025 08:40
@adekbadek

Copy link
Copy Markdown
Member Author

Housekeeping as part of the monorepo cutover (NPPM-2752): this repository is now legacy and active development has moved to the newspack-workspace monorepo. Closing this stale draft (no activity in 6+ months) to keep the legacy backlog clean.

This isn't a rejection of the work. If the change is still relevant, please re-open it as a PR against the monorepo under the matching plugins/ directory — code landed directly in this repo won't ship, since the monorepo is now the canonical source.

@adekbadek adekbadek closed this Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants