| 1 |
<?php echo logtivity_view('_admin-header', compact('options')); ?> |
| 2 |
|
| 3 |
<div class="postbox logtivity-settings"> |
| 4 |
<?php if (logtivity_has_site_url_changed()): ?> |
| 5 |
<div style="background: #DC3232;color: #fff;padding: 1em"> |
| 6 |
<h2 style="color: white; padding-left: 0" class="title">We've detected a change in your site URL.</h2> |
| 7 |
<p>Is this a dev or staging environment? As a precaution, we've stopped logging. To start recording logs, again click the 'Update Settings' button below.</p> |
| 8 |
</div> |
| 9 |
<?php endif ?> |
| 10 |
|
| 11 |
<div class="inside"> |
| 12 |
<h1 style="padding-top: 20px;">Settings</h1> |
| 13 |
|
| 14 |
<form action="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=logtivity_update_settings" method="post"> |
| 15 |
|
| 16 |
<?php wp_nonce_field( 'logtivity_update_settings', 'logtivity_update_settings' ) ?> |
| 17 |
|
| 18 |
<table class="form-table"> |
| 19 |
<tbody> |
| 20 |
<tr class="user-user-login-wrap"> |
| 21 |
<th> |
| 22 |
<label for="logtivity_site_api_key">Site API Key</label> |
| 23 |
<?php if (has_filter('logtivity_site_api_key')): ?> |
| 24 |
<div class="logtivity-constant">This option has been set in code.</div> |
| 25 |
<?php endif ?> |
| 26 |
</th> |
| 27 |
<td> |
| 28 |
<input <?php echo ( has_filter('logtivity_site_api_key') ? 'readonly' : ''); ?> type="text" name="logtivity_site_api_key" id="logtivity_site_api_key" value="<?php echo sanitize_text_field($options['logtivity_site_api_key']); ?>" class="regular-text"> |
| 29 |
<?php if ($options['logtivity_api_key_check']): ?> |
| 30 |
<p>Status: <?php echo ( sanitize_text_field($options['logtivity_api_key_check']) != 'fail' ? '<span style="color: #4caf50; font-weight: bold;">Connected</span>' : '<span style="color: #ff3232; font-weight: bold;">Not connected. Please check API key.</span>'); ?></p> |
| 31 |
<?php endif ?> |
| 32 |
</td> |
| 33 |
<td> |
| 34 |
<span class="description">You can find this value by logging into your account and navigating to/creating this site settings page.</span> |
| 35 |
</td> |
| 36 |
</tr> |
| 37 |
<tr class="user-user-login-wrap"> |
| 38 |
<th> |
| 39 |
<label for="logtivity_disable_default_logging">Disable built in Event Logging.</label> |
| 40 |
<?php if (has_filter('logtivity_disable_default_logging')): ?> |
| 41 |
<div class="logtivity-constant">This option has been set in code.</div> |
| 42 |
<?php endif ?> |
| 43 |
</th> |
| 44 |
<td> |
| 45 |
<input type="hidden" name="logtivity_disable_default_logging" id="logtivity_disable_default_logging" value="0"> |
| 46 |
|
| 47 |
<input <?php echo ( has_filter('logtivity_disable_default_logging') ? 'readonly' : ''); ?> type="checkbox" name="logtivity_disable_default_logging" id="logtivity_disable_default_logging" value="1" class="regular-checkbox" <?php echo ( absint($options['logtivity_disable_default_logging']) ? 'checked' : ''); ?>> |
| 48 |
</td> |
| 49 |
<td> |
| 50 |
<span class="description">Check this box if you do not want the plugin to log actions automatically and you would prefer to manually log specific actions with code.</span> |
| 51 |
</td> |
| 52 |
</tr> |
| 53 |
<tr class="user-user-login-wrap"> |
| 54 |
<th> |
| 55 |
<label for="logtivity_should_store_user_id">Store User ID</label> |
| 56 |
<?php if (has_filter('logtivity_should_store_user_id')): ?> |
| 57 |
<div class="logtivity-constant">This option has been set in code.</div> |
| 58 |
<?php endif ?> |
| 59 |
</th> |
| 60 |
<td> |
| 61 |
<input type="hidden" name="logtivity_should_store_user_id" id="logtivity_should_store_user_id" value="0"> |
| 62 |
|
| 63 |
<input <?php echo ( has_filter('logtivity_should_store_user_id') ? 'readonly' : ''); ?> type="checkbox" name="logtivity_should_store_user_id" id="logtivity_should_store_user_id" value="1" class="regular-checkbox" <?php echo ( absint($options['logtivity_should_store_user_id']) ? 'checked' : ''); ?>> |
| 64 |
</td> |
| 65 |
<td> |
| 66 |
<span class="description">If you check this box, when logging an action, we will include the users User ID in the logged action.</span> |
| 67 |
</td> |
| 68 |
</tr> |
| 69 |
<tr class="user-user-login-wrap"> |
| 70 |
<th> |
| 71 |
<label for="logtivity_should_log_profile_link">Store Users Profile Link</label> |
| 72 |
<?php if (has_filter('logtivity_should_log_profile_link')): ?> |
| 73 |
<div class="logtivity-constant">This option has been set in code.</div> |
| 74 |
<?php endif ?> |
| 75 |
</th> |
| 76 |
<td> |
| 77 |
<input type="hidden" name="logtivity_should_log_profile_link" id="logtivity_should_log_profile_link" value="0"> |
| 78 |
|
| 79 |
<input <?php echo ( has_filter('logtivity_should_log_profile_link') ? 'readonly' : ''); ?> type="checkbox" name="logtivity_should_log_profile_link" id="logtivity_should_log_profile_link" value="1" class="regular-checkbox" <?php echo ( absint($options['logtivity_should_log_profile_link']) ? 'checked' : ''); ?>> |
| 80 |
</td> |
| 81 |
<td> |
| 82 |
<span class="description">If you check this box, when logging an action, we will include the users profile link in the logged action.</span> |
| 83 |
</td> |
| 84 |
</tr> |
| 85 |
<tr class="user-user-login-wrap"> |
| 86 |
<th> |
| 87 |
<label for="logtivity_should_log_username">Store Users Username</label> |
| 88 |
<?php if (has_filter('logtivity_should_log_username')): ?> |
| 89 |
<div class="logtivity-constant">This option has been set in code.</div> |
| 90 |
<?php endif ?> |
| 91 |
</th> |
| 92 |
<td> |
| 93 |
<input type="hidden" name="logtivity_should_log_username" id="logtivity_should_log_username" value="0"> |
| 94 |
|
| 95 |
<input <?php echo ( has_filter('logtivity_should_log_username') ? 'readonly' : ''); ?> type="checkbox" name="logtivity_should_log_username" id="logtivity_should_log_username" value="1" class="regular-checkbox" <?php echo ( absint($options['logtivity_should_log_username']) ? 'checked' : ''); ?>> |
| 96 |
</td> |
| 97 |
<td> |
| 98 |
<span class="description">If you check this box, when logging an action, we will include the users username in the logged action.</span> |
| 99 |
</td> |
| 100 |
</tr> |
| 101 |
<tr class="user-user-login-wrap"> |
| 102 |
<th> |
| 103 |
<label for="logtivity_should_store_ip">Store Users IP Address</label> |
| 104 |
<?php if (has_filter('logtivity_should_store_ip')): ?> |
| 105 |
<div class="logtivity-constant">This option has been set in code.</div> |
| 106 |
<?php endif ?> |
| 107 |
</th> |
| 108 |
<td> |
| 109 |
<input type="hidden" name="logtivity_should_store_ip" id="logtivity_should_store_ip" value="0"> |
| 110 |
|
| 111 |
<input <?php echo ( has_filter('logtivity_should_store_ip') ? 'readonly' : ''); ?> type="checkbox" name="logtivity_should_store_ip" id="logtivity_should_store_ip" value="1" class="regular-checkbox" <?php echo ( absint($options['logtivity_should_store_ip']) ? 'checked' : ''); ?>> |
| 112 |
</td> |
| 113 |
<td> |
| 114 |
<span class="description">If you check this box, when logging an action, we will include the users IP address in the logged action.</span> |
| 115 |
</td> |
| 116 |
</tr> |
| 117 |
<tr class="user-user-login-wrap"> |
| 118 |
<th> |
| 119 |
<label for="logtivity_enable_debug_mode">Enable debug mode (recommended off by default)</label> |
| 120 |
<?php if (has_filter('logtivity_enable_debug_mode')): ?> |
| 121 |
<div class="logtivity-constant">This option has been set in code.</div> |
| 122 |
<?php endif ?> |
| 123 |
</th> |
| 124 |
<td> |
| 125 |
<input type="hidden" name="logtivity_enable_debug_mode" id="logtivity_enable_debug_mode" value="0"> |
| 126 |
|
| 127 |
<input <?php echo ( has_filter('logtivity_enable_debug_mode') ? 'readonly' : ''); ?> type="checkbox" name="logtivity_enable_debug_mode" id="logtivity_enable_debug_mode" value="1" class="regular-checkbox" <?php echo ( absint($options['logtivity_enable_debug_mode']) ? 'checked' : ''); ?>> |
| 128 |
</td> |
| 129 |
<td> |
| 130 |
<span class="description">This will log the latest response from the API. This can be useful for debugging the result from an API call when storing a log. We <strong>recommend setting this to off by default</strong> as this will allow us to send logs asynchronously and not wait for a response from the API. This will be more performant.</span> |
| 131 |
</td> |
| 132 |
</tr> |
| 133 |
<tr class="user-user-login-wrap"> |
| 134 |
<th> |
| 135 |
<label for="logtivity_disable_individual_logs">Disable Individual Logs</label> |
| 136 |
<?php if (has_filter('logtivity_disable_individual_logs')): ?> |
| 137 |
<div class="logtivity-constant">This option has been set in code.</div> |
| 138 |
<?php endif ?> |
| 139 |
</th> |
| 140 |
<td> |
| 141 |
<textarea style="width: 100%;" rows="10" <?php echo ( has_filter('logtivity_disable_individual_logs') ? 'readonly' : ''); ?> name="logtivity_disable_individual_logs" id="logtivity_disable_individual_logs" class="regular-checkbox" placeholder="User Logged In User Created && subscriber"><?php echo esc_html($options['logtivity_disable_individual_logs']); ?></textarea> |
| 142 |
</td> |
| 143 |
<td> |
| 144 |
<span class="description"> |
| 145 |
You can disable individual logged actions here by listing the action names, one per line. |
| 146 |
|
| 147 |
<br> <br> |
| 148 |
|
| 149 |
To specify the context field as well, separate the action and context keywords with an && symbol. |
| 150 |
|
| 151 |
<br><br> |
| 152 |
|
| 153 |
<?php if (!isset($options['logtivity_enable_white_label_mode']) || $options['logtivity_enable_white_label_mode'] != '1'): ?> |
| 154 |
If you have multiple sites on Logtivity and would rather control disabled logs globally you can go to the <a target="_blank" rel="nofollow" href="https://app.logtivity.io/team-settings/global-plugin-settings">Global Plugin settings page</a> inside your Logtivity dashboard. |
| 155 |
<?php endif; ?> |
| 156 |
</span> |
| 157 |
</td> |
| 158 |
</tr> |
| 159 |
</tbody> |
| 160 |
</table> |
| 161 |
|
| 162 |
<p class="submit"> |
| 163 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="Update Settings"> |
| 164 |
</p> |
| 165 |
|
| 166 |
</form> |
| 167 |
|
| 168 |
</div> |
| 169 |
</div> |
| 170 |
|
| 171 |
<?php if (absint( $options['logtivity_enable_debug_mode'] )): ?> |
| 172 |
|
| 173 |
<div class="postbox"> |
| 174 |
<div class="inside"> |
| 175 |
|
| 176 |
<h3>Latest Response</h3> |
| 177 |
|
| 178 |
<?php if ($latest_response = $options['logtivity_latest_response']): ?> |
| 179 |
|
| 180 |
<h4>Date: <?php echo sanitize_text_field($latest_response['date']); ?></h4> |
| 181 |
|
| 182 |
<?php if ($latest_response['response']): ?> |
| 183 |
<code style="display: block; padding: 20px;"> |
| 184 |
|
| 185 |
<?php echo sanitize_text_field($latest_response['response']); ?> |
| 186 |
|
| 187 |
</code> |
| 188 |
<?php endif ?> |
| 189 |
|
| 190 |
<?php else: ?> |
| 191 |
|
| 192 |
<p>The latest logging response will appear here after an event has been logged.</p> |
| 193 |
|
| 194 |
<?php endif ?> |
| 195 |
|
| 196 |
</div> |
| 197 |
</div> |
| 198 |
|
| 199 |
<?php endif ?> |
| 200 |
|
| 201 |
<?php echo logtivity_view('_admin-footer', compact('options')); ?> |