Changeset 2177 for branches


Ignore:
Timestamp:
Dec 11, 2007, 7:04:07 AM (17 years ago)
Author:
rub
Message:

Resolved issue 0000784: Mail notification disabled on register user

Location:
branches/branch-1_7
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/branch-1_7/admin/user_list.php

    r2088 r2177  
    194194{
    195195  $page['errors'] = register_user(
    196     $_POST['login'], $_POST['password'], $_POST['email']);
     196    $_POST['login'], $_POST['password'], $_POST['email'], false);
    197197
    198198  if (count($page['errors']) == 0)
  • branches/branch-1_7/include/functions_user.inc.php

    r2054 r2177  
    4545}
    4646
    47 function register_user($login, $password, $mail_address, $errors = array())
     47function register_user($login, $password, $mail_address,
     48  $with_notification = true, $errors = array())
    4849{
    4950  global $lang, $conf;
     
    9293    mass_inserts(USERS_TABLE, array_keys($insert), array($insert));
    9394
    94   // Assign by default groups
    95   {
    96     $query = '
     95    // Assign by default groups
     96    {
     97      $query = '
    9798SELECT id
    9899  FROM '.GROUPS_TABLE.'
     
    100101  ORDER BY id ASC
    101102;';
    102     $result = pwg_query($query);
    103 
    104     $inserts = array();
    105     while ($row = mysql_fetch_array($result))
    106     {
    107       array_push
    108       (
    109         $inserts,
    110         array
     103      $result = pwg_query($query);
     104
     105      $inserts = array();
     106      while ($row = mysql_fetch_array($result))
     107      {
     108        array_push
    111109        (
    112           'user_id' => $next_id,
    113           'group_id' => $row['id']
    114         )
    115       );
     110          $inserts,
     111          array
     112          (
     113            'user_id' => $next_id,
     114            'group_id' => $row['id']
     115          )
     116        );
     117      }
    116118    }
    117119
     
    121123      mass_inserts(USER_GROUP_TABLE, array('user_id', 'group_id'), $inserts);
    122124    }
    123   }
    124125
    125126    create_user_infos($next_id);
     127
     128    if ($with_notification and $conf['email_admin_on_new_user'])
     129    {
     130      include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
     131      $username = $_POST['login'];
     132      $admin_url = get_absolute_root_url()
     133                   .'admin.php?page=user_list&username='.$username;
     134
     135      $keyargs_content = array
     136      (
     137        get_l10n_args('User: %s', $username),
     138        get_l10n_args('Email: %s', $_POST['mail_address']),
     139        get_l10n_args('', ''),
     140        get_l10n_args('Admin: %s', $admin_url)
     141      );
     142
     143      pwg_mail_notification_admins
     144      (
     145        get_l10n_args('Registration of %s', $username),
     146        $keyargs_content
     147      );
     148    }
    126149
    127150    trigger_action('register_user',
  • branches/branch-1_7/include/user.inc.php

    r1903 r2177  
    6666  if (!($user['id'] = get_userid($_SERVER['REMOTE_USER'])))
    6767  {
    68     register_user($_SERVER['REMOTE_USER'], '', '');
     68    register_user($_SERVER['REMOTE_USER'], '', '', false);
    6969    $user['id'] = get_userid($_SERVER['REMOTE_USER']);
    7070  }
  • branches/branch-1_7/register.php

    r2015 r2177  
    5353                    $_POST['password'],
    5454                    $_POST['mail_address'],
     55                    true,
    5556                    $errors);
    5657
     
    5859  {
    5960    $user_id = get_userid($_POST['login']);
    60     log_user( $user_id, false);
    61 
    62     if ($conf['email_admin_on_new_user'])
    63     {
    64       include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    65       $username = $_POST['login'];
    66       $admin_url = get_absolute_root_url()
    67                    .'admin.php?page=user_list&username='.$username;
    68 
    69       $keyargs_content = array
    70       (
    71         get_l10n_args('User: %s', $username),
    72         get_l10n_args('Email: %s', $_POST['mail_address']),
    73         get_l10n_args('', ''),
    74         get_l10n_args('Admin: %s', $admin_url)
    75       );
    76 
    77       pwg_mail_notification_admins
    78       (
    79         get_l10n_args('Registration of %s', $username),
    80         $keyargs_content
    81       );
    82     }
     61    log_user($user_id, false);
    8362    redirect(make_index_url());
    8463  }
Note: See TracChangeset for help on using the changeset viewer.