[Plugin: WP Photo Album Plus] multisite support switch local to global [set option request]
-
Hello and congratulations for your excellent plugin
Your frequent upgrade with wp-photo-album-plus forces me to make each times a small patch on the script wppa.php.
It is important for me to have plugins updated.So, thank you for your work and activity on the plugin.
In fact, I use the main table as global table for the entire blog network.
For this, I change the value ($ wpdb-> prefix) to ($ wpdb-> base_prefix) and redefines the download variables for blogs as global too.
This creates, I think a good plugin option for your multisite support.
To see the patch in action:
All Albums network are displayed on the main site:
http://www.cieuxinternational.org/fr/media/albums/The album can be seen locally on the corresponding blog:
http://www.cieuxinternational.org/paris-10/fr/album/For the principle I have to create an album for each blog and call this category via %%album=album_id_for_the_blog%% in the WP blog page dedicated to the local album.
Of course, on each blog admin albums all the the network is also available (which is a bit confusing).
In fact it could be very simple to define on each parent album if is:
– Global (sitewide), in this case we use $ wpdb-> base_prefix.
– Local (strictly), in this case we use $ wpdb-> prefix.In my case all albums are global so I just need to have authority over the table to use.
// REQUEST
Would it be possible to integrate a filter on the table name in wppa.php as an early option to support multi-site global or local.
Something like that :
/**************** wppa.php, line 34 *************/
/* some add_option to create somewhere on init */
add_option(‘wppa_switch_to’,’local’); // default to ‘local’ for keep compatibilty with prev versions..
// each blog administrator decides
//or better
add_site_option(‘wppa_switch_to’,’local’); //
// main site adminstrator decides/* some update_option to set somewhere on admin, according to add */
update_option(‘wppa_switch_to’,’global’);
update_site_option(‘wppa_switch_to’,’local’);/**
It is clear that when the choice between global and local is done, the backward becomes destructive.
Two solutions: disable update_options or update_site_option when albums are filled (to test) or preventive message, in case of change, that all is lost and do it again.**/
/**
Later see how this can be set for each parent album whose belong or not with a particular blog… this can be a bit difficult. Full global, or full local is a simple way… why not?
**/
/************************************************/
add_filter(‘wppa_switch_table’, ‘wppa_switch_to’);
function wppa_switch_to($switch) {
global $wpdb;
if($switch==’global’) {
return $wpdb->base_prefix;
} else {
return $wpdb->prefix;
}
}
$wppa_switch=get_site_option(‘wppa_switch_to’); // or get_option
$wppa_table_prefix = apply_filters(‘wppa_switch_table’,$wppa_switch);
/**
Use $wppa_switch [global|local] in ‘wppa-common-functions.php’ on line 481 for global modeif ( is_multisite() && $wppa_switch== ‘local) {
…**/
define( ‘WPPA_ALBUMS’, $wppa_table_prefix . ‘wppa_albums’ );
define( ‘WPPA_PHOTOS’, $wppa_table_prefix . ‘wppa_photos’ );
define( ‘WPPA_RATING’, $wppa_table_prefix . ‘wppa_rating’ );
define( ‘WPPA_COMMENTS’, $wppa_table_prefix . ‘wppa_comments’ );
define( ‘WPPA_IPTC’, $wppa_table_prefix . ‘wppa_iptc’ );
define( ‘WPPA_EXIF’, $wppa_table_prefix . ‘wppa_exif’ );/**** start again with define(‘WPPA_FILE’ … ****/
///////////////
Subsidiary note: The stars of evaluation are not clickable (tested on chrome & safari Mac Os). Even though I’m well connected … buddypress account. I haven’t taken times to see why.
- The topic ‘[Plugin: WP Photo Album Plus] multisite support switch local to global [set option request]’ is closed to new replies.