Skip to content

Instantly share code, notes, and snippets.

@DreamerKlim
Created September 27, 2017 14:44
Show Gist options
  • Save DreamerKlim/0bd8cefd5ae596a6c29edd37dc5ec283 to your computer and use it in GitHub Desktop.
Save DreamerKlim/0bd8cefd5ae596a6c29edd37dc5ec283 to your computer and use it in GitHub Desktop.
/*** Чек бокс politika pupi-boy.ru ****/
// заменить стили (style="color: #555;" и style="width:auto;margin:13px;") на свои
// замениить ссылку (https://pupi-boy.ru/politica.html) на свою
add_action('comment_form', 'politika');
add_action('comment_post', 'proverka_politika');
function politika($id) {
if (!is_user_logged_in()) :
print '<p style="color: #555;"><input style="width:auto;margin:13px;" type="checkbox" name="bad_post" value="1" checked /> Согласен с <a href="https://pupi-boy.ru/politica.html">политикой конфиденциальности</a> *</p>';
endif;
}
function proverka_politika($id) {
if (!is_user_logged_in()) :
if (!$_POST['bad_post']) :
$updated_status = 'trash';
wp_set_comment_status($id, $updated_status);
wp_die('Вы не согласились с политикой конфиденциальности. Вернитесь назад. Мне тоже это не нравится ... :/');
endif;
endif;
}
/*** Чек бокс politika pupi-boy.ru****/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment