Add global config variables for wordpress-multisite #2

Closed
wants to merge 2 commits into
from

Projects

None yet

3 participants

Contributor
tordans commented Oct 15, 2012

Refactoring to allow global variables in wp-config (or your theme's functions.php). This way a wordpress multisites can configure the plugin for all blogs at once. The local/blog-specific configuration overwrites the global configuration. This works for the app_id and fallback_img at the moment since those are the two I needed and are likely to be used for multisites.

I added those lines to my wp-config:

/** Set the multiside-wide config-variables for the http://wordpress.org/support/plugin/wp-facebook-open-graph-protocol plugin */
$wpfbogp_wpfbogp_app_id_global = '123123123';
$wpfbogp_fallback_img_global = 'http://www.betterplace.org/logo.png';
tordans added some commits Oct 15, 2012
@tordans tordans Cleanup whitespaces
Auto-removed all trailing whitespaces
ed0f1a8
@tordans tordans Add global config variables for wordpress-multisite
Refactoring to allow global variables in wp-config (or your themes
functions.php). This way a wordpress multisite can configure all blogs
at once. The local/blog-specific configuration overwrites the global
configuration.
$wpfbogp_wpfbogp_app_id_global = '123';
$wpfbogp_fallback_img_global = 'http…';
e03d6c2
Contributor
tordans commented Oct 15, 2012

Notes:
Doing this via global variables is not the most elegant solution … but since managing multisite-configuration-variables is even more painfull than regular configuration-variables I went for this solution first. Those that use multisite should feel comfortable with handling some minor php…

Also: I tried using constants but did not get rid the annoying php-notices (warning) about constants that are not defined … so I went for regular variables instead. They are also supposed to be much faster.

Contributor

👍 very nice

Contributor
tordans commented Jan 23, 2013

Hi @chuckreynolds @andrewryno are there any plans to include this? Or do you plan to close the pull request?

Contributor

@tordans I think we'll merge it in, just been really busy and have had to hold back on adding some more things to the plugin for now.

Contributor

I'm going to actually rework this so you can use filters instead. So in your theme/plugin you'd use something like:

add_filter( 'wpfbogp_app_id', create_function( $app_id, 'return 123;' ) );

Would that work? (You can also call a function instead of using create_function).

Contributor
tordans commented Mar 18, 2013

@andrewryno So to add the app id for all multisite blogs I just add those filters to my functions.php in my general plugin – or to a separate plugin that is used by all multisite blogs – and be done with configurations? Thats great as well!

Contributor

You'd add it in your themes functions.php.

Contributor

@tordans you should be able to do this with the current version of the plugin. Filters are "wpfbogp_admin_ids" and "wpfbogp_app_id".

@andrewryno andrewryno closed this Apr 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment