WordPoints / wordpoints

Points plugin for WordPress
GNU General Public License v2.0
20 stars 15 forks source link

Change name of wordpoints_*_network_option() functions #305

Closed JDGrimes closed 8 years ago

JDGrimes commented 9 years ago

The wordpoints_*_network_option() functions handle what I inadvisedly decided to term "network" options. These options are used on both vanilla and multisite installs. On single-site installs, they behave normally. On multisite their behavior changes based on how WordPoints is activated: if it is network-active, these options are network-wide (historically called "site") options. If the plugin is only activated per-site, these are regular options (which hold a different value for each site on the network where WordPoints is active).

Calling these "network" options isn't entirely absurd, since they are network options under certain circumstances. However, it is likely to cause confusion, especially when the *_site_option() functions provided by WordPress core are renamed to *_network_option().

I propose that we change the name, maybe to *_dynamic_option(). Something like variable could also work instead. I'd thought of multisite, but that isn't very good either. Perhaps it would be best to be as self-documenting as possible, and go with maybe_network.

JDGrimes commented 9 years ago

Related: WP#28290.

JDGrimes commented 9 years ago

And let's not forget that we also need to update wordpoints_get_array_option() to deprecate the 'network' type in favor of 'maybe_network'. We should do that ASAP, because this is one part we may want to actually re-purpose in the future, where 'network' would actually always mean 'network', instead of using the old 'site' terminology.

JDGrimes commented 8 years ago

I think we could make this even better by adding a $network parameter to these functions. This would default to the value of is_wordpoints_network_active(), but any value could be passed in, allowing the functions to be used in a variety of situations where we want to switch between network and regular options under various circumstances. I've had several different occasions where I've thought that this would be useful already.

JDGrimes commented 8 years ago

We've added functions following the pattern in the previous comment while working on the Hooks API. They've now been merged into core (see #321). However, I think we still need to consider what else needs to happen here, like deprecating the old functions.

JDGrimes commented 8 years ago

Let's deprecate.