-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathpage-sub.php
145 lines (127 loc) · 7.96 KB
/
page-sub.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
$user_sync_key = $this->options['key'];
$user_sync_url_c = $this->options['central_url'];
$disabled = '';
if ( "" != $user_sync_url_c )
$disabled = 'readonly="readonly"';
?>
<script type="text/javascript">
jQuery( document ).ready( function() {
jQuery( "#user_sync_form" ).submit( function () {
if ( "" == jQuery( "#user_sync_url_c" ).val() && "uninstall" != jQuery( "#usync_action" ).val( ) ) {
alert( "<?php _e( 'Please write URL of Central blog', 'user-sync' ) ?>" );
return false;
}
if ( "" == jQuery( "#user_sync_key" ).val() && "uninstall" != jQuery( "#usync_action" ).val( ) ) {
alert( "<?php _e( 'Please write Key of Central blog', 'user-sync' ) ?>" );
return false;
}
return true;
});
jQuery(".tooltip_img[title]").tooltip();
//uninstall plugin options
jQuery( "#uninstall_yes" ).click( function() {
jQuery( "#usync_action" ).val( "uninstall" );
jQuery( "#user_sync_form" ).submit();
return false;
});
jQuery( "#uninstall" ).click( function() {
jQuery( "#uninstall_confirm" ).show( );
return false;
});
jQuery( "#uninstall_no" ).click( function() {
jQuery( "#uninstall_confirm" ).hide( );
return false;
});
});
</script>
<div class="wrap">
<?php
//Debug mode
if ( isset( $this->options['debug_mode'] ) && '1' == $this->options['debug_mode'] ):?>
<div class="updated fade"><p><?php _e( 'Debug Mode is activated.', 'user-sync' ); ?></p></div>
<?php endif; ?>
<h2><?php _e( 'Subsite Settings', 'user-sync' ) ?></h2>
<h3><?php _e( 'All user data from the Master site will be synchronized with this site.', 'user-sync' ) ?></h3>
<form method="post" action="" id="user_sync_form">
<table class="form-table">
<tr valign="top">
<th scope="row">
<?php _e( 'URL of Master site:', 'user-sync' ) ?>
</th>
<td>
<input type="text" name="user_sync_url_c" id="user_sync_url_c" value="<?php echo $user_sync_url_c; ?>" size="50" <?php echo $disabled; ?> />
</td>
</tr>
<tr valign="top">
<th scope="row">
<?php _e( 'Key of Master site:', 'user-sync' ) ?>
</th>
<td>
<input type="text" name="user_sync_key" id="user_sync_key" value="<?php echo $user_sync_key; ?>" size="50" <?php echo $disabled; ?> />
</td>
</tr>
<?php if ( "" == $disabled ) {?>
<tr valign="top">
<th scope="row">
<?php _e( 'Default settings:', 'user-sync' ) ?>
</th>
<td>
<span class="description">
<?php _e( 'You can change these settings later on the Master site.', 'user-sync' ) ?>
</span>
<br />
<label>
<input type="checkbox" name="replace_user" value="1" />
<?php _e( 'Do not replace deleted users', 'user-sync' ) ?>
</label>
<br />
<label>
<input type="checkbox" name="overwrite_user" value="1" />
<?php _e( 'Don\'t overwrite any existing users (add them as extra users)', 'user-sync' ) ?>
</label>
</td>
</tr>
<?php } ?>
</table>
<?php if ( "" == $disabled ) {?>
<p><?php _e( "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.", 'user-sync' ) ?></p>
<?php }?>
<?php if ( "" == $disabled ) {?>
<?php
//safe mode notice
if ( isset( $this->safe_mode_notice ) ):?>
<span style="color: red;" ><?php _e( 'Attention: Safe Mode!', 'user-sync' ); ?></span>
<img class="tooltip_img" src="<?php echo $this->plugin_url . "images/"; ?>info_small.png" title="<?php echo $this->safe_mode_notice; ?>"/>
<br />
<?php endif; ?>
<p class="submit">
<input type="hidden" name="usync_action" id="usync_action" value="sub_site" />
<input type="submit" class="button" value="<?php _e( 'Connect this site to the Master site, and do a FULL synchronization', 'user-sync' ) ?>" />
</p>
<?php } else {?>
<p class="submit">
<input type="hidden" name="usync_action" id="usync_action" value="remove_settings" />
<input type="submit" class="button button-secondary" value="<?php _e( 'Disconnect from the Master site', 'user-sync' ) ?>" />
<span class="description"><?php _e( 'Disconnect syncing with Master site', 'email-newsletter' ) ?></span>
</p>
<?php } ?>
<div class="submit">
<input type="button" class="button" id="uninstall" style="color: red;" value="<?php _e( 'Uninstall Options', 'user-sync' ) ?>" />
<span class="description"><?php _e( "Delete all plugin's options from DB.", 'email-newsletter' ) ?></span>
<div id="uninstall_confirm" style="display: none;">
<p>
<span class="description"><?php _e( 'Are you sure?', 'email-newsletter' ) ?></span>
</p>
<p>
<input type="button" class="button" name="uninstall" id="uninstall_no" value="<?php _e( 'No', 'email-newsletter' ) ?>" />
<input type="button" class="button" name="uninstall" id="uninstall_yes" value="<?php _e( 'Yes', 'email-newsletter' ) ?>" />
</p>
</div>
</div>
<p>
<?php _e( "For detailed 'how to use' instructions refer to:", 'user-sync' ) ?><br />
<a href="http://premium.wpmudev.org/project/wordpress-user-synchronization/installation/" target="_blank" ><?php _e( 'WordPress User Synchronization Installation and Use instructions.', 'user-sync' ) ?></a>
</p>
</form>
</div>