deliciousbrains / better-search-replace

A simple plugin for updating URLs or other text in a database.
https://bettersearchreplace.com
GNU General Public License v3.0
86 stars 36 forks source link

Added check for environments that have plugins disabled via wp-config… #75

Closed MeMattStone closed 2 years ago

MeMattStone commented 3 years ago

… to still allow admins to use Better Search Replace from the tools menu.

Created function within BSR_Admin to allow for getting an appropriate capability to work in different types of environments, and also used same code in function that initially runs the plugin.

Fixes #74

mike-sheppard commented 3 years ago

Having this exact issue + can confirm this PR fixes it, nice one @MeMattStone 👍🏻

aschoenher commented 2 years ago

Hello, I hate to be annoying, but is there any reason not to merge this PR ? It fixes a bug that many people (including myself) encountered and the code changes are really small.

josephbisaillon commented 2 years ago

yes, this should be approved. Premium hosting services like Pantheon that have separate environments for dev-test-production will run into this during the lifecycle of development. I don't understand why this isn't merged.

In addition, the pro version requires the change in one additional function, as a heads up to the development team on that.

keyvanestermann commented 2 years ago

I just ran into this issue using Bedrock, which uses composer to manage plugins/dependencies. Bedrock isn't at fault though, it makes sense to disable plugin installation on production sites, since most end users have no idea what they're doing.

I approve of this PR, please merge it !

mattgrshaw commented 2 years ago

@MeMattStone thanks for the PR and sorry for the long delay on this one.

This change seems pretty sensible and could save a bunch of headaches, so I've raised an issue on our internal repo to look into getting something like this merged in an upcoming release.

In the meantime, if anyone else runs into a similar issue, you could use the bsr_capability filter to change the filter required to run BSR like so: https://gist.github.com/mattgrshaw/90766cce44badadaae34

sebahm commented 2 years ago

Worked out great for me, thank you.

As KeyvanE i am using an Bedrock application and couldn't at first see the search and replace in the toolbar.

Modified the plugin code according to the merge request and now its smooth sailing again.

MeMattStone commented 2 years ago

Closing this pull request as some of the changes have been incorporated into v1.4