Ignore:
Timestamp:
Sep 16, 2012, 6:22:00 PM (12 years ago)
Author:
Eric
Message:

New feature : Send the validation key by email to webmaster (not admins !) to allow it to validate manually a user registration whithout having to connect the gallery. This is when manual validation by admins is set in UAM options.

By the way, I fixed a bug in VerifyConfirmMail($key) function. I'm wondering it worked before...

I don't remember why I used $conf_UAM[4] <> -1 or isset($datastatus) in VerifyConfirmMail($key) function. Now only $conf_UAM[4] <> -1 is used and all works fine.

Next step : Extending the send of validation key to all admins in addition of webmaster.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/UserAdvManager/trunk/include/functions.inc.php

    r17944 r17946  
    140140      // -------------------------------------------------------------------------------------------------------------
    141141      SetUnvalidated($register_user['id']);
     142
     143      // This is to send the validation key by email to admins for their manual validation without having to connect the gallery
     144      // -----------------------------------------------------------------------------------------------------------------------
     145      SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true);
    142146    }
    143147    // Sending registration confirmation by email
     
    609613WHERE user_id = '.$user_id.'
    610614  AND (
    611     group_id = "'.$conf_UAM[2].'"
     615    group_id = '.$conf_UAM[2].'
    612616  OR
    613     group_id = "'.$conf_UAM[3].'"
     617    group_id = '.$conf_UAM[3].'
    614618  )
    615619;';
     
    971975      break;
    972976     
    973     case 2: // Confirmation email on user profile update - With information email if checked
     977    case 2: // Confirmation email on user profile update - With information email if modification done in user profile
    974978      if (isset($conf_UAM[41]) and $conf_UAM[41] <> '')
    975979      {
     
    10961100  }
    10971101
    1098   if (isset($conf_UAM[1]) and $conf_UAM[1] == 'true' and $confirm) // Add confirmation link ?
     1102  if (isset($conf_UAM[1]) and ($conf_UAM[1] == 'true' or $conf_UAM[1] == 'local') and $confirm) // Add confirmation link ?
    10991103  {
    11001104    $infos2 = array
     
    11311135// Sending the email with subject and contents
    11321136// -------------------------------------------
    1133   pwg_mail($email, array(
    1134     'subject' => $subject,
    1135     'content' => (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : "").get_absolute_root_url(),
    1136   ));
    1137 
     1137                if (isset($conf_UAM[1]) and $conf_UAM[1] == 'local')
     1138                {
     1139                pwg_mail(get_webmaster_mail_address(), array(
     1140                'subject' => $subject,
     1141      'content' => (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : "").get_absolute_root_url(),
     1142    ));
     1143                }
     1144                else
     1145                {
     1146                pwg_mail($email, array(
     1147                'subject' => $subject,
     1148                'content' => (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : "").get_absolute_root_url(),
     1149                ));
     1150                }
    11381151// Switching back to default language
    11391152// ----------------------------------
     
    16581671WHERE user_id = '.$user_id.'
    16591672  AND (
    1660     group_id = "'.$conf_UAM[2].'"
     1673    group_id = '.$conf_UAM[2].'
    16611674  OR
    1662     group_id = "'.$conf_UAM[3].'"
     1675    group_id = '.$conf_UAM[3].'
    16631676  )
    16641677;';
     
    16851698  (user_id, group_id)
    16861699VALUES
    1687   ('.$user_id.', "'.$conf_UAM[2].'")
     1700  ('.$user_id.', '.$conf_UAM[2].')
    16881701;';
    16891702      pwg_query($query);
     
    17301743WHERE user_id = '.$user_id.'
    17311744  AND (
    1732     group_id = "'.$conf_UAM[2].'"
     1745    group_id = '.$conf_UAM[2].'
    17331746  OR
    1734     group_id = "'.$conf_UAM[3].'"
     1747    group_id = '.$conf_UAM[3].'
    17351748  )
    17361749;';
     
    17531766  (user_id, group_id)
    17541767VALUES
    1755   ('.$user_id.', "'.$conf_UAM[2].'")
     1768  ('.$user_id.', '.$conf_UAM[2].')
    17561769;';
    17571770    pwg_query($query);
     
    19091922SELECT COUNT(*)
    19101923FROM '.USER_CONFIRM_MAIL_TABLE.'
    1911 WHERE id = '.$id.'
     1924WHERE id = "'.$id.'"
    19121925;';
    19131926  list($count) = pwg_db_fetch_row(pwg_query($query));
     
    19181931SELECT user_id, status, date_check
    19191932FROM '.USER_CONFIRM_MAIL_TABLE.'
    1920 WHERE id = '.$id.'
     1933WHERE id = "'.$id.'"
    19211934;';
    19221935    $data = pwg_db_fetch_assoc(pwg_query($query));
     
    19821995DELETE FROM '.USER_GROUP_TABLE.'
    19831996WHERE user_id = '.$data['user_id'].'
    1984   AND group_id = "'.$conf_UAM[2].'"
     1997  AND group_id = '.$conf_UAM[2].'
    19851998;';
    19861999                                                                                                                pwg_query($query);
     
    19932006  (user_id, group_id)
    19942007VALUES
    1995   ('.$data['user_id'].', "'.$conf_UAM[3].'")
     2008  ('.$data['user_id'].', '.$conf_UAM[3].')
    19962009;';
    19972010                                                                                                                pwg_query($query);
    19982011                                                                                                }
    19992012
    2000                                                                                                 if (($conf_UAM[4] <> -1 or isset($data['status']))) // Change user's status
     2013                                                                                                if ($conf_UAM[4] <> -1) // Change user's status
    20012014                                                                                                {
    20022015                                                                                                                $query = '
    20032016UPDATE '.USER_INFOS_TABLE.'
    2004 SET status = "'.(isset($data['status']) ? $data['status'] : $conf_UAM[4]).'"
     2017SET status = "'.$conf_UAM[4].'"
    20052018WHERE user_id = '.$data['user_id'].'
    20062019;';
     
    20082021                                                                                                }
    20092022
    2010                                                                                                 if (($conf_UAM[36] <> -1 or isset($data['level']))) // Change user's privacy level
     2023                                                                                                if ($conf_UAM[36] <> -1) // Change user's privacy level
    20112024                                                                                                {
    20122025                                                                                                                $query = '
    20132026UPDATE '.USER_INFOS_TABLE.'
    2014 SET level = "'.(isset($data['level']) ? $data['level'] : $conf_UAM[36]).'"
     2027SET level = "'.$conf_UAM[36].'"
    20152028WHERE user_id = '.$data['user_id'].'
    20162029;';
    20172030                                                                                                                pwg_query($query);
    20182031                                                                                                }
     2032
     2033                                                                                                // Set UAM_validated field to True in #_users table
     2034                                                                                                $query = '
     2035UPDATE '.USERS_TABLE.'
     2036SET UAM_validated = "true"
     2037WHERE id = '.$data['user_id'].'
     2038;';
     2039                                                                                                pwg_query($query);
    20192040
    20202041                                                                                                // Refresh user's category cache
     
    20592080DELETE FROM '.USER_GROUP_TABLE.'
    20602081WHERE user_id = '.$data['user_id'].'
    2061 AND group_id = "'.$conf_UAM[2].'"
     2082AND group_id = '.$conf_UAM[2].'
    20622083;';
    20632084                                                                                                pwg_query($query);
     
    20692090DELETE FROM '.USER_GROUP_TABLE.'
    20702091WHERE user_id = '.$data['user_id'].'
    2071 AND group_id = "'.$conf_UAM[3].'"
     2092AND group_id = '.$conf_UAM[3].'
    20722093;';
    20732094                                                                                                pwg_query($query);
     
    20772098  (user_id, group_id)
    20782099VALUES
    2079   ('.$data['user_id'].', "'.$conf_UAM[3].'")
     2100  ('.$data['user_id'].', '.$conf_UAM[3].')
    20802101;';
    20812102                                                                                                pwg_query($query);
    20822103                                                                                }
    20832104
    2084                                                                                 if (($conf_UAM[4] <> -1 or isset($data['status']))) // Change user's status
     2105                                                                                if ($conf_UAM[4] <> -1) // Change user's status
    20852106                                                                                {
    20862107                                                                                                $query = '
    20872108UPDATE '.USER_INFOS_TABLE.'
    2088 SET status = "'.(isset($data['status']) ? $data['status'] : $conf_UAM[4]).'"
     2109SET status = "'.$conf_UAM[4].'"
    20892110WHERE user_id = '.$data['user_id'].'
    20902111;';
     
    20922113                                                                                }
    20932114
    2094                                                                                 if (($conf_UAM[36] <> -1 or isset($data['level']))) // Change user's privacy level
     2115                                                                                if ($conf_UAM[36] <> -1) // Change user's privacy level
    20952116                                                                                {
    20962117                                                                                                $query = '
    20972118UPDATE '.USER_INFOS_TABLE.'
    2098 SET level = "'.(isset($data['level']) ? $data['level'] : $conf_UAM[36]).'"
     2119SET level = "'.$conf_UAM[36].'"
    20992120WHERE user_id = '.$data['user_id'].'
    21002121;';
    21012122                                                                                                pwg_query($query);
    21022123                                                                                }
     2124
     2125                                                                                // Set UAM_validated field to True in #_users table
     2126                                                                                $query = '
     2127UPDATE '.USERS_TABLE.'
     2128SET UAM_validated = "true"
     2129WHERE id = '.$data['user_id'].'
     2130;';
     2131                                                                                pwg_query($query);
    21032132
    21042133                                                                                // Refresh user's category cache
     
    21492178DELETE FROM '.USER_GROUP_TABLE.'
    21502179WHERE user_id = '.$id.'
    2151                 AND group_id = "'.$conf_UAM[2].'"
     2180                AND group_id = '.$conf_UAM[2].'
    21522181;';
    21532182                                pwg_query($query);
     
    21592188DELETE FROM '.USER_GROUP_TABLE.'
    21602189WHERE user_id = '.$id.'
    2161                 AND group_id = "'.$conf_UAM[3].'"
     2190                AND group_id = '.$conf_UAM[3].'
    21622191;';
    21632192                                pwg_query($query);
     
    21672196                (user_id, group_id)
    21682197VALUES
    2169                 ('.$id.', "'.$conf_UAM[3].'")
     2198                ('.$id.', '.$conf_UAM[3].')
    21702199;';
    21712200                                pwg_query($query);
Note: See TracChangeset for help on using the changeset viewer.