Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recaptcha javascript being included inline in html - also whether there is a login form or not #71

Open
gekidoslair opened this issue Aug 8, 2016 · 1 comment

Comments

@gekidoslair
Copy link

have this setup on a site, and there are a few issues with the javascript usage:

  1. it's being included on every page whether there is a login form on the page or not.

  2. the javascript is just being dumped into the html of the page instead of being included as a separate .js file - is there a reason for this?

Thanx - awesome plugin!

@patschi
Copy link

patschi commented Dec 2, 2016

Regarding your first point it would be possible to just return "true" when calling "is_required()" if the current page is either the login or register page. When it is enabled on the comment form, it could be displayed on nearly every page.

I'm currently using my following modified code in https://github.com/mcguffin/wp-recaptcha-integration/blob/654c39efeae56b7f8b2299d712f3c4f0b8e8db94/inc/class-wp_recaptcha.php#L217-L220:

function is_required() {
	$is_required = ! ( $this->get_option('recaptcha_disable_for_known_users') && is_user_logged_in() );
	if ( $is_required && ! $this->get_option('recaptcha_enable_comments') ) {
		if ( ! in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) ) ) {
			$is_required = false;
		}
	}
	return apply_filters( 'wp_recaptcha_required' , $is_required );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants