Disable wordpress openid client

Sometimes, you need to disable user registration on your blog, for example, if you use wp-invites and registered-users-only-2 plugins. Wordpress allows you to disable user registration on blog, but openid plugin hacks through (when users leave comments with openid) it and adds new users. If you want to disable it, you can just disable openid client side (you will still be able to use wordpress blog as openid server, but users’s comments with openid wil be processed as simple comments). Mini plugin to disable openid plugin client side is in the bottom of the post. By the way, you can just remove file “coments.php” and calls to this file, but you’ll have to do it again with every update.


Иногда вам требуется отключить регистрацию пользователей на своём блоге, например, если вы используете [плагины wp-invites и registered-users-only-2](https://jehy.ru/articles/2009/02/09/wordpress-plugins). Wordpress разрешает отключить регистрацию новых пользователей, но [openid плагин](http://wordpress.org/extend/plugins/openid/) при комментировании постов проходит сквозь эту защиту и всё равно создаёт пользователей. Если вы хотите избежать этого, вы можете просто отключить клиентскую сторону плагина openid (вы сможете использовать ваш блог как openid сервер, но комментарии с openid будут обрабатываться как обычные). Мини плагин, который поможет это сделать, внизу поста. Кстати, можно просто удалить файл "comments.php" и его включения, но это придётся повторять каждый раз при обновлении плагина.
add_action(‘init’,’remove_openid_client’,99);
function remove_openid_client()
{
  remove_action( ‘preprocess_comment’, ‘openid_process_comment’, -90);
  add_action(‘preprocess_comment’, ‘akismet_auto_check_comment’, 1);
  remove_action( ‘akismet_spam_caught’, ‘openid_akismet_spam_caught’);
  remove_action( ‘comment_post’, ‘update_comment_openid’, 5 );
  remove_filter( ‘option_require_name_email’, ‘openid_option_require_name_email’ );
  remove_action( ‘sanitize_comment_cookies’, ‘openid_sanitize_comment_cookies’, 15);
  remove_action( ‘openid_finish_auth’, ‘openid_finish_comment’, 10, 2 );
  remove_filter(‘pre_comment_approved’, ‘openid_comment_approval’);
  remove_filter( ‘get_comment_author_link’, ‘openid_comment_author_link’);
  remove_action( ‘wp_head’, ‘openid_js_setup’, 9);
  remove_action( ‘wp_footer’, ‘openid_comment_profilelink’, 10);
  remove_action( ‘wp_footer’, ‘openid_comment_form’, 10);
  remove_filter( ‘openid_user_data’, ‘openid_get_user_data_form’, 6, 2);
  remove_action( ‘delete_comment’, ‘unset_comment_openid’ );
  remove_action( ‘init’, ‘openid_recent_comments’);
}
?>