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.

About: antoine Lavallade

Sorry, I've not written a description yet. I'll get to it soon!


Topics I'm Subscribed To

Viewing topic 1 (of 1 total)
Topic Count Last Reply
add a algorithm in custom field

By:  antoine Lavallade in: Community Forum

voices: 2
replies: 8

3 years, 10 months ago  Eduan

Viewing topic 1 (of 1 total)

Topics I've Started

Viewing topic 1 (of 1 total)
Topic Count Last Reply
add a algorithm in custom field

By:  antoine Lavallade in: Community Forum

voices: 2
replies: 8

3 years, 10 months ago  Eduan

Viewing topic 1 (of 1 total)

My Latest Replies (From Various Topics)

Viewing 5 replies - 1 through 5 (of 5 total)
Author Replies
Author Replies
Posted: Monday Feb 18th, 2013 at 11:29 am #42276

After several tests I realized my mistake came from my :

$_field = &$vars[$__refs][$field];

who did not take the $ declaration of my table entries.
I continued my research hoping to find soon

Posted: Monday Feb 18th, 2013 at 10:39 am #42271

thank you for your response Eduan I’ll head to the sites proposed and continue to fiddle my code (I’m fine finish not find)

Posted: Monday Feb 18th, 2013 at 8:47 am #42250

Hello
I’m still on the same problem and I have the impression that the file-s2 hacks.php does not take into account the conditions.
I created a log file to see if the page took proper account of the actions I was doing and after several changes the page doesn’t take into account the conditions.

<?php

	add_action("ws_plugin__s2member_during_custom_registration_fields_after_custom_fields", "my_dynamic_field_options");
	add_filter("ws_plugin__s2member_during_ms_custom_registration_fields_during_custom_fields_display", "my_dynamic_field_options2");

	function my_dynamic_field_options($vars = Array()){
		$_field = &$vars[$__refs][$field];
		
		if($_field["id"] === "country_code"){
			$_field["options"] = "US|United States|default" . "\n";
			$_field["options"] = "CA|canada" . "\n";
			$_field["options"] = "VI|Virgin Islands (U.S.)";
			
			$monfichier = fopen('compteur.txt', 'r+');
			$pages_vues = fgets($monfichier); // On lit la première ligne (nombre de pages vues)
			fseek($monfichier, 0); // On remet le curseur au début du fichier
			$pages_vues++; // On augmente de 1 ce nombre de pages vues
			fputs($monfichier, $pages_vues); // On écrit le nouveau nombre de pages vues
			fclose($monfichier);
		}
		
		
		/*$_field = &$vars[$__refs][$field];
		if($_field["type"] === "text"){
			$monfichier = fopen('compteur.txt', 'r+');
			$pages_vues = fgets($monfichier); // On lit la première ligne (nombre de pages vues)
			fseek($monfichier, 0); // On remet le curseur au début du fichier
			$pages_vues++; // On augmente de 1 ce nombre de pages vues
			fputs($monfichier, $pages_vues); // On écrit le nouveau nombre de pages vues
			fclose($monfichier);
		}*/
		
	}
?>

Help me please

Posted: Friday Jan 25th, 2013 at 3:14 am #39486

Hi Eduan,

Thank you for your answer, I know what I’m asking is to be custom made, I must create the file via code-s2 hacks.php him even located in the mu-plugins. I’ve also seen videos explaining how jason insert the code, I did a test with the same example as him but I think my code is not called.

Here is the code in my file-s2 hacks.php

<?php

add_action("ws_plugin__s2member_before_custom_field_gen", "my_dynamic_field_options");
function my_dynamic_field_options($vars = array())
	{
		$_field = &$vars[$__refs][$_field];
		
		if ($_field["id"] === "country_code")
		{
			$_field["options"] = "US|United States|default" . "\n";
			$_field["options"] .= "CA|canada" . "\n";
			$_field["options"] .= "VI|Virgin Islands (U.S.)";
		}
	}
?>
Posted: Wednesday Jan 23rd, 2013 at 3:06 am #39125

Up please

Viewing 5 replies - 1 through 5 (of 5 total)

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.