Plugin Directory

Changeset 1855335


Ignore:
Timestamp:
04/09/2018 05:44:41 PM (8 years ago)
Author:
MagicStick
Message:

ACF integration improvements

Location:
multisite-post-duplicator
Files:
44 added
5 edited

Legend:

Unmodified
Added
Removed
  • multisite-post-duplicator/trunk/README.md

    r1763939 r1855335  
    3535    * Batch Duplication
    3636    * Metabox control within Post/page edit screen
    37     * Activity Log. View information on all dulications performed within your network
     37    * Activity Log. View information on all duplications performed within your network
    3838
    3939*   Settings
     
    7676= What about Multisites on Subdomain Configurations? =
    7777
    78 Unfortunately we don't support sub domain configuations at this time. You may use it to some extent, but a lot of this plugins features may produce unexpected results. Our plan is to introduce support for this in the near futute.
     78Unfortunately we don't support sub domain configurations at this time. You may use it to some extent, but a lot of this plugins features may produce unexpected results. Our plan is to introduce support for this in the near future.
    7979
    8080== Screenshots ==
     
    8787== Changelog ==
    8888
     89= 1.7.6 =
     90* ACF fields registered via php are now copied (thanks WillyMichel)
     91* Clone fields containing media now correctly copied (thanks WillyMichel)
     92* Fixed issue with multiple ACF gallery fields on a single post (thanks WillyMichel)
     93* Added settings option to make master site terms and term_taxonomy tables global for persistent category id. This way posts that are fed to site and sub-site pages by category ID will always generate based on master site posts. (thanks SpeechlessWick)
     94
    8995= 1.7.5 =
    90 * Permlink stucture now behaves as expected when copying post to the same site
     96* Permalink structure now behaves as expected when copying post to the same site
    9197* Publish date now persists on linked posts if requested (thanks again Iskren Ivov Chernev)
    9298
     
    103109= 1.7.1 =
    104110* NEW: Now supports Media Post type. Copy single or batched files to different sites on your network!
    105 * Improved and more compatable method of copying images to the destination sites. (no more put_file_contents()!!)
     111* Improved and more compatible method of copying images to the destination sites. (no more put_file_contents()!!)
    106112* Bug Fixes
    107113
     
    134140* Fixed: Issue with default 'post status' setting giving php notice in debug mode
    135141* Fixed: Issue with multiple duplicate messages showing the same details.
    136 * Fixed: Setting producing undesired behaviour for tags and taxonomies in some senarios.
     142* Fixed: Setting producing undesired behaviour for tags and taxonomies in some scenarios.
    137143* Improved filters used to build the metabox markup
    138144
     
    144150
    145151= 1.5.3 =
    146 * Fixed php warnings experienced in some senarios.
     152* Fixed php warnings experienced in some scenarios.
    147153
    148154= 1.5.2 =
    149 * Fixed php warnings experienced in some senarios.
     155* Fixed php warnings experienced in some scenarios.
    150156
    151157= 1.5.1 =
     
    162168* NEW: Signposting for instances where user's 'Advanced Custom Fields Field Groups' don't exist in the destination site.
    163169* Improved performance of taxonomy duplication on linked posts.
    164 * Fixed issue where taxonomy terms would not copy in some senarios.
     170* Fixed issue where taxonomy terms would not copy in some scenarios.
    165171* Removed some PHP warnings if running in debug mode.
    166172
     
    192198* Fixed issue where networks with more than 100 sites would have some sites not listed in thier controls (for installs > 4.6)
    193199* Fixed issue where other plugin's meta data (that are using the 'save_post' action) might be missed during the duplication
    194 * General performanace improvements
     200* General performance improvements
    195201
    196202= 1.1 =
     
    226232
    227233= 0.9.5 =
    228 * Subdomain warning message can now be dissmissed. Also has improved signposting.
     234* Subdomain warning message can now be dismissed. Also has improved signposting.
    229235
    230236= 0.9.4 =
  • multisite-post-duplicator/trunk/addons/restrictSites-mpd-addon.php

    r1604003 r1855335  
    1818    mpd_settings_field('restrict_option_setting', '<i class="fa fa-user-times" aria-hidden="true"></i> ' . __( 'Restrict MPD to certain sites', 'multisite-post-duplicator' ), 'restrict_option_setting_render');
    1919    mpd_settings_field('restrict_some_option_setting', '<i class="fa fa-user-plus" aria-hidden="true"></i> ' . __( 'Restrict MPD on some sites', 'multisite-post-duplicator' ), 'restrict_some_option_setting_render');
    20   mpd_settings_field('master_site_setting', '<i class="fa fa-bank" aria-hidden="true"></i> ' . __( 'Select a Master Site', 'multisite-post-duplicator' ), 'master_site_settings_render');
    21  
     20    mpd_settings_field('master_site_setting', '<i class="fa fa-bank" aria-hidden="true"></i> ' . __( 'Select a Master Site', 'multisite-post-duplicator' ), 'master_site_settings_render');
     21    mpd_settings_field('mdp_global_categories_taxonomies',
     22        '<i class="fa fa-globe" aria-hidden="true"></i> ' . __( 'Make post categories and taxonomies global?', 'multisite-post-duplicator' ),
     23        'mdp_global_categories_taxonomies_render'
     24    );
     25   
    2226}
    2327
     
    156160
    157161/**
     162 *
     163 * Create the UI for the Global Category and Taxonomy Setting
     164 *
     165 * @since 1.7
     166 * @return null
     167 *
     168 */
     169function mdp_global_categories_taxonomies_render(  ) {
     170
     171    $options = get_option( 'mdp_settings' ); ?>
     172   
     173    <div class="checkbox checkbox-slider--b-flat global-terms">
     174       
     175        <label>
     176            <input type='checkbox' name='mdp_settings[mdp_global_categories_taxonomies]' <?php mpd_checked_lookup($options, 'mdp_global_categories_taxonomies', 'global') ;?> value='global'>
     177            <span>
     178                <?php mpd_information_icon('This plugin will make all sub-sites reference the master sites TERMS and TERM TAXONOMY tables. This allows for category IDs to be consistent across all sub-sites when posts are duplicated from the master site. When a post is duplicated from the master site with this setting checked, it can be referenced universally by the same category ID. This comes in handy if you are feeding posts to areas of your site/ sub-sites by category ID. You can turn off this activity by un-checking the box.'); ?>
     179            </span>
     180        </label>
     181    </div>
     182    <?php
     183
     184}
     185
     186/**
    158187 * @ignore
    159188 */
     
    168197
    169198            var masterSiteLvl   = jQuery(".mpd-master-site").parent().parent();
     199            var gTerms          = jQuery(".global-terms").parent().parent();
    170200            var restrictSomeLvl = jQuery(".restrict-some-checkbox").parent().parent();
    171201            var rcb             = jQuery('.restrict-some-checkbox:not(:checked)');
     
    173203            masterSiteLvl.hide();
    174204            restrictSomeLvl.hide();
     205            gTerms.hide();
    175206
    176207            if(rcb.length == 1){
     
    186217            if(jQuery('#mpd_restrict_set_master').is(':checked') ){
    187218                masterSiteLvl.show();
     219                gTerms.show();
    188220            }
    189221            if(jQuery('#mpd_restrict_some').is(':checked') ){
     
    195227                if (jQuery(this).val() == 'master') {
    196228                    masterSiteLvl.show('fast');
     229                    gTerms.show('fast');
    197230                }else{
    198231                    masterSiteLvl.hide('fast');
     232                    gTerms.hide('fast');
    199233                };
    200234
     
    281315
    282316add_filter( 'mpd_is_active', 'mpd_is_site_active');
     317
     318add_action( 'init', 'change_tax_terms_table', 0 );
     319
     320add_action( 'switch_blog', 'change_tax_terms_table', 0 );
     321
     322function change_tax_terms_table(){
     323
     324    $options        = get_option( 'mdp_settings' );
     325    $master_id      = $options['master_site_setting'];
     326
     327    if((isset($options['mdp_global_categories_taxonomies']) || !$options) && apply_filters('mdp_global_categories_taxonomies', true) ){
     328
     329            global $wpdb;
     330   
     331            $wpdb->terms = $wpdb->get_blog_prefix($master_id) . 'terms';
     332           
     333            $wpdb->term_taxonomy = $wpdb->get_blog_prefix($master_id) . 'term_taxonomy';
     334
     335        }
     336   
     337}
  • multisite-post-duplicator/trunk/inc/acf-functions.php

    r1699157 r1855335  
    3434                if(isset($meta_values["_" . $key])){
    3535
    36                     global $wpdb;
    37 
    38                     $acf_field_key  = $meta_values["_" . $key][0];
    39                     $tablename      = mpd_get_tablename($wpdb->blogid);
    40                     $query          = $wpdb->prepare("
    41                         SELECT post_content
    42                         FROM $tablename
    43                         WHERE post_name = '%s'
    44                         AND post_type = 'acf-field'", $acf_field_key
    45                     );
    46 
    47                     //Get the posssible ACF controller post for this image
    48                     $result         = $wpdb->get_row($query);
     36                     $acf_field_key  = $meta_values["_" . $key][0];
     37
     38                     if(strlen($acf_field_key) > 20) {
     39                        $multi_keys = explode( 'field_', $acf_field_key );
     40                        $acf_field_key = "field_".end($multi_keys);
     41                     }
     42
     43                     //Get the posssible ACF controller post for this image
     44                     $result = get_field_object($acf_field_key);
    4945                   
    5046                    if($result){
     
    5450                        }
    5551
    56                         $acf_control    = unserialize($result->post_content);
     52                        $acf_control    = $result;
    5753                        $acf_type       = $acf_control['type'];
    5854
     
    250246        if($acf_gallerys){
    251247
    252             $attach_ids = array();
    253 
    254248            foreach ($acf_gallerys as $gallery_key => $acf_gallery) {
     249
     250                $attach_ids = array();
    255251
    256252                if(isset($acf_gallery['image_ids']) && $acf_gallery['image_ids'] !=''){
  • multisite-post-duplicator/trunk/mpd.php

    r1763939 r1855335  
    55Plugin URI:     http://www.wpmaz.uk
    66Description:    Duplicate/Copy/Clone any individual page, post or custom post type from one site on your multisite network to another.
    7 Version:        1.7.5
     7Version:        1.7.6
    88Author:         Mario Jaconelli
    99Author URI:     http://www.wpmaz.uk
  • multisite-post-duplicator/trunk/readme.txt

    r1763939 r1855335  
    3535    * Batch Duplication
    3636    * Metabox control within Post/page edit screen
    37     * Activity Log. View information on all dulications performed within your network
     37    * Activity Log. View information on all duplications performed within your network
    3838
    3939*   Settings
     
    7676= What about Multisites on Subdomain Configurations? =
    7777
    78 Unfortunately we don't support sub domain configuations at this time. You may use it to some extent, but a lot of this plugins features may produce unexpected results. Our plan is to introduce support for this in the near futute.
     78Unfortunately we don't support sub domain configurations at this time. You may use it to some extent, but a lot of this plugins features may produce unexpected results. Our plan is to introduce support for this in the near future.
    7979
    8080== Screenshots ==
     
    8787== Changelog ==
    8888
     89= 1.7.6 =
     90* ACF fields registered via php are now copied (thanks WillyMichel)
     91* Clone fields containing media now correctly copied (thanks WillyMichel)
     92* Fixed issue with multiple ACF gallery fields on a single post (thanks WillyMichel)
     93* Added settings option to make master site terms and term_taxonomy tables global for persistent category id. This way posts that are fed to site and sub-site pages by category ID will always generate based on master site posts. (thanks SpeechlessWick)
     94
    8995= 1.7.5 =
    90 * Permlink stucture now behaves as expected when copying post to the same site
     96* Permalink structure now behaves as expected when copying post to the same site
    9197* Publish date now persists on linked posts if requested (thanks again Iskren Ivov Chernev)
    9298
     
    103109= 1.7.1 =
    104110* NEW: Now supports Media Post type. Copy single or batched files to different sites on your network!
    105 * Improved and more compatable method of copying images to the destination sites. (no more put_file_contents()!!)
     111* Improved and more compatible method of copying images to the destination sites. (no more put_file_contents()!!)
    106112* Bug Fixes
    107113
     
    134140* Fixed: Issue with default 'post status' setting giving php notice in debug mode
    135141* Fixed: Issue with multiple duplicate messages showing the same details.
    136 * Fixed: Setting producing undesired behaviour for tags and taxonomies in some senarios.
     142* Fixed: Setting producing undesired behaviour for tags and taxonomies in some scenarios.
    137143* Improved filters used to build the metabox markup
    138144
     
    144150
    145151= 1.5.3 =
    146 * Fixed php warnings experienced in some senarios.
     152* Fixed php warnings experienced in some scenarios.
    147153
    148154= 1.5.2 =
    149 * Fixed php warnings experienced in some senarios.
     155* Fixed php warnings experienced in some scenarios.
    150156
    151157= 1.5.1 =
     
    157163* Improved performance
    158164* Improved access for developers with the addition of several new hooks.
    159 * Removed signposting added in previous release. Rethinking a better approach
    160165
    161166= 1.4 =
     
    163168* NEW: Signposting for instances where user's 'Advanced Custom Fields Field Groups' don't exist in the destination site.
    164169* Improved performance of taxonomy duplication on linked posts.
    165 * Fixed issue where taxonomy terms would not copy in some senarios.
     170* Fixed issue where taxonomy terms would not copy in some scenarios.
    166171* Removed some PHP warnings if running in debug mode.
    167172
     
    177182
    178183= 1.2 =
    179 * NEW: When using the batch duplication tool if a parent and child are in the duplicate batch then the relationship will be maintained in the desitination site
     184* NEW: When using the batch duplication tool if a parent and child are in the duplicate batch then the relationship will be maintained in the desitination site.
    180185* UI Improvements
    181186* Corrected some typos
     
    193198* Fixed issue where networks with more than 100 sites would have some sites not listed in thier controls (for installs > 4.6)
    194199* Fixed issue where other plugin's meta data (that are using the 'save_post' action) might be missed during the duplication
    195 * General performanace improvements
     200* General performance improvements
    196201
    197202= 1.1 =
     
    227232
    228233= 0.9.5 =
    229 * Subdomain warning message can now be dissmissed. Also has improved signposting.
     234* Subdomain warning message can now be dismissed. Also has improved signposting.
    230235
    231236= 0.9.4 =
     
    239244* NEW: Support for WordPress' new WP_Site_Query (get_sites()) class.
    240245* Fixed issue with featured images not copying over for some users (thanks joedev91).
    241 * Fixed issue with unwanted duplicated post meta upon duplication process (thanks joedev91).
     246* Fixed issue with unwanted post meta upon duplication process (thanks joedev91).
    242247
    243248= 0.9.2 =
Note: See TracChangeset for help on using the changeset viewer.