powiadamianie admina o nowym użytkowniku

Tutaj udzielane jest wsparcie przy problemach związanych z instalacją, konwersją, aktualizacją oraz użytkowaniem phpBB 2.0.x.
Elfiszcze
Posty: 4
Rejestracja: 09 sierpnia 2007, 23:11

powiadamianie admina o nowym użytkowniku

Post autor: Elfiszcze » 09 sierpnia 2007, 23:15

Witam.
Jestem tutaj całkiem nowa i dopiero niedawno załozylam swoje pierwsze forum. szukam odpowiedzi na pytanie: gdzie i jak coś ustawić aby administrator byl powiadamiany o rejestracji nowego użytkownika mailem?

z góry dziękuję za odpowiedź.
pozdrawiam

Awatar użytkownika
daroPL
Zasłużony
Posty: 4564
Rejestracja: 24 czerwca 2005, 13:36
Lokalizacja: Poznań
Kontakt:

Post autor: daroPL » 10 sierpnia 2007, 07:52

Na dole pliku includes/functions.php (przed znakiem ?>) dajesz kod:
[php]function send_pm($user_to_id, $nd_subject, $nd_message)
{
global $board_config, $lang, $db, $phpbb_root_path, $phpEx, $html_entities_match, $html_entities_replace;

$sql = "SELECT *
FROM " . USERS_TABLE . "
WHERE user_id = " . $user_to_id . "
AND user_id <> " . ANONYMOUS;
if ( !($result = $db->sql_query($sql)) )
{
return;
}
$to_userdata = $db->sql_fetchrow($result);

require_once($phpbb_root_path . 'includes/bbcode.'.$phpEx);
require_once($phpbb_root_path . 'includes/functions_post.'.$phpEx);

$bbcode_uid = make_bbcode_uid();
$nd_message = str_replace("'", "''", $nd_message);

$nd_message = prepare_message(trim($nd_message), 0, 1, 1, $bbcode_uid);

$msg_time = time();

// Do inbox limit stuff
$sql = "SELECT COUNT(privmsgs_id) AS inbox_items, MIN(privmsgs_date) AS oldest_post_time
FROM " . PRIVMSGS_TABLE . "
WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR privmsgs_type = " . PRIVMSGS_READ_MAIL . "
OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )
AND privmsgs_to_userid = " . $to_userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
return;
}

$sql_priority = ( SQL_LAYER == 'mysql' ) ? 'LOW_PRIORITY' : '';

if ( $inbox_info = $db->sql_fetchrow($result) )
{
if ( $inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs'] )
{
$sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . "
WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR privmsgs_type = " . PRIVMSGS_READ_MAIL . "
OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )
AND privmsgs_date = " . $inbox_info['oldest_post_time'] . "
AND privmsgs_to_userid = " . $to_userdata['user_id'];
if ( !$db->sql_query($sql) )
{
return;
}
}
}

$sql_info = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig)
VALUES (" . PRIVMSGS_NEW_MAIL . ", '" . str_replace("\'", "''", $nd_subject) . "', " . ANONYMOUS . ", " . $to_userdata['user_id'] . ", $msg_time, '$user_ip', 0, 1, 1, 1)";

if ( !($result = $db->sql_query($sql_info, BEGIN_TRANSACTION)) )
{
return;
}

$privmsg_sent_id = $db->sql_nextid();

$sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)
VALUES ($privmsg_sent_id, '" . $bbcode_uid . "', '" . str_replace("\'", "''", $nd_message) . "')";

if ( !$db->sql_query($sql, END_TRANSACTION) )
{
return;
}

$sql = "UPDATE " . USERS_TABLE . "
SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = '9999999999'
WHERE user_id = " . $to_userdata['user_id'];
if ( !$status = $db->sql_query($sql) )
{
return;
}

return;
}[/php]

pózniej w pliku includes/usercp_register.php
znajdź:
[php] $message = $message . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');

message_die(GENERAL_MESSAGE, $message);[/php]

i przed tym dodaj:
[php] send_pm(2, 'Zarejestrował się nowy użytkownik', 'Właśnie zarejestrował się nowy użytkownik o nicku: <b>'.str_replace("\'", "''", $username).'</b>');[/php]

2 - to numer użytkownika do, którego zostanie wysłana pw.

Zablokowany

Wróć do „Pomoc”