View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update | 
|---|---|---|---|---|---|
| 0007322 | mantisbt | administration | public | 2006-08-01 05:43 | 2007-05-22 09:53 | 
| Reporter | brody | Assigned To | |||
| Priority | normal | Severity | tweak | Reproducibility | N/A | 
| Status | new | Resolution | open | ||
| Product Version | 1.0.5 | ||||
| Summary | 0007322: email notification not only for general manager on new signup | ||||
| Description | Hi, Setting the configuration item of "$g_notify_new_user_created_threshold_min" to role MANAGER (instead of ADMINISTRATOR) seems to be not the solution (or does not work correctly), because my managers are only managers for their project, but not in general. An idea would be, to have a flag which decides the use of general role and/or additional a projects role. Other possibility is to create a list of users, which anyway will be notified. Any comments?  | ||||
| Tags | No tags attached. | ||||
| Attached Files |  Patch_2007_03_16_Publish.diff (2,721 bytes)   
 
diff -cr core/email_api.php core/email_api.php
*** core/email_api.php	2007-03-16 14:17:30.000000000 +0100
--- core/email_api.php	2007-03-16 10:35:14.000000000 +0100
***************
*** 408,413 ****
--- 408,420 ----
  
  		$t_threshold_min = config_get( 'notify_new_user_created_threshold_min' );
  		$t_threshold_users = project_get_all_user_rows( ALL_PROJECTS, $t_threshold_min );
+ 		
+ 		if (config_get( 'activate_notify_new_user_created_threshold_min_projects' ))
+ 		{
+ 			$t_threshold_min = config_get( 'notify_new_user_created_threshold_min_projects' );
+ 			$t_threshold_users_projects = all_projects_get_all_user_rows( $t_threshold_min );
+ 			$t_threshold_users = array_merge ($t_threshold_users, $t_threshold_users_projects);
+ 		}
  
  		foreach( $t_threshold_users as $t_user ) {
  			lang_push( user_pref_get_language( $t_user['id'] ) );
diff -cr core/project_api.php core/project_api.php
*** core/project_api.php	2007-03-16 14:17:41.000000000 +0100
--- core/project_api.php	2007-03-16 10:35:14.000000000 +0100
***************
*** 442,447 ****
--- 442,487 ----
  	}
  
  	# --------------------
+ 	# Return an array of info about users who have access to all projects. (depending on access level)
+ 	# For each user we have 'id', 'username', and 'access_level' (overall access level)
+ 	# Return only users with an access level higher than the given value in the first parameter.
+ 	function all_projects_get_all_user_rows( $p_access_level = ANYBODY ) 
+ 	{
+ 		$c_access_level	= db_prepare_int( $p_access_level );
+ 		
+ 		# Optimization when access_level is NOBODY
+ 		if ( NOBODY == $p_access_level ) 
+ 		{
+ 			return array();
+ 		}
+ 		
+ 		$t_user_table = config_get( 'mantis_user_table' );
+ 		$t_project_user_list_table = config_get( 'mantis_project_user_list_table' );
+ 		$t_project_table = config_get( 'mantis_project_table' );
+ 		
+ 		$t_on = ON;
+ 		$t_users = array();
+ 	
+ 		# Get the project overrides
+ 		$query = "SELECT u.id, u.username, u.realname, l.access_level
+ 					FROM $t_project_user_list_table l, $t_user_table u
+ 					WHERE l.user_id = u.id
+ 					AND u.enabled = $t_on
+ 					AND l.access_level >= $c_access_level
+ 					GROUP BY u.id";
+ 		
+ 		$result = db_query( $query );
+ 		$t_row_count = db_num_rows( $result );
+ 		for ( $i=0 ; $i < $t_row_count ; $i++ ) {
+ 			$row = db_fetch_array( $result );
+ 			$t_users[$row['id']] = $row;
+ 		}
+ 	
+ 		return array_values( $t_users );
+ 	}
+ 	
+ 	
+ 	# --------------------
  	# Return an array of info about users who have access to the the given project
  	# For each user we have 'id', 'username', and 'access_level' (overall access level)
  	# If the second parameter is given, return only users with an access level
 | ||||
| 
	 Hi, I resolved it writing a new function which browses and extracts all of the managers. Then I just needed to merge the result of my function with the standard result of $g_notify_new_user_created_threshold_min. (Mantis function) You can configure my function in your config_inc.php file. (1 variable allowing to enable or disable my function and an other to modify access level) Installation : 
 Have fun...  | 
|
| 
	 @Dufrenoy: Seems to be good work - I'm not able to test it yet. Thus, two questions:  | 
|