| @@ -74,8 +74,24 @@ | ||
| 74 | 74 | Example: <code>index price contact.php blog/</code> |
| 75 | 75 | </p> |
| 76 | 76 | </td> |
| 77 | 77 | </tr> |
| 78 | + | |
| 79 | + <tr> | |
| 80 | + <th scope="row"> | |
| 81 | + <label for="logged-only">Signed-in Users Only</label> | |
| 82 | + </th> | |
| 83 | + <td> | |
| 84 | + <label> | |
| 85 | + <input id="logged-only" name="logged-only" type="checkbox" value="1" | |
| 86 | + <?php checked(get_option('onwebchat_plugin_option_logged_only', 0), 1); ?> /> | |
| 87 | + Show the chat widget only to signed-in (logged-in) users | |
| 88 | + </label> | |
| 89 | + <p class="description"> | |
| 90 | + When enabled, visitors who are not logged in to your website will not see the chat widget at all. | |
| 91 | + </p> | |
| 92 | + </td> | |
| 93 | + </tr> | |
| 78 | 94 | </table> |
| 79 | 95 | |
| 80 | 96 | <p class="submit"> |
| 81 | 97 | <input type="submit" class="button button-primary" value="Save Chat Settings"> |
| @@ -126,10 +142,12 @@ | ||
| 126 | 142 | |
| 127 | 143 | $pagesSelect = isset($_POST["pages-select"]) ? absint($_POST["pages-select"]) : 1; |
| 128 | 144 | $showOnPages = isset($_POST["showonpages"]) ? sanitize_text_field($_POST["showonpages"]) : ''; |
| 129 | 145 | $hideOnPages = isset($_POST["hideonpages"]) ? sanitize_text_field($_POST["hideonpages"]) : ''; |
| 130 | - | |
| 146 | + $loggedOnly = isset($_POST["logged-only"]) ? 1 : 0; // unchecked checkboxes are not posted (default: off) | |
| 147 | + | |
| 131 | 148 | update_option('onwebchat_plugin_option_pages_select', $pagesSelect); |
| 149 | + update_option('onwebchat_plugin_option_logged_only', $loggedOnly); | |
| 132 | 150 | |
| 133 | 151 | if ($pagesSelect == 2) { |
| 134 | 152 | update_option('onwebchat_plugin_option_show_pages', $showOnPages); |
| 135 | 153 | } else if ($pagesSelect == 3) { |