doc/developer/Patches

DISCLAIMER: These are non supported patches. They are not complicated, but make sure you make a backup copy of the file you're modifying. These patches are not meant to be elegant, are not supported, and should be only applied by programmers that can bring the right changes to the patch (if any needed) depending on the discrepancies they notice. Use these patches at your own risk.

Patch 1: Remove node owner access to left column

Description: Not allowing node owners to use left column for adding content.

Screenshot: : See below, file patch.gauche.PNG

Done on wifidog version 1226 by Wad (wmaalouf at fqccl dot org)
The use of this patch is to reserve the left content column of every portal to the network administrator (admin)

In function:

GenerateFromTable (in file Classes/FormSelectGenerator?.php)

Replace the line:

$db->execSql("SELECT $primaryKeyField, $displayField FROM $table", $results, false);

With:

	$usr = User :: getCurrentUser();
	if ($displayField == 'display_area' && $usr->getUsername() != 'admin'){
		$db->execSql("SELECT $primaryKeyField,  $displayField FROM $table WHERE display_area <> 'left_area_middle' and display_area <> 'left_area_top' and display_area <> 'left_area_bottom'", $results, false);
	}else{
		$db->execSql("SELECT $primaryKeyField,  $displayField FROM $table", $results, false);
	}


Patch 2: Send validation e-mail copy to someone

Description: Send a copy of the validation e-mail new users get to an admin, or someone else.

Screenshot: : See below, file validation.copy.PNG

Done on wifidog version 1226 by Wad (wmaalouf at fqccl dot org)
The reason why I didn't implement that in the official version is because of the overhead I had to go through, and the importance of the feature didn't convince me. Also, the patch is very easy to add.

REQUIRED CUSTOMIZATION TO PATCH:

  • Who to send the copy to? ($copyEmail variable)
  • The subject of the copy e-mail ($copySubject variable)

In function:

sendValidationEmail() (in file Classes/User?.php)

After:

$mail->send();

Add:

	//send copy to admin
	$copyEmail = "";
	$copySubject = "Nouvel utilisateur";
	$mail2 = new Mail();
	$mail2->setSenderName(_("Registration system"));
	$mail2->setSenderEmail($network->getValidationEmailFromAddress());
	$mail2->setRecipientEmail($copyEmail);
	$mail2->setMessageSubject(_($copySubject));
	$url = BASE_SSL_PATH . "validate.php?user_id=" . $this->getId() . "&token=" . $this->getValidationToken();
	$message = "Vous recevez ce message parce que l'utilisateur ".$this->getUserName() ." s'est enregistre ou a fait une demande d'envoi de son courriel de validation.\n\n";
	$mail2->setMessageBody(_($message . "Nom: " . $this->getUserName()) . "\nCourriel: " . $this->getEmail() .  "\nLien de validation: " . $url .  _("\n"));
	$mail2->send();

Attachments