latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Can I suppress single Java Script prompt?

Home Forums Community Forum Can I suppress single Java Script prompt?

This topic contains 6 replies, has 4 voices. Last updated by  Raam Dev 4 years, 5 months ago.

Topic Author Topic
Posted: Saturday Jul 7th, 2012 at 2:28 am #18513
John Potter
Username: johnp

I have tried unsuccessfully to alter the output of the javascript prompt that says:

You`re entitled to UNLIMITED downloads though ( so, no worries ).

I see how to suppress all java-script prompts.

Is there a way of just stopping this one, which I realize serves no useful purpose anyway?

  • This topic was modified 4 years, 6 months ago by  John Potter.

List Of Topic Replies

Viewing 6 replies - 1 through 6 (of 6 total)
Author Replies
Author Replies
Posted: Saturday Jul 7th, 2012 at 7:08 am #18546

Hi John.

You can try using the [hilite mono]skip_confirmation[/hilite] var in your URL, or attribute in your shortcode for the file. [hilite path]Dashboard -› s2Member® -› Download Options -› Shortcode Attributes -> skip_confirmation[/hilite]

I hope it helps. :)

Posted: Saturday Jul 7th, 2012 at 7:19 am #18548
Raam Dev
Username: Raam
Staff Member

Hi John,

I updated the original post with the location of the text you were trying to modify.

If you want to disable file download confirmations altogether, you can add this to your wp-content/mu-plugins/s2-hacks.php file:

<?php
add_action ("ws_plugin__s2member_before_sc_get_file","s2file_skip_confirmation_by_default");
function s2file_skip_confirmation_by_default($vars){
	if (!array_key_exists("skip_confirmation",$vars&#91;"attr"&#93;)) $vars&#91;"attr"&#93;&#91;"skip_confirmation"&#93;="yes";
}
?>
Posted: Sunday Jul 8th, 2012 at 7:28 pm #18630
John Potter
Username: johnp

Hi Raam

My s2-hacks.php file with the code above does not stop the pop-up.

However I have followed the advice in a post by Jason and this does indeed disable all JavaScript confirmations.

<script type="text/javascript">
	var ws_plugin__s2member_skip_all_file_confirmations = true;
</script>

If anyone finds a way of stopping or altering this single, redundant message without loosing the entire file-counting feature, I’d be much appreciated.

Posted: Monday Jul 9th, 2012 at 8:24 pm #18731
Staff Member

You can accomplish it like this:

<script type="text/javascript">
	if(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)
		var ws_plugin__s2member_skip_all_file_confirmations = true;
</script>

Just be sure that s2Member’s JavaScript has already loaded before this is added to the <head></head> section. That way S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED is already populated, and you can read from that variable, as seen in the code sample above.

Posted: Sunday Jul 15th, 2012 at 5:46 pm #19312
John Potter
Username: johnp

Thank you for this Jason. I actually figured out a similar solution on my own, and came back here to document it:

<?php if (current_user_can("access_s2member_level2")){ ?>
		<script type="text/javascript">
			var ws_plugin__s2member_skip_all_file_confirmations = true;
		</script>
<?php } ?>
Posted: Tuesday Jul 17th, 2012 at 3:49 am #19443
Raam Dev
Username: Raam
Staff Member

Thank you very much for sharing your solution, John! :)

~Awarded John Potter the Helpful badge.
Viewing 6 replies - 1 through 6 (of 6 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.