├── log ├── errors_m.log └── errors_s.log ├── images ├── icon.png ├── info_small.png └── black_arrow_big.png ├── languages ├── user-sync.mo ├── user-sync.pot └── user-sync.po ├── css ├── custom_dashicons.eot ├── custom_dashicons.ttf ├── custom_dashicons.woff ├── mp6.css ├── custom_dashicons.svg └── admin.css ├── .gitmodules ├── policy-text.php ├── js ├── admin.js └── jquery.tools.min.js ├── changelog.txt ├── page-main.php ├── README.md ├── page-sub.php ├── page-central.php └── user-sync.php /log/errors_m.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /log/errors_s.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpmudev/user-sync/HEAD/images/icon.png -------------------------------------------------------------------------------- /images/info_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpmudev/user-sync/HEAD/images/info_small.png -------------------------------------------------------------------------------- /languages/user-sync.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpmudev/user-sync/HEAD/languages/user-sync.mo -------------------------------------------------------------------------------- /css/custom_dashicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpmudev/user-sync/HEAD/css/custom_dashicons.eot -------------------------------------------------------------------------------- /css/custom_dashicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpmudev/user-sync/HEAD/css/custom_dashicons.ttf -------------------------------------------------------------------------------- /css/custom_dashicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpmudev/user-sync/HEAD/css/custom_dashicons.woff -------------------------------------------------------------------------------- /images/black_arrow_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpmudev/user-sync/HEAD/images/black_arrow_big.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "dash-notice"] 2 | path = dash-notice 3 | url = git@bitbucket.org:incsub/wpmudev-dashboard-notification.git 4 | branch = master 5 | -------------------------------------------------------------------------------- /css/mp6.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'custom_dashicons_user_sync'; 3 | src:url('custom_dashicons.eot'); 4 | src:url('custom_dashicons.eot?#iefix') format('embedded-opentype'), 5 | url('custom_dashicons.ttf') format('truetype'), 6 | url('custom_dashicons.woff') format('woff'), 7 | url('custom_dashicons.svg#icomoon') format('svg'); 8 | font-weight: normal; 9 | font-style: normal; 10 | } 11 | #adminmenu #toplevel_page_user-sync div.wp-menu-image:before { 12 | font-family: 'custom_dashicons_user_sync' !important; 13 | content: "\e600"; 14 | } 15 | #adminmenu #toplevel_page_user-sync div.wp-menu-image img, #add_wdf img { 16 | display: none; 17 | } -------------------------------------------------------------------------------- /policy-text.php: -------------------------------------------------------------------------------- 1 |
2 |

3 |

4 | 5 |

6 |

7 | 8 | 9 |

10 |
-------------------------------------------------------------------------------- /css/custom_dashicons.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Generated by IcoMoon 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /css/admin.css: -------------------------------------------------------------------------------- 1 | .settings_block { 2 | position: relative; 3 | } 4 | 5 | .loading_image { 6 | -ms-filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=80)'; 7 | filter: alpha(opacity=80); 8 | opacity: 0.8; 9 | width: 100%; 10 | height: 100%; 11 | position: absolute; 12 | background: url('/wp-admin/images/loading.gif') #fff no-repeat center center; 13 | z-index: 1099; 14 | display: none; 15 | } 16 | 17 | .debug_message { 18 | background-color: #FFFFE0; 19 | border-style: solid; 20 | border-width: 1px; 21 | border-color: #E6DB55; 22 | margin: 0px 0px 0px 0px; 23 | padding: 5px 10px 5px 10px; 24 | -moz-border-radius: 3px 3px 3px 3px; 25 | } 26 | 27 | .tooltip { 28 | display:none; 29 | background:transparent url("plugin_url ?>images/black_arrow_big.png"); 30 | font-size:12px; 31 | height:166px; 32 | width:320px; 33 | padding:25px; 34 | color:#fff; 35 | z-index: 1000; 36 | } 37 | 38 | /* tooltip styling. by default the element to be styled is .tooltip */ 39 | .tooltip_img { 40 | vertical-align: middle; 41 | } 42 | 43 | #user-sync-spinner { 44 | float: none; 45 | } -------------------------------------------------------------------------------- /js/admin.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | var button = false; 3 | var spinner = false; 4 | 5 | $(document).on('ready', function(){ 6 | $('#user-sync-sync-all').click(function(event){ 7 | event.preventDefault(); 8 | 9 | button = $(this); 10 | button.prop("disabled", true); 11 | 12 | spinner = $('#user-sync-spinner'); 13 | 14 | sync_all(1, 1, $(this)); 15 | }); 16 | 17 | }); 18 | 19 | function sync_all(page, site, button) { 20 | args = { 21 | page: page, 22 | site: site, 23 | action: 'user_sync_sync_all' 24 | }; 25 | 26 | if(spinner) { 27 | spinner.css('visibility', 'visible'); 28 | } 29 | 30 | $.post(ajaxurl, args, function(response) { 31 | if(response.success) { 32 | var finished = 0; 33 | 34 | if(response.data.sites_end) { 35 | finished = 1; 36 | } 37 | else if(response.data.users_end) { 38 | site = site + 1; 39 | } 40 | else { 41 | page = page + 1; 42 | } 43 | 44 | if(!finished) { 45 | sync_all(page, site, button); 46 | } 47 | else { 48 | window.location.href = response.data.redirect_url; 49 | } 50 | } 51 | else { 52 | if(button) { 53 | button.prop("disabled", false); 54 | } 55 | if(spinner) { 56 | spinner.css('visibility', 'hidden'); 57 | } 58 | } 59 | }); 60 | } 61 | })(jQuery); -------------------------------------------------------------------------------- /changelog.txt: -------------------------------------------------------------------------------- 1 | Plugin Name: User Sync 2 | Author: WPMUDEV 3 | Lead developer: Maniu 4 | Contributors: Andrey Shipilov, Cole 5 | 6 | = 1.1.6 = 7 | Added privacy policy suggestions 8 | 9 | = 1.1.5.9 = 10 | Changed sync method so it's performed by cron to improve user registration/update time 11 | 12 | = 1.1.5.8 = 13 | Fixed file paths to work with SSL 14 | Improved compatibility with other plugins 15 | 16 | = 1.1.5.8 = 17 | Fixed file paths to work with SSL 18 | Improved compatibility with other plugins 19 | 20 | = 1.1.5.7 = 21 | Fixed issues with password synchronization 22 | 23 | = 1.1.5.6 = 24 | Fixed PHP 7 compatibility bug 25 | 26 | = 1.1.5.5 = 27 | Improved "Sync all sites now" functionality to decrease possibility of timeout 28 | Added check for HTTPS on admin 29 | Disabled SSL verifying 30 | 31 | = 1.1.5 = 32 | Fixed capabilities sync issue 33 | 34 | = 1.1.4 = 35 | Fixed issues related to custom db prefix 36 | 37 | = 1.1.3 = 38 | Added support for MP6 39 | Small UI improvements 40 | 41 | = 1.1.2 = 42 | Enabled loading of CSS and JS file only on User Sync admin page 43 | Increased sync actions priorities for improved compatibility with other plugins 44 | 45 | = 1.1.1 = 46 | Increased timeout for better syncing 47 | Improved admin interface 48 | 49 | = 1.1 = 50 | All additional user meta data is now updated on sync 51 | Fixed minor spelling issues -------------------------------------------------------------------------------- /js/jquery.tools.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Tools v1.2.5 - The missing UI library for the Web 3 | * 4 | * tooltip/tooltip.js 5 | * 6 | * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE. 7 | * 8 | * http://flowplayer.org/tools/ 9 | * 10 | */ 11 | (function(a){a.tools=a.tools||{version:"v1.2.5"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"
",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1],/iPad/i.test(navigator.userAgent)&&(e-=a(window).scrollTop());var h=c.outerHeight()+b.outerHeight();g=="center"&&(e+=h/2),g=="bottom"&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();g=="center"&&(f-=i/2),g=="left"&&(f-=i);return{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw"Nonexistent effect \""+e.effect+"\"";r=r.split(/,\s*/);if(r.length!=2)throw"Tooltip: bad events configuration for "+q;d.bind(r[0],function(a){clearTimeout(i),e.predelay?j=setTimeout(function(){f.show(a)},e.predelay):f.show(a)}).bind(r[1],function(a){clearTimeout(j),e.delay?i=setTimeout(function(){f.hide(a)},e.delay):f.hide(a)}),k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h){l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.next(),h.length||(h=d.parent().next()));if(!h.length)throw"Cannot find tooltip for "+d}if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);e.tip&&h.html(d.data("title")),b=b||a.Event(),b.type="onBeforeShow",g.trigger(b,[o]);if(b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,function(){b.type="onShow",n="full",g.trigger(b)});var p=e.events.tooltip.split(/,\s*/);h.data("__set")||(h.bind(p[0],function(){clearTimeout(i),clearTimeout(j)}),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.bind(p[1],function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])}),h.data("__set",!0));return f},hide:function(c){if(!h||!f.isShown())return f;c=c||a.Event(),c.type="onBeforeHide",g.trigger(c);if(!c.isDefaultPrevented()){n=!1,b[e.effect][1].call(f,function(){c.type="onHide",g.trigger(c)});return f}},isShown:function(a){return a?n=="full":n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(b,c){a.isFunction(e[c])&&a(f).bind(c,e[c]),f[c]=function(b){b&&a(f).bind(c,b);return f}})}a.fn.tooltip=function(b){var c=this.data("tooltip");if(c)return c;b=a.extend(!0,{},a.tools.tooltip.conf,b),typeof b.position=="string"&&(b.position=b.position.split(/,?\s/)),this.each(function(){c=new d(a(this),b),a(this).data("tooltip",c)});return b.api?c:this}})(jQuery); 12 | -------------------------------------------------------------------------------- /page-main.php: -------------------------------------------------------------------------------- 1 | 13 | 14 |
15 |

16 |

17 |

18 |

19 |

20 |

21 |

22 |
23 | 24 |

25 | 26 | safe_mode_notice ) ) { 29 | echo '

'. $this->safe_mode_notice . '

'; 30 | } 31 | ?> 32 | 33 |
34 | 35 | 36 | 37 |

38 | 39 | 40 | 41 |

42 | 43 | 44 | 45 |

46 | 47 |

48 | 49 | 50 |

51 |
52 |
-------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WordPress User Sync 2 | 3 | **INACTIVE NOTICE: This plugin is unsupported by WPMUDEV, we've published it here for those technical types who might want to fork and maintain it for their needs.** 4 | 5 | ## Translations 6 | 7 | Translation files can be found at https://github.com/wpmudev/translations 8 | 9 | ## User Synchronization links user profiles across multiple single WordPress installations. 10 | 11 | Create and manage user accounts on one master list that can be used to connect with any subsite–without Multisite. 12 | 13 | ### Smarter, Safer, User Management 14 | 15 | Automated profile, password, user role and email address share and sync moves user management to one convenient location. Connect more people to more content by allowing users to register once on a master list  and use the same login credentials across any attached site. Protect your users with bulletproof security keys. Leave sites connected for ongoing continuity or transfer users and disconnect. Use uninstall and completely wipe your database clean from any plugin artifacts. 16 | 17 | ![Transfer and wipe your database clean.](http://premium.wpmudev.org/wp-content/uploads/2011/04/uninstall.jpg) 18 | 19 | Transfer and wipe your database clean. 20 | 21 | ### Leverage Control and Simplicity 22 | 23 | It takes a matter of seconds to configure, requiring only a URL and security key. Use synchronize-overwrite for an identical master list match, or support backward user password compatibility on existing sites by allowing duplicates. 24 | 25 | ![Full control over overwrite and duplicates](http://premium.wpmudev.org/wp-content/uploads/2011/04/sync-list.jpg) 26 | 27 | Full control over overwrite and duplicates 28 | 29 | You can also ban a user from a specific sub-site by blocking deleted users from repopulating when synced with the master list. Protect identities, stay synced and save countless hours with User Synchronization. Get linked user management for transferring user accounts from a master list to all of your WordPress sites. 30 | 31 | ## Usage 32 | 33 | Start by reading [Installing Plugins](https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/) section in our comprehensive [WordPress and WordPress Multisite Manual](https://premium.wpmudev.org/wpmu-manual/) if you are new to WordPress. 34 | 35 | ### To install: 36 | 37 | 1. Download the plugin file. 2\. Unzip the file into a folder on your hard drive. 3\. Upload **/user-sync/** folder to **/wp-content/plugins/** folder on the sites you would like to sync between. 4\. Login to your admin panel for your WordPress site and activate the User Synchronisztion plugin in **Plugins**. 38 | 39 | ### To Use: 40 | 41 | Once the plugin is activated you'll see a new "User Sync" menu added. 1.  Go to **User Sync** in the dashboard of the site you want to make the Master site. 42 | 43 | * This is the parent site that is used to sync/duplicate all users to your other sites 44 | 45 | ![User Sync menu](https://premium.wpmudev.org/wp-content/uploads/2011/09/sync_menu01.png) 46 | 47 | 2.  Click on **Make this Site the Master Site** 48 | 49 | ![Make ste the master site](https://premium.wpmudev.org/wp-content/uploads/2011/04/sync64.jpg) 50 | 51 | 3.  You'll now see your Master Site URL and security key displayed. 52 | 53 | ![Your master key details](https://premium.wpmudev.org/wp-content/uploads/2011/04/mastersitekey.jpg) 54 | 55 | 4.  Now log into the dashboard site(s) you want to sync users from the Master site to and go to **User Sync** 5.  Click on **Make this a Sub site** 56 | 57 | ![Make this a sub site](https://premium.wpmudev.org/wp-content/uploads/2011/04/sync65.jpg) 58 | 59 | 6.  Add the URL of the Master Site, Key of Master site, select Default Settings then click **Connect this site to the Master Site, and do a FULL synchronization**. 60 | 61 | * Use overwrite existing users with _**caution**_ -- it does overwrite existing users and will lock out an admin user account if they're using the same username 62 | * Don't overwrite any existing users (add them as extra users) is normally the best option.  If you use this option and a user from the master site has the same username as the subsite the new user is created suffixed with _sync attached to their username.  For example. if you had the username admin already existing on both sites the username would be created as admin_sync on the subsite. 63 | 64 | ![Connecting with Master site](https://premium.wpmudev.org/wp-content/uploads/2011/09/sync_connect.png) 65 | 66 | 7.  All new users on the master site are replicated on the subsite(s)including passwords, their emails and their user roles and they'll now be listed in subsite's User list. 8.  Now whenever a new user is added to the Master site they are automatically created with the same details on the subsite(s). 9.  To remove a subsite so it no longer syncs with the Master site you just need to click **Disconnect from the Master site** in the subsite's **User Sync.** 67 | 68 | ![Disconnect from the Master site](https://premium.wpmudev.org/wp-content/uploads/2011/09/sync_discon.png) 69 | 70 | 10\. To uninstall plugin or reset all settings of plugin just need to click **"Uninstall Options"** in the bottom of the page. 71 | 72 | ### Debug Mode: 73 | 74 | If you have any problems with sync users you can use debug mode for writing some operations in the log file. **How to use:** 1\. Select checkbox "Use Debug Mode" on main plugin page before select "Master" or "Sub-site". 75 | 76 | ![Debug Mode](https://premium.wpmudev.org/wp-content/uploads/2011/09/sync_debug.png) 77 | -------------------------------------------------------------------------------- /page-sub.php: -------------------------------------------------------------------------------- 1 | options['key']; 3 | $user_sync_url_c = $this->options['central_url']; 4 | $disabled = ''; 5 | 6 | if ( "" != $user_sync_url_c ) 7 | $disabled = 'readonly="readonly"'; 8 | 9 | ?> 10 | 50 |
51 | 52 | options['debug_mode'] ) && '1' == $this->options['debug_mode'] ):?> 55 |

56 | 57 | 58 |

59 |

60 |
61 | 62 | 63 | 66 | 69 | 70 | 71 | 74 | 77 | 78 | 79 | 80 | 83 | 98 | 99 | 100 |
64 | 65 | 67 | /> 68 |
72 | 73 | 75 | /> 76 |
81 | 82 | 84 | 85 | 86 | 87 |
88 | 92 |
93 | 97 |
101 | 102 |

103 | 104 | 105 | 106 | safe_mode_notice ) ):?> 109 | 110 | info_small.png" title="safe_mode_notice; ?>"/> 111 |
112 | 113 |

114 | 115 | 116 |

117 | 118 | 119 |

120 | 121 | 122 | 123 |

124 | 125 |
126 | 127 | 128 | 137 |
138 | 139 |

140 |
141 | 142 |

143 | 144 |
145 |
-------------------------------------------------------------------------------- /languages/user-sync.pot: -------------------------------------------------------------------------------- 1 | # LANGUAGE (LOCALE) translation for WordPress. 2 | # Copyright (C) YEAR WordPress contributors. 3 | # This file is distributed under the same license as the WordPress package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: WordPress VERSION\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2011-10-11 00:52+0200\n" 11 | "PO-Revision-Date: 2011-10-11 00:52+0200\n" 12 | "Last-Translator: Andrey Shipilov\n" 13 | "Language-Team: \n" 14 | "MIME-Version: 1.0\n" 15 | "Content-Type: text/plain; charset=UTF-8\n" 16 | "Content-Transfer-Encoding: 8bit\n" 17 | "X-Poedit-KeywordsList: _e;__\n" 18 | "X-Poedit-Basepath: .\n" 19 | "X-Poedit-SearchPath-0: c:\\user-sync\n" 20 | 21 | #: c:\user-sync/page-central.php:98 22 | #: c:\user-sync/page-sub.php:55 23 | msgid "Debug Mode is activated." 24 | msgstr "" 25 | 26 | #: c:\user-sync/page-central.php:101 27 | msgid "Master Site Settings" 28 | msgstr "" 29 | 30 | #: c:\user-sync/page-central.php:102 31 | msgid "All user data from this master site will be synchronized with connected subsites." 32 | msgstr "" 33 | 34 | #: c:\user-sync/page-central.php:106 35 | #: c:\user-sync/page-sub.php:64 36 | msgid "URL of Master site:" 37 | msgstr "" 38 | 39 | #: c:\user-sync/page-central.php:114 40 | msgid "Security Key:" 41 | msgstr "" 42 | 43 | #: c:\user-sync/page-central.php:124 44 | msgid "To create a sub site, simply install this plugin at the sub site, activate it, make that site a 'Sub' site and enter the URL (including http) and the key supplied here." 45 | msgstr "" 46 | 47 | #: c:\user-sync/page-central.php:125 48 | msgid "Use caution if you choose to overwrite existing users as it replaces all existing users and their passwords if the same username exists on the subsite." 49 | msgstr "" 50 | 51 | #: c:\user-sync/page-central.php:126 52 | msgid "Adding new user, or making any changes to user or their details, in the Master site are automatically synced to subsites." 53 | msgstr "" 54 | 55 | #: c:\user-sync/page-central.php:127 56 | msgid "'Sync all sites now' is used if you edit a subsite setting and need to update users." 57 | msgstr "" 58 | 59 | #: c:\user-sync/page-central.php:128 60 | msgid "To stop a subsite from syncing with Master site simply log into the subsite, go to the User Sync menu and click on \"Disconnect from the Master site\" button or \"Uninstall Options\" button." 61 | msgstr "" 62 | 63 | #: c:\user-sync/page-central.php:130 64 | #: c:\user-sync/page-main.php:22 65 | #: c:\user-sync/page-sub.php:140 66 | msgid "For detailed 'how to use' instructions refer to:" 67 | msgstr "" 68 | 69 | #: c:\user-sync/page-central.php:131 70 | #: c:\user-sync/page-main.php:23 71 | #: c:\user-sync/page-sub.php:141 72 | msgid "WordPress User Synchronization Installation and Use instructions." 73 | msgstr "" 74 | 75 | #: c:\user-sync/page-central.php:138 76 | #: c:\user-sync/page-sub.php:109 77 | msgid "Attantion: Safe Mode!" 78 | msgstr "" 79 | 80 | #: c:\user-sync/page-central.php:143 81 | msgid "Registered Subsites:" 82 | msgstr "" 83 | 84 | #: c:\user-sync/page-central.php:152 85 | msgid "URLs" 86 | msgstr "" 87 | 88 | #: c:\user-sync/page-central.php:155 89 | msgid "Last Sync" 90 | msgstr "" 91 | 92 | #: c:\user-sync/page-central.php:158 93 | msgid "Settings" 94 | msgstr "" 95 | 96 | #: c:\user-sync/page-central.php:161 97 | msgid "Action" 98 | msgstr "" 99 | 100 | #: c:\user-sync/page-central.php:193 101 | #: c:\user-sync/page-sub.php:90 102 | msgid "Do not replace deleted users" 103 | msgstr "" 104 | 105 | #: c:\user-sync/page-central.php:198 106 | #: c:\user-sync/page-sub.php:95 107 | msgid "Don't overwrite any existing users (add them as extra users)" 108 | msgstr "" 109 | 110 | #: c:\user-sync/page-central.php:219 111 | msgid "Sync all sites now" 112 | msgstr "" 113 | 114 | #: c:\user-sync/page-central.php:230 115 | #: c:\user-sync/page-sub.php:126 116 | msgid "Uninstall Options" 117 | msgstr "" 118 | 119 | #: c:\user-sync/page-central.php:231 120 | #: c:\user-sync/page-sub.php:127 121 | msgid "Delete all plugin's options from DB." 122 | msgstr "" 123 | 124 | #: c:\user-sync/page-central.php:235 125 | #: c:\user-sync/page-sub.php:131 126 | msgid "Are you sure?" 127 | msgstr "" 128 | 129 | #: c:\user-sync/page-central.php:237 130 | #: c:\user-sync/page-sub.php:133 131 | msgid "No" 132 | msgstr "" 133 | 134 | #: c:\user-sync/page-central.php:238 135 | #: c:\user-sync/page-sub.php:134 136 | msgid "Yes" 137 | msgstr "" 138 | 139 | #: c:\user-sync/page-main.php:15 140 | msgid "Site Type" 141 | msgstr "" 142 | 143 | #: c:\user-sync/page-main.php:16 144 | msgid "User sync works by making one site a 'Master' site and all other sites 'Sub'." 145 | msgstr "" 146 | 147 | #: c:\user-sync/page-main.php:17 148 | msgid "If you want to sync all the users from this site with other sites, make this a Master site." 149 | msgstr "" 150 | 151 | #: c:\user-sync/page-main.php:18 152 | msgid "However, if you want to sync the users from other sites to this site, make this a Sub site." 153 | msgstr "" 154 | 155 | #: c:\user-sync/page-main.php:19 156 | msgid "You can always change these options later by deactivating and then reactivating the plugin." 157 | msgstr "" 158 | 159 | #: c:\user-sync/page-main.php:20 160 | msgid "NB: You must have at least one Master site!" 161 | msgstr "" 162 | 163 | #: c:\user-sync/page-main.php:41 164 | msgid "Note: If you have any problems with sync users you can use debug mode for writing some operations in the log file. You need open folder \"/plugins/user-sync/log/\" for writing. What do with log files you can read in instruction of plugin" 165 | msgstr "" 166 | 167 | #: c:\user-sync/page-main.php:42 168 | msgid "here" 169 | msgstr "" 170 | 171 | #: c:\user-sync/page-main.php:45 172 | msgid "Use Debug Mode" 173 | msgstr "" 174 | 175 | #: c:\user-sync/page-main.php:52 176 | msgid "Make this site the Master site" 177 | msgstr "" 178 | 179 | #: c:\user-sync/page-main.php:53 180 | msgid "Make this a Sub site" 181 | msgstr "" 182 | 183 | #: c:\user-sync/page-sub.php:14 184 | msgid "Please write URL of Central blog" 185 | msgstr "" 186 | 187 | #: c:\user-sync/page-sub.php:19 188 | msgid "Please write Key of Central blog" 189 | msgstr "" 190 | 191 | #: c:\user-sync/page-sub.php:58 192 | msgid "Subsite Settings" 193 | msgstr "" 194 | 195 | #: c:\user-sync/page-sub.php:59 196 | msgid "All user data from the Master site will be synchronized with this site." 197 | msgstr "" 198 | 199 | #: c:\user-sync/page-sub.php:72 200 | msgid "Key of Master site:" 201 | msgstr "" 202 | 203 | #: c:\user-sync/page-sub.php:81 204 | msgid "Default settings:" 205 | msgstr "" 206 | 207 | #: c:\user-sync/page-sub.php:85 208 | msgid "You can change these settings later on the Master site." 209 | msgstr "" 210 | 211 | #: c:\user-sync/page-sub.php:102 212 | msgid "Note: Use caution if you choose to overwrite existing users as it replaces all existing users and their passwords if the same username exists on the subsite." 213 | msgstr "" 214 | 215 | #: c:\user-sync/page-sub.php:115 216 | msgid "Connect this site to the Master site, and do a FULL synchronization" 217 | msgstr "" 218 | 219 | #: c:\user-sync/page-sub.php:121 220 | msgid "Disconnect from the Master site" 221 | msgstr "" 222 | 223 | #: c:\user-sync/page-sub.php:122 224 | msgid "Disconnect syncing with Master site" 225 | msgstr "" 226 | 227 | #: c:\user-sync/user-sync.php:33 228 | msgid "Please install the latest version of our free Update Notifications plugin which helps you stay up-to-date with the most stable, secure versions of WPMU DEV themes and plugins. More information »" 229 | msgstr "" 230 | 231 | #: c:\user-sync/user-sync.php:72 232 | msgid "There was an issue determining where WPMU DEV User Sync is installed. Please reinstall." 233 | msgstr "" 234 | 235 | #: c:\user-sync/user-sync.php:78 236 | msgid "NOTE: Your server works in the 'Safe Mode' - If you have a large number of users for sync and your php settings are of little value for 'max_execution_time' it can cause problems with connection of subsites and full sinchronization." 237 | msgstr "" 238 | 239 | #: c:\user-sync/user-sync.php:118 240 | msgid "User Sync" 241 | msgstr "" 242 | 243 | #: c:\user-sync/user-sync.php:278 244 | msgid "Options are deleted!" 245 | msgstr "" 246 | 247 | #: c:\user-sync/user-sync.php:297 248 | msgid "Subsite successfully connected to Master site and Synchronization completed." 249 | msgstr "" 250 | 251 | #: c:\user-sync/user-sync.php:300 252 | msgid "There was a sync problem." 253 | msgstr "" 254 | 255 | #: c:\user-sync/user-sync.php:307 256 | msgid "There was a connection problem. Please check the URL and Key of the Master site." 257 | msgstr "" 258 | 259 | #: c:\user-sync/user-sync.php:327 260 | msgid "Subsite and Settings were successfully removed from the Central site!" 261 | msgstr "" 262 | 263 | #: c:\user-sync/user-sync.php:336 264 | msgid "Synchronization of all Subsites completed." 265 | msgstr "" 266 | 267 | -------------------------------------------------------------------------------- /page-central.php: -------------------------------------------------------------------------------- 1 | options['key']; 3 | $user_sync_sub_urls = $this->options['sub_urls']; 4 | $user_sync_siteur = site_url('', 'admin'); 5 | 6 | ?> 7 | 92 |
93 | options['debug_mode'] ) && '1' == $this->options['debug_mode'] ):?> 96 |

97 | 98 |

99 |

100 | 101 | 102 | 105 | 108 | 109 | 110 | 113 | 116 | 117 |
103 | 104 | 106 | 107 |
111 | 112 | 114 | 115 |
118 | 119 |
120 |
121 | 122 |

123 |

124 |

125 |

126 |

127 |
128 | 129 |

130 | 131 | safe_mode_notice ) ):?> 134 |

135 | 136 | info_small.png" title="safe_mode_notice; ?>"/> 137 |

138 | 139 | 140 |

141 | 142 |
143 | 144 | 145 | 146 | 149 | 152 | 155 | 158 | 161 | 162 | 163 | "; 170 | } else { 171 | echo ""; 172 | } 173 | $user_sync_i++; 174 | ?> 175 | 178 | 182 | 185 | 200 | 203 | 204 | 207 |
147 | # 148 | 150 | 151 | 153 | 154 | 156 | 157 | 159 | 160 |
176 | 177 | 179 | 180 | 181 | 183 | 184 | 186 | 187 |
188 |
189 | 193 |
194 | 198 |
199 |
201 | 202 |
208 |
209 | 210 |
211 |
212 |
213 | 214 | 215 | 216 |
217 |
218 |
219 | 223 |

224 | 227 |

228 | 229 |
230 | 231 |
232 | 233 | 234 | 243 |

244 | 245 | -------------------------------------------------------------------------------- /languages/user-sync.po: -------------------------------------------------------------------------------- 1 | # LANGUAGE (LOCALE) translation for WordPress. 2 | # Copyright (C) YEAR WordPress contributors. 3 | # This file is distributed under the same license as the WordPress package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: User Sync\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2017-04-10 10:39+0100\n" 11 | "PO-Revision-Date: 2017-04-10 10:39+0100\n" 12 | "Last-Translator: Andrey Shipilov\n" 13 | "Language-Team: \n" 14 | "Language: en_US\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "X-Poedit-KeywordsList: _e;__\n" 19 | "X-Poedit-Basepath: C:\\Programs Portable\\EasyPHP\\data\\localweb\\wordpress-" 20 | "incsub\\wp-content\\plugins\\user-sync\n" 21 | "X-Generator: Poedit 1.6.4\n" 22 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 23 | "X-Poedit-SearchPath-0: C:\\Programs Portable\\EasyPHP\\data\\localweb" 24 | "\\wordpress-incsub\\wp-content\\plugins\\user-sync\n" 25 | 26 | #: C:\Programs 27 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:223 28 | msgid "install" 29 | msgstr "" 30 | 31 | #: C:\Programs 32 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:230 33 | #, php-format 34 | msgid "" 35 | "Important updates are available for %s. Install the free " 36 | "WPMU DEV Dashboard plugin now for updates and support!" 37 | msgstr "" 38 | 39 | #: C:\Programs 40 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:232 41 | #, php-format 42 | msgid "" 43 | "%s is almost ready - install the free WPMU DEV Dashboard " 44 | "plugin for updates and support!" 45 | msgstr "" 46 | 47 | #: C:\Programs 48 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:236 49 | msgid "" 50 | "Important updates are available for your WPMU DEV plugins/themes. Install " 51 | "the free WPMU DEV Dashboard plugin now for updates and support!" 52 | msgstr "" 53 | 54 | #: C:\Programs 55 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:238 56 | msgid "" 57 | "Almost ready - install the free WPMU DEV Dashboard plugin for updates and " 58 | "support!" 59 | msgstr "" 60 | 61 | #: C:\Programs 62 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:244 63 | msgid "Install Plugin" 64 | msgstr "" 65 | 66 | #: C:\Programs 67 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:247 68 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:288 69 | msgid "Saving..." 70 | msgstr "" 71 | 72 | #: C:\Programs 73 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:248 74 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:289 75 | msgid "Dismiss" 76 | msgstr "" 77 | 78 | #: C:\Programs 79 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:264 80 | msgid "activate" 81 | msgstr "" 82 | 83 | #: C:\Programs 84 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:271 85 | #, php-format 86 | msgid "" 87 | "Important updates are available for %s. Activate the WPMU " 88 | "DEV Dashboard to update now!" 89 | msgstr "" 90 | 91 | #: C:\Programs 92 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:273 93 | #, php-format 94 | msgid "" 95 | "Just one more step to enable updates and support for %s!" 96 | msgstr "" 97 | 98 | #: C:\Programs 99 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:277 100 | msgid "" 101 | "Important updates are available for your WPMU DEV plugins/themes. Activate " 102 | "the WPMU DEV Dashboard to update now!" 103 | msgstr "" 104 | 105 | #: C:\Programs 106 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:279 107 | msgid "" 108 | "Just one more step - activate the WPMU DEV Dashboard plugin and you're all " 109 | "done!" 110 | msgstr "" 111 | 112 | #: C:\Programs 113 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:285 114 | msgid "Activate WPMU DEV Dashboard" 115 | msgstr "" 116 | 117 | #: C:\Programs 118 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:952 119 | msgid "We did not find any data for this plugin or theme..." 120 | msgstr "" 121 | 122 | #: C:\Programs 123 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:1161 124 | msgid "Current" 125 | msgstr "" 126 | 127 | #: C:\Programs 128 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/dash-notice/wpmudev-dash-notification.php:1167 129 | msgid "New" 130 | msgstr "" 131 | 132 | #: C:\Programs 133 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:96 134 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:55 135 | msgid "Debug Mode is activated." 136 | msgstr "" 137 | 138 | #: C:\Programs 139 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:98 140 | msgid "Master Site Settings" 141 | msgstr "" 142 | 143 | #: C:\Programs 144 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:99 145 | msgid "" 146 | "All user data from this master site will be synchronized with connected " 147 | "subsites." 148 | msgstr "" 149 | 150 | #: C:\Programs 151 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:103 152 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:64 153 | msgid "URL of Master site:" 154 | msgstr "" 155 | 156 | #: C:\Programs 157 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:111 158 | msgid "Security Key:" 159 | msgstr "" 160 | 161 | #: C:\Programs 162 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:121 163 | msgid "" 164 | "To create a sub site, simply install this plugin at the sub site, activate " 165 | "it, make that site a 'Sub' site and enter the URL (including http) and the " 166 | "key supplied here." 167 | msgstr "" 168 | 169 | #: C:\Programs 170 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:122 171 | msgid "" 172 | "Use caution if you choose to overwrite existing users as it replaces all " 173 | "existing users and their passwords if the same username exists on the " 174 | "subsite." 175 | msgstr "" 176 | 177 | #: C:\Programs 178 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:123 179 | msgid "" 180 | "Adding new user, or making any changes to user or their details, in the " 181 | "Master site are automatically synced to subsites." 182 | msgstr "" 183 | 184 | #: C:\Programs 185 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:124 186 | msgid "" 187 | "'Sync all sites now' is used if you edit a subsite setting and need to " 188 | "update users." 189 | msgstr "" 190 | 191 | #: C:\Programs 192 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:125 193 | msgid "" 194 | "To stop a subsite from syncing with Master site simply log into the subsite, " 195 | "go to the User Sync menu and click on \"Disconnect from the Master site\" " 196 | "button or \"Uninstall Options\" button." 197 | msgstr "" 198 | 199 | #: C:\Programs 200 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:127 201 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-main.php:22 202 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:140 203 | msgid "For detailed 'how to use' instructions refer to:" 204 | msgstr "" 205 | 206 | #: C:\Programs 207 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:128 208 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-main.php:23 209 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:141 210 | msgid "WordPress User Synchronization Installation and Use instructions." 211 | msgstr "" 212 | 213 | #: C:\Programs 214 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:135 215 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:109 216 | msgid "Attention: Safe Mode!" 217 | msgstr "" 218 | 219 | #: C:\Programs 220 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:140 221 | msgid "Registered Subsites:" 222 | msgstr "" 223 | 224 | #: C:\Programs 225 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:150 226 | msgid "URLs" 227 | msgstr "" 228 | 229 | #: C:\Programs 230 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:153 231 | msgid "Last Sync" 232 | msgstr "" 233 | 234 | #: C:\Programs 235 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:156 236 | msgid "Settings" 237 | msgstr "" 238 | 239 | #: C:\Programs 240 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:159 241 | msgid "Action" 242 | msgstr "" 243 | 244 | #: C:\Programs 245 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:191 246 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:90 247 | msgid "Do not replace deleted users" 248 | msgstr "" 249 | 250 | #: C:\Programs 251 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:196 252 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:95 253 | msgid "Don't overwrite any existing users (add them as extra users)" 254 | msgstr "" 255 | 256 | #: C:\Programs 257 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:214 258 | msgid "Sync all sites now" 259 | msgstr "" 260 | 261 | #: C:\Programs 262 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:223 263 | msgid "There are no subsites registered to this master site" 264 | msgstr "" 265 | 266 | #: C:\Programs 267 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:232 268 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:126 269 | msgid "Uninstall Options" 270 | msgstr "" 271 | 272 | #: C:\Programs 273 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:233 274 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:127 275 | msgid "Delete all plugin's options from DB." 276 | msgstr "" 277 | 278 | #: C:\Programs 279 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:236 280 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:130 281 | msgid "Are you sure?" 282 | msgstr "" 283 | 284 | #: C:\Programs 285 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:239 286 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:133 287 | msgid "No" 288 | msgstr "" 289 | 290 | #: C:\Programs 291 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-central.php:240 292 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:134 293 | msgid "Yes" 294 | msgstr "" 295 | 296 | #: C:\Programs 297 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-main.php:15 298 | msgid "Site Type" 299 | msgstr "" 300 | 301 | #: C:\Programs 302 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-main.php:16 303 | msgid "" 304 | "User sync works by making one site a 'Master' site and all other sites 'Sub'." 305 | msgstr "" 306 | 307 | #: C:\Programs 308 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-main.php:17 309 | msgid "" 310 | "If you want to sync all the users from this site with other sites, make this " 311 | "a Master site." 312 | msgstr "" 313 | 314 | #: C:\Programs 315 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-main.php:18 316 | msgid "" 317 | "However, if you want to sync the users from other sites to this site, make " 318 | "this a Sub site." 319 | msgstr "" 320 | 321 | #: C:\Programs 322 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-main.php:19 323 | msgid "" 324 | "You can always change these options later by deactivating and then " 325 | "reactivating the plugin." 326 | msgstr "" 327 | 328 | #: C:\Programs 329 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-main.php:20 330 | msgid "NB: You must have at least one Master site!" 331 | msgstr "" 332 | 333 | #: C:\Programs 334 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-main.php:39 335 | msgid "" 336 | "Note: If you have any problems with sync users you can use debug mode for " 337 | "writing some operations in the log file. You need open folder \"/plugins/" 338 | "user-sync/log/\" for writing. What do with log files you can read in " 339 | "instruction of plugin" 340 | msgstr "" 341 | 342 | #: C:\Programs 343 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-main.php:40 344 | msgid "here" 345 | msgstr "" 346 | 347 | #: C:\Programs 348 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-main.php:43 349 | msgid "Use Debug Mode" 350 | msgstr "" 351 | 352 | #: C:\Programs 353 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-main.php:48 354 | msgid "Make this site the Master site" 355 | msgstr "" 356 | 357 | #: C:\Programs 358 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-main.php:49 359 | msgid "Make this a Sub site" 360 | msgstr "" 361 | 362 | #: C:\Programs 363 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:14 364 | msgid "Please write URL of Central blog" 365 | msgstr "" 366 | 367 | #: C:\Programs 368 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:19 369 | msgid "Please write Key of Central blog" 370 | msgstr "" 371 | 372 | #: C:\Programs 373 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:58 374 | msgid "Subsite Settings" 375 | msgstr "" 376 | 377 | #: C:\Programs 378 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:59 379 | msgid "All user data from the Master site will be synchronized with this site." 380 | msgstr "" 381 | 382 | #: C:\Programs 383 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:72 384 | msgid "Key of Master site:" 385 | msgstr "" 386 | 387 | #: C:\Programs 388 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:81 389 | msgid "Default settings:" 390 | msgstr "" 391 | 392 | #: C:\Programs 393 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:85 394 | msgid "You can change these settings later on the Master site." 395 | msgstr "" 396 | 397 | #: C:\Programs 398 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:102 399 | msgid "" 400 | "Note: Use caution if you choose to overwrite existing users as it replaces " 401 | "all existing users and their passwords if the same username exists on the " 402 | "subsite." 403 | msgstr "" 404 | 405 | #: C:\Programs 406 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:115 407 | msgid "Connect this site to the Master site, and do a FULL synchronization" 408 | msgstr "" 409 | 410 | #: C:\Programs 411 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:121 412 | msgid "Disconnect from the Master site" 413 | msgstr "" 414 | 415 | #: C:\Programs 416 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/page-sub.php:122 417 | msgid "Disconnect syncing with Master site" 418 | msgstr "" 419 | 420 | #: C:\Programs 421 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/user-sync.php:62 422 | msgid "" 423 | "There was an issue determining where WPMU DEV User Sync is installed. Please " 424 | "reinstall." 425 | msgstr "" 426 | 427 | #: C:\Programs 428 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/user-sync.php:68 429 | msgid "" 430 | "NOTE: Your server works in the 'Safe Mode' - If you have a large number of " 431 | "users for sync and your php settings are of little value for " 432 | "'max_execution_time' it can cause problems with connection of subsites and " 433 | "full sinchronization." 434 | msgstr "" 435 | 436 | #: C:\Programs 437 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/user-sync.php:106 438 | msgid "User Sync" 439 | msgstr "" 440 | 441 | #: C:\Programs 442 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/user-sync.php:237 443 | msgid "Options are deleted!" 444 | msgstr "" 445 | 446 | #: C:\Programs 447 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/user-sync.php:256 448 | msgid "" 449 | "Subsite successfully connected to Master site and Synchronization completed." 450 | msgstr "" 451 | 452 | #: C:\Programs 453 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/user-sync.php:259 454 | msgid "There was a sync problem." 455 | msgstr "" 456 | 457 | #: C:\Programs 458 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/user-sync.php:266 459 | msgid "" 460 | "There was a connection problem. Please check the URL and Key of the Master " 461 | "site." 462 | msgstr "" 463 | 464 | #: C:\Programs 465 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/user-sync.php:286 466 | msgid "Subsite and Settings were successfully removed from the Central site!" 467 | msgstr "" 468 | 469 | #: C:\Programs 470 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/user-sync.php:295 471 | #: Portable\EasyPHP\data\localweb\wordpress-incsub\wp-content\plugins\user-sync/user-sync.php:650 472 | msgid "Synchronization of all Subsites completed." 473 | msgstr "" 474 | -------------------------------------------------------------------------------- /user-sync.php: -------------------------------------------------------------------------------- 1 | here 6 | Version: 1.1.6 7 | Author: WPMUDEV 8 | Author URI: http://premium.wpmudev.org 9 | Text Domain: user-sync 10 | Domain Path: /languages 11 | WDP ID: 218 12 | 13 | Copyright 2007-2013 Incsub (http://incsub.com) 14 | 15 | This program is free software; you can redistribute it and/or modify 16 | it under the terms of the GNU General Public License (Version 2 - GPLv2) as published by 17 | the Free Software Foundation. 18 | 19 | This program is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with this program; if not, write to the Free Software 26 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 27 | */ 28 | 29 | 30 | /** 31 | * Plugin main class 32 | **/ 33 | 34 | class User_Sync { 35 | 36 | var $debug_mode; 37 | var $plugin_dir; 38 | var $plugin_url; 39 | var $error; 40 | var $options; 41 | 42 | /** 43 | * PHP 5 constructor 44 | **/ 45 | function __construct() { 46 | global $wpmudev_notices; 47 | $wpmudev_notices[] = array( 'id'=> 218,'name'=> 'User Synchronization', 'screens' => array( 'toplevel_page_user-sync' ) ); 48 | include_once( 'dash-notice/wpmudev-dash-notification.php' ); 49 | 50 | load_plugin_textdomain( 'user-sync', false, basename( dirname( __FILE__ ) ) . '/languages' ); 51 | 52 | $this->plugin_dir = plugin_dir_path( __FILE__ ); 53 | $this->plugin_url = plugin_dir_url( __FILE__ ); 54 | 55 | // Check for safe mode 56 | if ( ini_get( 'safe_mode' ) ) { 57 | //notice for safe mode 58 | $this->safe_mode_notice = __( "NOTE: Your server works in the 'Safe Mode' - If you have a large number of users for sync and your php settings are of little value for 'max_execution_time' it can cause problems with connection of subsites and full sinchronization.", 'user-sync' ); 59 | } else { 60 | // set unlimit time 61 | set_time_limit(0); 62 | } 63 | 64 | add_action( 'admin_init', array( &$this, 'admin_init' ) ); 65 | 66 | //rewrite old options from old version of plugin 67 | $this->rewrite_options(); 68 | $this->options = $this->get_options(); 69 | 70 | add_action( 'admin_menu', array( &$this, 'admin_page' ) ); 71 | 72 | //actions only for master site 73 | if ( "central" == $this->options['status'] ) { 74 | add_action( 'profile_update', array( &$this, 'user_change_data' ), 20 ); 75 | add_action( 'user_register', array( &$this, 'user_change_data' ), 20 ); 76 | add_action( 'run_user_change_data_event', array( &$this, 'user_change_data_event' ), 20 ); 77 | add_action( 'delete_user', array( &$this, 'user_delete_data' ), 20 ); 78 | add_action( 'after_password_reset', array( &$this, 'user_password_reset' ), 20, 2 ); 79 | add_action( 'run_user_password_reset_event', array( &$this, 'user_password_reset_event' ), 20, 2 ); 80 | 81 | } 82 | //add_action( 'bp_core_signup_after_activate', array( &$this, 'bp_users_activate' ), 20, 2 ); 83 | 84 | add_action( 'wp_ajax_user_sync_sync_all', array( &$this, 'sync_all_subsite' ) ); 85 | 86 | add_action( 'wp_ajax_nopriv_user_sync_api', array( &$this, 'user_sync_ajax_action' ) ); 87 | add_action( 'wp_ajax_user_sync_api', array( &$this, 'user_sync_ajax_action' ) ); 88 | 89 | add_action( 'wp_ajax_nopriv_user_sync_settings', array( &$this, 'edit_settings' ) ); 90 | add_action( 'wp_ajax_user_sync_settings', array( &$this, 'edit_settings' ) ); 91 | 92 | add_action('admin_enqueue_scripts', array($this,'register_scripts_styles_admin')); 93 | 94 | // adds privacy policy text suggestion 95 | add_action( 'admin_init', array( $this, 'privacy_policy_suggested_text' ) ); 96 | } 97 | 98 | /** 99 | * Creating admin menu 100 | **/ 101 | function admin_page() { 102 | add_menu_page( __( 'User Sync', 'user-sync' ), __( 'User Sync', 'user-sync' ), 'manage_options', 'user-sync', array( &$this, 'plugin_page' ), $this->plugin_url . 'images/icon.png' ); 103 | } 104 | 105 | 106 | /** 107 | * set options 108 | **/ 109 | function set_options( $section, $values ) { 110 | $options = get_option( 'user_sync_options' ); 111 | $options[$section] = $values; 112 | update_option( "user_sync_options", $options ); 113 | $this->options = $this->get_options(); 114 | } 115 | 116 | /** 117 | * get options 118 | **/ 119 | function get_options() { 120 | return $options = get_option( 'user_sync_options' ); 121 | } 122 | 123 | /** 124 | * Rewrite plugin option from old version 125 | **/ 126 | function rewrite_options() { 127 | 128 | if ( get_option( "user_sync_status" ) ) { 129 | $this->set_options( "status", get_option( "user_sync_status" ) ); 130 | delete_option( 'user_sync_status' ); 131 | } 132 | 133 | if ( get_option( "user_sync_key" ) ) { 134 | $this->set_options( "key", get_option( "user_sync_key" ) ); 135 | delete_option( 'user_sync_key' ); 136 | } 137 | 138 | if ( get_option( "user_sync_sub_urls" ) ) { 139 | $this->set_options( "sub_urls", get_option( "user_sync_sub_urls" ) ); 140 | delete_option( 'user_sync_sub_urls' ); 141 | } 142 | 143 | if ( get_option( "user_sync_url_c" ) ) { 144 | $this->set_options( "central_url", get_option( "user_sync_url_c" ) ); 145 | delete_option( 'user_sync_url_c' ); 146 | } 147 | 148 | if ( get_option( "user_sync_deleted_users" ) ) { 149 | $this->set_options( "deleted_users", get_option( "user_sync_deleted_users" ) ); 150 | delete_option( 'user_sync_deleted_users' ); 151 | } 152 | } 153 | 154 | 155 | /** 156 | * Write log 157 | **/ 158 | function write_log( $message ) { 159 | if ( isset($this->options['debug_mode']) && '1' == $this->options['debug_mode'] ) { 160 | if ( "central" == $this->options['status'] ) { 161 | $site_type = "[M] "; 162 | $file = $this->plugin_dir . "log/errors_m.log"; 163 | } else { 164 | $site_type = "[S] "; 165 | $file = $this->plugin_dir . "log/errors_s.log"; 166 | } 167 | 168 | $handle = fopen( $file, 'ab' ); 169 | $data = date( "[Y-m-d H:i:s]" ) . $site_type . $message . "***\r\n"; 170 | fwrite($handle, $data); 171 | fclose($handle); 172 | } 173 | } 174 | 175 | 176 | /** 177 | * Adding css style and script for admin page 178 | **/ 179 | function register_scripts_styles_admin($hook) { 180 | if( $hook == 'toplevel_page_user-sync' ) { 181 | wp_register_style('user-sync-admin', $this->plugin_url.'/css/admin.css'); 182 | wp_enqueue_style('user-sync-admin'); 183 | 184 | wp_register_script( 'jquery-tooltips', $this->plugin_url . 'js/jquery.tools.min.js', array('jquery') ); 185 | wp_enqueue_script( 'jquery-tooltips' ); 186 | 187 | wp_register_script( 'user-sync', $this->plugin_url . 'js/admin.js', array('jquery') ); 188 | wp_enqueue_script( 'user-sync' ); 189 | } 190 | global $wp_version; 191 | 192 | if ( $wp_version >= 3.8 ) { 193 | wp_register_style( 'user-sync-mp6', $this->plugin_url.'/css/mp6.css'); 194 | wp_enqueue_style('user-sync-mp6'); 195 | } 196 | } 197 | 198 | 199 | /** 200 | * plugin actions 201 | **/ 202 | function admin_init() { 203 | if ( isset( $_POST['usync_action'] ) ) 204 | switch( $_POST['usync_action'] ) { 205 | //Saving choose of site "Central" or "Subsite" 206 | case "install": 207 | //creating additional options for central site 208 | if ( "central" == $_POST['user_sync_status'] ) { 209 | $this->set_options( 'status', $_POST['user_sync_status'] ); 210 | $this->set_options( 'key', $this->gener_key() ); 211 | $this->set_options( 'sub_urls', '' ); 212 | } 213 | 214 | //creating additional options for sub site 215 | if ( "sub" == $_POST['user_sync_status'] ) { 216 | $this->set_options( 'status', $_POST['user_sync_status'] ); 217 | $this->set_options( 'key', '' ); 218 | $this->set_options( 'central_url', '' ); 219 | $this->set_options( 'deleted_users', '' ); 220 | } 221 | 222 | //set debug mode 223 | if ( isset ( $_POST['debug'] ) && '1' == $_POST['debug'] ) 224 | $this->set_options( 'debug_mode', '1' ); 225 | 226 | wp_redirect( add_query_arg( array( 'page' => 'user-sync'), 'admin.php' ) ); 227 | exit; 228 | break; 229 | 230 | //delete all plugin options 231 | case "uninstall": 232 | $this->uninstall( ); 233 | wp_redirect( add_query_arg( array( 'page' => 'user-sync', 'updated' => 'true', 'dmsg' => urlencode( __( "Options are deleted!", 'user-sync' ) ) ), 'admin.php' ) ); 234 | exit; 235 | break; 236 | 237 | //Creating additional options of Subsite and Saving URL of Central site and Security Key 238 | case "sub_site": 239 | if ( ! empty( $_POST['user_sync_url_c']) && ! empty( $_POST['user_sync_key'] ) ) { 240 | 241 | $this->set_options( 'central_url', $_POST['user_sync_url_c'] ); 242 | $this->set_options( 'key', $_POST['user_sync_key'] ); 243 | 244 | //connect Subsite to Master site 245 | $result = $this->connect_new_subsite( $_POST['user_sync_url_c'], $_POST['user_sync_key'] ); 246 | 247 | if ( "ok" == $result ) { 248 | //Call Synchronization when activating new Subsite 249 | $result = $this->sync_new_subsite( $_POST['user_sync_url_c'], $_POST['user_sync_key'] ); 250 | 251 | if ( "ok" == $result ) { 252 | wp_redirect( add_query_arg( array( 'page' => 'user-sync', 'updated' => 'true', 'dmsg' => urlencode( __( 'Subsite successfully connected to Master site and Synchronization completed.', 'user-sync' ) ) ), 'admin.php' ) ); 253 | exit; 254 | } else { 255 | wp_redirect( add_query_arg( array( 'page' => 'user-sync', 'updated' => 'true', 'dmsg' => urlencode( __( 'There was a sync problem.', 'user-sync' ) ) ), 'admin.php' ) ); 256 | exit; 257 | } 258 | } else { 259 | $this->set_options( 'central_url', '' ); 260 | $this->set_options( 'key', '' ); 261 | 262 | wp_redirect( add_query_arg( array( 'page' => 'user-sync', 'updated' => 'true', 'dmsg' => urlencode( __( 'There was a connection problem. Please check the URL and Key of the Master site.', 'user-sync' ) ) ), 'admin.php' ) ); 263 | exit; 264 | } 265 | } 266 | break; 267 | 268 | //Removing Subsite from Central list 269 | case "remove_settings": 270 | $p = base64_encode( get_option( 'siteurl' ) ); 271 | 272 | $hash = md5( $p . $this->options['key'] ); 273 | 274 | //delete url from Sub list on central site 275 | $this->send_request( $this->options['central_url'], "user_sync_action=delete_subsite&hash=". $hash . "&p=" . $p ); 276 | 277 | //reset options of Sub site 278 | $this->set_options( 'central_url', '' ); 279 | $this->set_options( 'key', '' ); 280 | $this->set_options( 'deleted_users', '' ); 281 | 282 | wp_redirect( add_query_arg( array( 'page' => 'user-sync', 'updated' => 'true', 'dmsg' => urlencode( __( 'Subsite and Settings were successfully removed from the Central site!', 'user-sync' ) ) ), 'admin.php' ) ); 283 | exit; 284 | break; 285 | 286 | //Call function for Synchronization of all Subsites 287 | case "sync_all": 288 | 289 | $this->sync_all_subsite(); 290 | 291 | wp_redirect( add_query_arg( array( 'page' => 'user-sync', 'updated' => 'true', 'dmsg' => urlencode( __( 'Synchronization of all Subsites completed.', 'user-sync' ) ) ), 'admin.php' ) ); 292 | exit; 293 | break; 294 | } 295 | 296 | } 297 | 298 | /** 299 | * Deleting options and Sub url 300 | **/ 301 | function uninstall() { 302 | //check type of blog 303 | if ( "sub" == $this->options['status'] && '' != $this->options['key'] && '' != $this->options['central_url'] ) { 304 | $p = base64_encode( get_option( 'siteurl' ) ); 305 | 306 | $hash = md5( $p . $this->options['key'] ); 307 | 308 | //delete url from Sub list on central site 309 | $this->send_request( $this->options['central_url'], "user_sync_action=delete_subsite&hash=". $hash . "&p=" . $p ); 310 | } 311 | 312 | delete_option( 'user_sync_options' ); 313 | } 314 | 315 | /** 316 | * Editing settings of Sub site 317 | **/ 318 | function edit_settings() { 319 | $sub_urls = $this->options['sub_urls']; 320 | 321 | $array_id = $this->get_index_by_url( base64_decode($_REQUEST['url']), $sub_urls ); 322 | 323 | if ( -1 != $array_id ) { 324 | if ( "0" == $_POST['replace_user'] || "1" == $_POST['replace_user'] ) 325 | $sub_urls[$array_id]['param']['replace_user'] = $_POST['replace_user']; 326 | 327 | if ( "0" == $_POST['overwrite_user'] || "1" == $_POST['overwrite_user'] ) 328 | $sub_urls[$array_id]['param']['overwrite_user'] = $_POST['overwrite_user']; 329 | 330 | $this->set_options( 'sub_urls', $sub_urls ); 331 | } 332 | } 333 | 334 | /** 335 | * Generating key of security 336 | **/ 337 | function gener_key() { 338 | return wp_generate_password( 15 ); 339 | } 340 | 341 | /** 342 | * Sending request on URL 343 | **/ 344 | function send_request( $url, $param, $blocking = true ) { 345 | 346 | $url = $url . "/wp-admin/admin-ajax.php?action=user_sync_api"; 347 | 348 | $args = array( 349 | 'method' => 'POST', 350 | 'timeout' => apply_filters('user_sync_timeout', 10), 351 | 'blocking' => $blocking, 352 | 'sslverify' => false, 353 | 'body' => $param 354 | ); 355 | 356 | //writing some information in the plugin log file 357 | $this->write_log( "02 - sending request - url={$url};;" ); 358 | 359 | $response = wp_remote_post( $url, $args ); 360 | 361 | if( is_wp_error( $response ) ) { 362 | //writing some information in the plugin log file 363 | $this->write_log( "04 - sending request: something went wrong={$response->get_error_message()};;" ); 364 | 365 | // echo 'Something went wrong!'; 366 | 367 | return false; 368 | } else { 369 | //writing some information in the plugin log file 370 | $this->write_log( "03 - sending request - response={$response["body"]};;" ); 371 | // var_dump($response["body"]); 372 | // exit; 373 | return $response["body"]; 374 | } 375 | 376 | } 377 | 378 | /** 379 | * Checking key of security on Subsite 380 | **/ 381 | function check_key( $url, $key ) { 382 | //generate rendom string 383 | $str = substr( md5( uniqid( rand(), true ) ), 0, 10); 384 | 385 | //get hash from Subsite 386 | $hash = $this->send_request( $url, "str=" . $str ); 387 | 388 | //checking hash from Subsite and Central site 389 | if ( trim($hash) == md5( $str . "" . $key ) ) { 390 | //writing some information in the plugin log file 391 | $this->write_log( "05 - checking key true;;" ); 392 | 393 | return true; 394 | } else { 395 | //writing some information in the plugin log file 396 | $this->write_log( "06 - checking key false;;" ); 397 | 398 | return false; 399 | } 400 | } 401 | 402 | /** 403 | * Get all Users ID 404 | **/ 405 | function get_all_users_id() { 406 | global $wpdb; 407 | 408 | $sql = apply_filters('user_sync_custom_sql', "SELECT ID FROM {$wpdb->users}"); 409 | $rows = $wpdb->get_results( $sql ); 410 | 411 | foreach( $rows as $row ) { 412 | $result[] = $row->ID; 413 | } 414 | return $result; 415 | } 416 | 417 | /** 418 | * Get array index by URL 419 | **/ 420 | function get_index_by_url( $url, $arr ) { 421 | $i = 0; 422 | foreach ( $arr as $one ) { 423 | if ( $url == $one['url'] ) 424 | return $i; 425 | 426 | $i++; 427 | } 428 | 429 | return -1; 430 | } 431 | 432 | 433 | /** 434 | * Update other data of user 435 | **/ 436 | function update_other_user_data( $userdata, $user_id ) { 437 | Global $wpdb; 438 | 439 | //Update password - becouse if add password "wp_update_user" will be double md5 - wrong password 440 | $result = $wpdb->query( $wpdb->prepare( " 441 | UPDATE {$wpdb->users} SET 442 | user_pass = '%s' WHERE ID = '%d'", 443 | $userdata['user_pass'], $user_id ) ); 444 | unset($userdata['user_pass']); 445 | 446 | //Update email on blank if email is duplicate 447 | if ( "temp@temp.temp" == $userdata['user_email'] ) 448 | $result = $wpdb->query( $wpdb->prepare( " 449 | UPDATE {$wpdb->users} SET 450 | user_email = '%s' WHERE ID = '%d'", 451 | "", $user_id ) ); 452 | unset($userdata['user_email']); 453 | 454 | //Update user Role 455 | $result = $wpdb->query( $wpdb->prepare( " 456 | UPDATE {$wpdb->usermeta} SET 457 | meta_value = '%s' WHERE user_id = '%d' AND meta_key = '{$wpdb->base_prefix}capabilities'", 458 | serialize( $userdata['wp_capabilities'] ), $user_id ) ); 459 | unset($userdata['wp_capabilities']); 460 | 461 | //Update user Level 462 | $result = $wpdb->query( $wpdb->prepare( " 463 | UPDATE {$wpdb->usermeta} SET 464 | meta_value = '%s' WHERE user_id = '%d' AND meta_key = '{$wpdb->base_prefix}user_level'", 465 | $userdata['wp_user_level'], $user_id ) ); 466 | unset($userdata['wp_user_level']); 467 | 468 | 469 | foreach( $userdata as $k => $v ) { 470 | update_user_meta($user_id,$k,$v); 471 | } 472 | 473 | } 474 | 475 | /** 476 | * Synchronization user 477 | **/ 478 | function sync_user( $users_id, $urls, $blocking = true ) { 479 | $key = $this->options['key']; 480 | $urls = (array) $urls; 481 | $users_id = (array) $users_id; 482 | 483 | $errors = array('sites' => array(), 'users' => array()); 484 | 485 | foreach ( $urls as $one ) { 486 | //Checking key of security from Subsite 487 | if ( $this->check_key( $one['url'], $key ) ) { 488 | foreach ( $users_id as $user_id ) { 489 | //get all information about user 490 | $userdata = $this->_get_user_data( $user_id ); 491 | 492 | $p = array ( 'param' => array( 'replace_user' => $one['param']['replace_user'], 'overwrite_user' => $one['param']['overwrite_user'] ), 493 | 'userdata' => $userdata ); 494 | 495 | $p = base64_encode( serialize ( $p ) ); 496 | $hash = md5( $p . $key ); 497 | 498 | //writing some information in the plugin log file 499 | $this->write_log( "09 - user sync" ); 500 | 501 | //sent information about user and hash to Subsite 502 | $result = $this->send_request( $one['url'], "user_sync_action=sync_user&hash=". $hash . "&p=" . $p, $blocking ); 503 | 504 | if(!$result) 505 | $errors['users'][] = $user_id; 506 | 507 | //Update last Sync date 508 | $sub_urls = $this->options['sub_urls']; 509 | $array_id = $this->get_index_by_url( $one['url'], $sub_urls ); 510 | $sub_urls[$array_id]['last_sync'] = date( "m.d.y G:i:s" ); 511 | $this->set_options( 'sub_urls', $sub_urls ); 512 | } 513 | } 514 | else { 515 | $errors['sites'][] = $one['url']; 516 | } 517 | } 518 | 519 | return $errors; 520 | } 521 | 522 | /** 523 | * Synchronization when user edit profile 524 | **/ 525 | function user_change_data( $userID ) { 526 | $this->write_log( time() . " Changing Data for user: {$userID}" ); 527 | wp_schedule_single_event( time(), 'run_user_change_data_event', array( $userID ) ); 528 | } 529 | 530 | function user_change_data_event( $userID ) { 531 | $this->write_log( time() . " Running scheduled Sync event for user: {$userID}" ); 532 | //Call Synchronization function with ID of changed user and array of all Subsite URLs 533 | $this->sync_user( $userID, $this->options['sub_urls'], false ); 534 | } 535 | 536 | /** 537 | * Password reset 538 | * 539 | */ 540 | function user_password_reset( $user, $new_password ) { 541 | $this->write_log( time() . " Changing Password for user: {$user->ID}" ); 542 | wp_schedule_single_event( time(), 'run_user_password_reset_event', array( $user, $new_password ) ); 543 | 544 | } 545 | 546 | function user_password_reset_event( $user, $new_password ) { 547 | $this->write_log( time() . " Running scheduled Password Change event for user: {$user->ID}" ); 548 | $this->sync_user( $user->ID, $this->options['sub_urls'], false ); 549 | } 550 | 551 | /** 552 | * Synchronization when user deleting 553 | **/ 554 | function user_delete_data( $userID ) { 555 | $user_data = $this->_get_user_data( $userID ); 556 | 557 | $status = $this->options['status']; 558 | 559 | if ( "sub" == $status ) { 560 | //Adding login of user to list of deleted users on Sub site 561 | $deleted_users = (array) $this->options['deleted_users']; 562 | 563 | if ( false === array_search( $user_data['user_login'], $deleted_users ) ) { 564 | $deleted_users[] = $user_data['user_login']; 565 | $this->set_options( 'deleted_users', $deleted_users ); 566 | } 567 | } elseif ( "central" == $status ) { 568 | $key = $this->options['key']; 569 | $sub_urls = $this->options['sub_urls']; 570 | 571 | 572 | //Deleting user from all Subsite 573 | if ( false !== $sub_urls ) 574 | foreach ( $sub_urls as $one ) { 575 | //Checking key of security from Subsite 576 | if ( $this->check_key( $one['url'], $key ) ) { 577 | 578 | $p = array( 'user_login' => $user_data['user_login'], 'overwrite_user' => $one['param']['overwrite_user'] ); 579 | $p = base64_encode( serialize ( $p ) ); 580 | $hash = md5( $p . $key ); 581 | 582 | 583 | $this->send_request( $one['url'], "user_sync_action=sync_user_delete&hash=". $hash . "&p=" . $p ); 584 | 585 | //Update last Sync date 586 | $sub_urls = $this->options['sub_urls']; 587 | $array_id = $this->get_index_by_url( $one['url'], $sub_urls ); 588 | $sub_urls[$array_id]['last_sync'] = date( "m.d.y G:i:s" ); 589 | $this->set_options( 'sub_urls', $sub_urls ); 590 | } 591 | } 592 | } 593 | } 594 | 595 | /** 596 | * Connect new subsite to master site 597 | **/ 598 | function connect_new_subsite( $central_url, $key ) { 599 | $replace_user = 0; 600 | $overwrite_user = 0; 601 | 602 | //Settings of Sub site 603 | if ( isset( $_POST['replace_user'] ) && "1" == $_POST['replace_user'] ) 604 | $replace_user = 1; 605 | 606 | if ( isset( $_POST['overwrite_user'] ) && "1" == $_POST['overwrite_user'] ) 607 | $overwrite_user = 1; 608 | 609 | $p = array ( 'url' => get_option( 'siteurl' ), 'replace_user' => $replace_user, 'overwrite_user' => $overwrite_user ); 610 | 611 | //writing some information in the plugin log file 612 | $this->write_log( "01 - new subsite conection - central_url={$central_url};; replace_user={$replace_user};; overwrite_user={$overwrite_user};;" ); 613 | 614 | $p = base64_encode( serialize ( $p ) ); 615 | 616 | $hash = md5( $p . $key ); 617 | 618 | $result = $this->send_request( $central_url, "user_sync_action=connect_new_subsite&hash=". $hash . "&p=" . $p ); 619 | 620 | return $result; 621 | } 622 | 623 | /** 624 | * Synchronization when activating new Subsite 625 | **/ 626 | function sync_new_subsite( $central_url, $key ) { 627 | 628 | $p = array ( 'url' => get_option( 'siteurl' ) ); 629 | 630 | //writing some information in the plugin log file 631 | $this->write_log( "01_2 - sync users for new subsite" ); 632 | 633 | $p = base64_encode( serialize ( $p ) ); 634 | 635 | $hash = md5( $p . $key ); 636 | 637 | $result = $this->send_request( $central_url, "user_sync_action=sync_new_subsite&hash=". $hash . "&p=" . $p ); 638 | 639 | return $result; 640 | } 641 | 642 | /** 643 | * Synchronization of all Subsites 644 | **/ 645 | function sync_all_subsite() { 646 | $users_per_request = apply_filters('user_sync_sync_all_users_per_request', 50); 647 | 648 | //Get all users ID 649 | $users_id = $this->get_all_users_id(); 650 | $sites = $this->options['sub_urls']; 651 | 652 | $users_end = 1; 653 | $sites_end = 1; 654 | $redirect_url = false; 655 | 656 | if(isset($_REQUEST['page'])) { 657 | $users_start_index = $_REQUEST['page'] < 2 ? 0 : (($users_per_request * $_REQUEST['page']-1)-1); 658 | 659 | $users_id = array_slice($users_id, $users_start_index, $users_per_request); 660 | 661 | $users_end = count($users_id) < $users_per_request ? 1 : 0; 662 | } 663 | if(isset($_REQUEST['site'])) { 664 | $sites = array_slice($sites, ($_REQUEST['site']-1), 1); 665 | 666 | $sites_end = !$sites ? 1 : 0; 667 | 668 | if($sites_end) 669 | $redirect_url = add_query_arg( array( 'page' => 'user-sync', 'updated' => 'true', 'dmsg' => urlencode( __( 'Synchronization of all Subsites completed.', 'user-sync' ) ) ), 'admin.php' ); 670 | } 671 | 672 | //Call Synchronization for all Subsites 673 | $errors = (count($sites) && count($users_id)) ? $this->sync_user( $users_id, $sites ) : false; 674 | 675 | if(defined('DOING_AJAX')) { 676 | wp_send_json_success(array('errors' => $errors, 'users_end' => $users_end, 'sites_end' => $sites_end, 'redirect_url' => $redirect_url)); 677 | } 678 | } 679 | 680 | /** 681 | * Ajax function for changes data on remote site 682 | **/ 683 | function user_sync_ajax_action() { 684 | $key = $this->options['key']; 685 | //writing some information in the plugin log file 686 | $this->write_log( "0-10 - ajax actions" ); 687 | 688 | if ( false === $key ) { 689 | //writing some information in the plugin log file 690 | $this->write_log( "1-10 - key not exist" ); 691 | die( "" ); 692 | } 693 | 694 | 695 | //action for checking security key on Subsite 696 | if ( isset ( $_REQUEST['str'] ) && "" != $_REQUEST['str'] ) { 697 | die( md5( $_REQUEST['str'] . $key ) ); 698 | } 699 | 700 | if ( isset ( $_REQUEST['user_sync_action'] ) && "" == $_REQUEST['user_sync_action'] ) { 701 | //writing some information in the plugin log file 702 | $this->write_log( "2-10 - user_sync_action not exist" ); 703 | die( "" ); 704 | } 705 | 706 | if ( isset ( $_REQUEST['p'] ) && "" != $_REQUEST['p'] && isset ( $_REQUEST['hash'] ) && "" != $_REQUEST['hash'] ) { 707 | //checking hash sum 708 | if ( $_REQUEST['hash'] == md5( $_REQUEST['p'] . $key ) ) { 709 | $p = base64_decode( $_REQUEST['p'] ); 710 | 711 | global $wpdb; 712 | 713 | switch( $_REQUEST[ 'user_sync_action' ] ) { 714 | //action for Synchronization user 715 | case "sync_user": 716 | $p = unserialize( $p ); 717 | //writing some information in the plugin log file 718 | $this->write_log( "5-10 - start sync_user" ); 719 | 720 | $user_sync_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->users} WHERE user_login = '%s'", $p['userdata']['user_login'] ) ); 721 | 722 | if( $user_sync_id ) { 723 | //Update user 724 | 725 | //writing some information in the plugin log file 726 | $this->write_log( "10 - update user" ); 727 | 728 | //checking settings of overwrite user and flag of users that sync from master site 729 | if ( 1 == $p['param']['overwrite_user'] && "1" != get_user_meta( $user_sync_id, "user_sync", true ) ) { 730 | 731 | $user_sync_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->users} WHERE user_login = '%s'", $p['userdata']['user_login'] . "_sync" ) ); 732 | 733 | //if user exist we have new ID in $user_sync_id and we can use code below for Update user data 734 | if( ! $user_sync_id ) { 735 | 736 | //writing some information in the plugin log file 737 | $this->write_log( "11 - don't overwrite user" ); 738 | 739 | //changing user login adding _sync 740 | $p['userdata']['user_login'] = $p['userdata']['user_login'] . "_sync"; 741 | 742 | //checking email of user on duplicate 743 | if ( $user_sync_id != email_exists( $p['userdata']['user_email'] ) && false != email_exists( $p['userdata']['user_email'] ) ) 744 | $p['userdata']['user_email'] = $this->generate_email($p['userdata']['user_login']); 745 | 746 | //user password 747 | $user_sync_pass = $p['userdata']['user_pass']; 748 | 749 | //delete user ID and user_pass for Insert new user 750 | unset( $p['userdata']['ID'] ); 751 | unset( $p['userdata']['user_pass'] ); 752 | 753 | //Insert new user 754 | //TODO: try use real password 755 | $p['userdata']['user_pass'] = ''; 756 | $user_sync_last_id = wp_insert_user( $p['userdata'] ); 757 | 758 | //adding user password back for updating it 759 | $p['userdata']['user_pass'] = $user_sync_pass; 760 | 761 | //Update other data of user 762 | $this->update_other_user_data( $p['userdata'], $user_sync_last_id ); 763 | 764 | //writing some information in the plugin log file 765 | $this->write_log( "12 - don't overwrite user - ok" ); 766 | 767 | return; 768 | } 769 | } 770 | 771 | //writing some information in the plugin log file 772 | $this->write_log( "13 - overwrite user" ); 773 | 774 | $p['userdata']['ID'] = $user_sync_id; 775 | 776 | //user password 777 | $user_sync_pass = $p['userdata']['user_pass']; 778 | 779 | //delete user_pass for update user 780 | unset( $p['userdata']['user_pass'] ); 781 | 782 | 783 | //checking email of user on duplicate 784 | if ( $user_sync_id != email_exists( $p['userdata']['user_email'] ) && false != email_exists( $p['userdata']['user_email'] ) ) 785 | $p['userdata']['user_email'] = $this->generate_email($p['userdata']['user_login']); 786 | 787 | //update user data 788 | $p['userdata']['user_pass'] = ''; 789 | $user_sync_last_id = wp_insert_user( $p['userdata'] ); 790 | 791 | //adding user password back for updating it 792 | $p['userdata']['user_pass'] = $user_sync_pass; 793 | 794 | //Update other data of user 795 | $this->update_other_user_data( $p['userdata'], $user_sync_last_id ); 796 | 797 | //writing some information in the plugin log file 798 | $this->write_log( "14 - overwrite user - ok" ); 799 | 800 | } else { 801 | 802 | //writing some information in the plugin log file 803 | $this->write_log( "15 - insert user - step 1" ); 804 | 805 | if ( 1 == $p['param']['replace_user'] ) { 806 | $deleted_users = $this->options['deleted_users']; 807 | 808 | //writing some information in the plugin log file 809 | $this->write_log( "16 - do not replace deleted users" ); 810 | 811 | if ( is_array( $deleted_users ) && false !== array_search( $p['userdata']['user_login'], $deleted_users ) ) 812 | return; 813 | } 814 | 815 | //writing some information in the plugin log file 816 | $this->write_log( "17 - insert user - step 2" ); 817 | 818 | //user password 819 | $user_sync_pass = $p['userdata']['user_pass']; 820 | 821 | //delete user ID and user_pass for Insert new user 822 | unset( $p['userdata']['ID'] ); 823 | unset( $p['userdata']['user_pass'] ); 824 | 825 | //checking email of user on duplicate 826 | if ( $user_sync_id != email_exists( $p['userdata']['user_email'] ) && false != email_exists( $p['userdata']['user_email'] ) ) 827 | $p['userdata']['user_email'] = $this->generate_email($p['userdata']['user_login']); 828 | 829 | //Insert new user 830 | $p['userdata']['user_pass'] = ''; 831 | $user_sync_last_id = wp_insert_user( $p['userdata'] ); 832 | 833 | //adding user password back for updating it 834 | $p['userdata']['user_pass'] = $user_sync_pass; 835 | 836 | //Update other data of user 837 | $this->update_other_user_data( $p['userdata'], $user_sync_last_id ); 838 | 839 | //flag for users that sync from master site 840 | add_user_meta( $user_sync_last_id, "user_sync", "1", false ); 841 | 842 | //writing some information in the plugin log file 843 | $this->write_log( "18 - insert user - ok" ); 844 | } 845 | 846 | die( "ok" ); 847 | break; 848 | 849 | //action for Synchronization when deleting user 850 | case "sync_user_delete": 851 | $p = unserialize( $p ); 852 | 853 | //checking that user exist 854 | $user_sync_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->users} WHERE user_login = '%s'", $p['user_login'] ) ); 855 | 856 | if( $user_sync_id ) { 857 | //Update user 858 | //checking settings of overwrite user and flag of users that sync from master site 859 | if ( 1 == $p['overwrite_user'] && "1" != get_user_meta( $user_sync_id, "user_sync", true ) ) { 860 | 861 | $user_sync_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->users} WHERE user_login = '%s'", $p['user_login'] . "_sync" ) ); 862 | 863 | if( ! $user_sync_id ) 864 | return; 865 | 866 | } 867 | 868 | //deleting user 869 | $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->usermeta} WHERE user_id = %d", $user_sync_id ) ); 870 | $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->users} WHERE ID = %d", $user_sync_id ) ); 871 | } 872 | 873 | die( "ok" ); 874 | break; 875 | 876 | //action for Synchronization when activating new Subsite 877 | case "connect_new_subsite": 878 | $p = unserialize( $p ); 879 | 880 | $sub_urls = $this->options['sub_urls']; 881 | 882 | $p = array ( 883 | 'url' => $p['url'], 884 | 'last_sync' => '', 885 | 'param' => 886 | array( 887 | 'replace_user' => $p['replace_user'], 888 | 'overwrite_user' => $p['overwrite_user'] 889 | ) ); 890 | 891 | if ( is_array( $sub_urls ) ) { 892 | if ( -1 == $this->get_index_by_url( $p['url'], $sub_urls ) ) { 893 | $sub_urls[] = $p; 894 | $this->set_options( 'sub_urls', $sub_urls ); 895 | } 896 | } else { 897 | $sub_urls = array(); 898 | $sub_urls[] = $p; 899 | $this->set_options( 'sub_urls', $sub_urls ); 900 | } 901 | 902 | //writing some information in the plugin log file 903 | $this->write_log( "07 - added new sub site" ); 904 | 905 | die( "ok" ); 906 | break; 907 | 908 | //action for Synchronization when activating new Subsite 909 | case "sync_new_subsite": 910 | $p = unserialize( $p ); 911 | 912 | $sub_urls = $this->options['sub_urls']; 913 | 914 | //Get all users ID 915 | $users_id = $this->get_all_users_id(); 916 | 917 | //writing some information in the plugin log file 918 | $this->write_log( "08 - count of users= ". count( $users_id ) . ";;" ); 919 | 920 | $array_id = $this->get_index_by_url( $p['url'], $sub_urls ); 921 | 922 | //Call Synchronization user function 923 | $this->sync_user( $users_id, array( $sub_urls[$array_id] ) ); 924 | 925 | die( "ok" ); 926 | break; 927 | 928 | //action for deleting Subsite URL from Central site 929 | case "delete_subsite": 930 | $sub_urls = $this->options['sub_urls']; 931 | 932 | $array_id = $this->get_index_by_url( $p, $sub_urls ); 933 | 934 | if ( -1 != $array_id ) { 935 | array_splice( $sub_urls, $array_id, 1 ); 936 | 937 | $this->set_options( 'sub_urls', $sub_urls ); 938 | } 939 | 940 | die( "ok" ); 941 | break; 942 | } 943 | 944 | } 945 | //writing some information in the plugin log file 946 | $this->write_log( "4-10 - hash sum error" ); 947 | } 948 | //writing some information in the plugin log file 949 | $this->write_log( "3-10 - p or hash not set" ); 950 | } 951 | 952 | /** 953 | * Generate Email for the domain 954 | * We dont want to have users with the same email and cause errors 955 | * 956 | * @param String $user_name - current username 957 | * 958 | * @return String 959 | */ 960 | function generate_email( $user_name ){ 961 | $url = site_url(); 962 | $url_info = pathinfo($url); 963 | 964 | if ( $url_info['dirname'] ){ 965 | $domain = $url_info['dirname']; 966 | } else { 967 | $domain = $url_info['basename']; 968 | } 969 | 970 | $domain = str_replace( "www.", "", $domain ); 971 | $user_count = get_user_count(); 972 | 973 | if ( empty( $user_name ) ){ 974 | $user_name = 'test'; 975 | } 976 | 977 | return $user_name.'_'.$user_count.'@'.$domain; 978 | } 979 | 980 | /** 981 | * Tempalate of pages 982 | **/ 983 | function plugin_page() { 984 | global $wpdb; 985 | 986 | //Display status message 987 | if ( isset( $_GET['updated'] ) ) { 988 | ?>

options['status'] ) { 992 | case "sub": 993 | require_once( $this->plugin_dir . "page-sub.php" ); 994 | break; 995 | 996 | case "central": 997 | require_once( $this->plugin_dir . "page-central.php" ); 998 | break; 999 | 1000 | default: 1001 | require_once( $this->plugin_dir . "page-main.php" ); 1002 | break; 1003 | } 1004 | } 1005 | 1006 | 1007 | /** 1008 | * Get user data 1009 | **/ 1010 | private function _get_user_data( $user_id ) { 1011 | global $wpdb; 1012 | 1013 | $data = get_userdata( $user_id ); 1014 | 1015 | if ( !empty( $data->data ) ) 1016 | $user_data = (array) $data->data; 1017 | else 1018 | $user_data = (array) $data; 1019 | 1020 | $user_meta = get_user_meta( $user_id ); 1021 | 1022 | $keys = array(); 1023 | // replace empty array on empty string 1024 | foreach ( $user_meta as $key => $value ) { 1025 | $keys[] = $key; 1026 | } 1027 | 1028 | foreach ( $keys as $key ) { 1029 | $user_meta[$key] = get_user_meta( $user_id, $key, true ); 1030 | } 1031 | 1032 | $prefix_fix = array('capabilities', 'user_level'); 1033 | foreach ($prefix_fix as $key) { 1034 | if(isset($user_meta[$wpdb->get_blog_prefix() . $key])) { 1035 | $user_meta['wp_' . $key] = $user_meta[$wpdb->get_blog_prefix() . $key]; 1036 | if($wpdb->get_blog_prefix() != 'wp_') 1037 | unset($user_meta[$wpdb->get_blog_prefix() . $key]); 1038 | } 1039 | } 1040 | 1041 | return array_merge( $user_data, $user_meta ); 1042 | } 1043 | 1044 | 1045 | function bp_users_activate($signup_ids, $result) { 1046 | var_dump($signup_ids, $result); 1047 | die(); 1048 | } 1049 | 1050 | /** 1051 | * Adds the Privacy Policy Suggested Text 1052 | * 1053 | * @uses function_exists 1054 | * @uses ob_start 1055 | * @uses ob_get_clean 1056 | * @uses wp_add_privacy_policy_content 1057 | */ 1058 | public function privacy_policy_suggested_text() { 1059 | if ( function_exists( 'wp_add_privacy_policy_content' ) ) { 1060 | ob_start(); 1061 | include dirname( __FILE__ ) . '/policy-text.php'; 1062 | $content = ob_get_clean(); 1063 | if ( ! empty( $content ) ) { 1064 | wp_add_privacy_policy_content( __( 'User Synchronization', 'user-sync' ), $content ); 1065 | } 1066 | } 1067 | } 1068 | } 1069 | 1070 | $user_sync = new User_Sync(); --------------------------------------------------------------------------------