[evolvis-commits] r16168: Taken from Evolvis: forge admins can now create users and immediately activate them ( without a confirmation email)

mirabilos at evolvis.org mirabilos at evolvis.org
Tue Mar 1 01:01:01 CET 2011


Author: mirabilos
Date: 2011-03-01 01:01:01 +0100 (Tue, 01 Mar 2011)
New Revision: 16168

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/www/account/register.php
Log:
Taken from Evolvis: forge admins can now create users and immediately activate them (without a confirmation email)

Modified: trunk/gforge_base/evolvisforge-5.1/src/www/account/register.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/account/register.php	2011-03-01 00:00:58 UTC (rev 16167)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/account/register.php	2011-03-01 00:01:01 UTC (rev 16168)
@@ -74,16 +74,46 @@
 	if ($GLOBALS['sys_require_accept_conditions'] && ! $accept_conditions) {
 		$warning_msg = _("You can't register an account unless you accept the terms of use.") ;
 	} else {
+		$activate_immediately = getIntFromRequest('activate_immediately');
+		if (($activate_immediately == 1) &&
+		    forge_check_global_perm ('forge_admin')) {
+			$send_mail = false;
+			$activate_immediately = true;
+		} else {
+			$send_mail = true;
+			$activate_immediately = false;
+		}
+		
 		$new_user = new GFUser();
 		$register = $new_user->create($unix_name,$firstname,$lastname,$password1,$password2,
 					      $email,$mail_site,$mail_va,$language_id,$timezone,$jabber_address,$jabber_only,$theme_id,'',
-					      $address,$address2,$phone,$fax,$title,$ccode);
+					      $address,$address2,$phone,$fax,$title,$ccode,$send_mail);
 		if ($register) {
 			site_header(array('title'=>'Register Confirmation'));
-		echo '<p>';
-		printf(_('Congratulations. You have registered on %1$s.'), forge_get_config ('forge_name'));
-		echo '</p>';
-		print '<p>' . _('You are now being sent a confirmation email to verify your email address. Visiting the link sent to you in this email will activate your account.') . '</p>';
+
+
+
+			if ($activate_immediately) {
+				if (!$new_user->setStatus('A')) {
+					print '<span class="error">' .
+						_('Error during user activation but after user registration (user is now in pending state and will not get a notification eMail!)') .
+						'</span>' ;
+					print '<p>' . sprintf(_("Could not activate newly registered user's forge account: %s"), htmlspecialchars($new_user->getErrorMessage())) . '</p>';
+					$HTML->footer(array());
+					exit;
+				}
+				plugin_hook('add_cal_user', $unix_name);
+			}
+			if ($send_mail) {
+				echo '<p>';
+				printf(_('Congratulations. You have registered on %1$s.'), forge_get_config ('forge_name'));
+				echo '</p>';
+				print '<p>' . _('You are now being sent a confirmation email to verify your email address. Visiting the link sent to you in this email will activate your account.') . '</p>';
+			} else {
+				print '<p>' ; 
+				printf (_('You have registered and activated user %1$s on %2$s. They will not receive an eMail about this fact.'), $unix_name, forge_get_config('forge_name'));
+				print '</p>' ;
+			}
 			site_footer(array());
 			exit;
 		} else {
@@ -206,6 +236,11 @@
 		      util_make_url ('/terms.php')); ?>
 	</p>
 <?php } ?>
+<?php if (forge_check_global_perm ('forge_admin')) { ?>
+	<p><input type="checkbox" name="activate_immediately" value="0" />
+<?php print _('Activate this user immediately') ; ?>
+	</p>
+<?php } ?>
 <p>
 <?php printf(_('Fields marked with %s are mandatory.'), utils_requiredField()); ?>
 </p>



More information about the evolvis-commits mailing list