Comments (7)
Hey @peterhartree,
I've made a start on this on via a feature branch feat/query-string which at the moment enables a flag (even if it's disabled by the current user) if the following conditions are met:
- A query value is passed
?flag=foo
- The feature is set as queryable (enable via registration function arg)
- User is logged in (redirects to log in and back if not logged in)
E.g: Visiting https://example.com/page/?flag=foo
would enable the foo
feature flag.
I'm probably going to make the login requirement configurable also as I can see that being useful for certain demos where you don't want the hassle of user accounts. I've now added this. See the private
arugment added in feat/query-string.
I'm interested to hear more about replicating the current flag statues. Are you thinking it would be useful to have a query string that can enable multiple flags at once?
from flagpole.
Nice!!
Are you thinking it would be useful to have a query string that can enable multiple flags at once?
Yes. I think it should be possible to disable flags via querystring as well.
I'm imagining a query string that looks something like
I can imagine a case where we have e.g. 10 flags registered and I don't know which flags the user currently has enabled. To avoid confusion, I may want to send a link that sets all the users flags to the exactly intended state.
So it'd be useful if, from the WP admin flag settings page, I could copy-paste a link that sets all flags to the state they're in for the currently logged in user.
from flagpole.
Ah, I see. Chaining a lot of flags could get a little messy, maybe the facility for people to set up groups of flags that are enabled by a custom list parameter? This would give you the option to setup say ?set=april-demo
would enable a set of flags at once.
I'm imagining these groups being shared by all WordPress admin users rather than the current per user activation. So you would create the "April Demo" feature group/set and then add specific flags to the set and those are enabled whenever you use the custom defined query string.
from flagpole.
Yep, flag groups sounds like the ideal solution here.
Chaining ungrouped flags with any easy to copy-paste URL seems like a "good enough" approach, so if it's much easier to implement maybe that's the way to go initially.
from flagpole.
This is pinned to be my next core feature to work on before an initial release. Made a note to also potentially make the query string configurable by the users rather than lumping them with variations of ?flag=
.
from flagpole.
Had a thought while working on an implementation for this. Would it make sense for a user to be able to publish/preview a group of flags?
I've just realised my plan with the groups would only allow them to be queried but this is quite limiting. Wouldn't it make sense to be able to preview a group of features at once?
N.B Going to move this to its own issue rather than polluting the original idea of toggling features with a query string.
from flagpole.
Closing this as the toggle by query string feature has been implemented and I've split the groups' discussion into #21.
from flagpole.
Related Issues (20)
- Fix WordPress VIP warning around *_user_meta() calls HOT 8
- Implement a JavaScript is_enabled() function HOT 3
- Consider renaming `is_enabled()` function HOT 2
- Improve build process for stylesheets. HOT 1
- Consider submitting to packagist? HOT 1
- Add automated tests
- Flag groups HOT 2
- Error handling for flags with duplicate keys
- Create WordPress plugin directory page assets
- Add configuration via config file HOT 2
- Support translations
- Adding contextual help to admin screens
- Tag release HOT 1
- Tag a new release HOT 2
- Document the flag groups and querystring feature HOT 2
- Could you tag the release please? HOT 1
- Add ability to publish a group
- Add ability to use querystring for individual flags
- Automattic hosting compatibility HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flagpole.