Привет,
Установил хак Автоматической отсылки PM пользователю, когда он зарегистрируеться, все работает, да вот в Register.php выдает ошибку после заполнения формы.
Вот хак код:
/---------------------------------------------------/
// Auto Send PM to New Users
// Adapted for IBF 1.1 Beta 4 by RockStarCrest (rockstarcrest@yahoo.ca
// Originally written for 1.0.1 by SirReal (SirReal@clangrounds.com)
//
// When a user registers they will receive an
// editable welcome message pm from the admin
/---------------------------------------------------/
/-----------------------------------------/
/Step 1: Open sources/Register.php and find near line 413:
/-----------------------------------------/
$member = array(
\'id\' => $member_id,
\'name\' => $in_username,
\'password\' => $in_password,
\'email\' => $in_email,
\'mgroup\' => $mem_group,
\'posts\' => 0,
\'avatar\' => \'noavatar\',
\'joined\' => time(),
\'ip_address\' => $ibforums->input[\'IP_ADDRESS\'],
\'time_offset\' => $ibforums->vars[\'time_offset\'],
\'view_sigs\' => 1,
\'email_pm\' => 1,
\'view_img\' => 1,
\'view_avs\' => 1,
\'allow_post\' => 1,
\'view_pop\' => 1,
\'vdirs\' => "in:Inbox|sent:Sent Items",
\'msg_total\' => 0,
\'new_msg\' => 0,
\'coppa_user\' => $coppa,
);
-----------------------------------------
REPLACE that with:
-----------------------------------------
if ($ibforums->vars[\'pm_send\'] == \'1\') {
$DB->query("SELECT MAX(msg_id) as msg_msg_id FROM ibf_messages");
$r = $DB->fetch_row();
$msg_msg_id = $r[\'msg_msg_id\'] + 1;
$now = time();
$new_subject = str_replace("%USER%",$in_username,$ibforums->vars[\'pm_subject\']);
$new_message = str_replace("%USER%",$in_username,$ibforums->vars[\'pm_msg\']);
$DB->query("INSERT INTO ibf_messages VALUES ($msg_msg_id, $now, 0, \'$new_subject\', \'$new_message\', \'{$ibforums->vars[\'pm_id\']}\', \'in\', \'$member_id\', \'$member_id\', NULL, NULL, NULL, 0, NULL)");
$member = array(
\'id\' => $member_id,
\'name\' => $in_username,
\'password\' => $in_password,
\'email\' => $in_email,
\'mgroup\' => $mem_group,
\'posts\' => 0,
\'avatar\' => \'noavatar\',
\'joined\' => time(),
\'ip_address\' => $ibforums->input[\'IP_ADDRESS\'],
\'time_offset\' => $ibforums->vars[\'time_offset\'],
\'view_sigs\' => 1,
\'email_pm\' => 1,
\'view_img\' => 1,
\'view_avs\' => 1,
\'allow_post\' => 1,
\'view_pop\' => 1,
\'vdirs\' => "in:Inbox|sent:Sent Items",
\'msg_total\' => 1, //New Msg on register
\'new_msg\' => 1,
\'msg_from_id\' => $ibforums->vars[\'pm_id\'],
\'msg_msg_id\' => $msg_msg_id,
\'show_popup\' => 1,
\'coppa_user\' => $coppa,
);
} else {
$member = array(
\'id\' => $member_id,
\'name\' => $in_username,
\'password\' => $in_password,
\'email\' => $in_email,
\'mgroup\' => $mem_group,
\'posts\' => 0,
\'avatar\' => \'noavatar\',
\'joined\' => time(),
\'ip_address\' => $ibforums->input[\'IP_ADDRESS\'],
\'time_offset\' => $ibforums->vars[\'time_offset\'],
\'view_sigs\' => 1,
\'email_pm\' => 1,
\'view_img\' => 1,
\'view_avs\' => 1,
\'allow_post\' => 1,
\'view_pop\' => 1,
\'vdirs\' => "in:Inbox|sent:Sent Items",
\'msg_total\' => 0,
\'new_msg\' => 0,
\'coppa_user\' => $coppa,
);
}
-----------------------------------------
Close sources/Register.php
-----------------------------------------
-----------------------------------------
Step 2: Open sources/admin/ad_settings.php and find near line 81:
-----------------------------------------
case \'url\':
$this->url();
break;
case \'dourl\':
$this->save_config( array ( \'html_dir\',\'safe_mode_skins\', \'board_name\',\'board_url\',\'home_name\',\'home_url\', \'disable_gzip\',
\'html_url\',\'upload_url\', \'upload_dir\', \'print_headers\', \'header_redirect\', \'debug_level\', \'sql_debug\') );
break;
-----------------------------------------
REPLACE that with:
-----------------------------------------
case \'url\':
$this->url();
break;
case \'dourl\':
$this->save_config( array ( \'html_dir\',\'safe_mode_skins\', \'board_name\',\'board_url\',\'home_name\',\'home_url\', \'disable_gzip\',
\'html_url\',\'upload_url\', \'upload_dir\', \'print_headers\', \'header_redirect\', \'debug_level\', \'sql_debug\', \'pm_send\', \'pm_id\', \'pm_subject\', \'pm_msg\' ) );
break;
-----------------------------------------
then find near line 922:
-----------------------------------------
$ADMIN->html .= $SKIN->add_td_row( array( "Debug level" ,
$SKIN->form_dropdown( "debug_level",
array(
0 => array( 0, \'0: None - Don\\\'t show any debug information\' ),
1 => array( 1, \'1: Show server load, page generation times and query count\' ),
2 => array( 2, \'2: Show level 1 (above) and GET and POST information\'),
3 => array( 3, \'3: Show level 1 + 2 and database queries\'),
),
$INFO[\'debug_level\'] )
) );
$ADMIN->html .= $SKIN->add_td_row( array( "ENABLE SQL Debug Mode?
(If yes, add \'&debug=1\' to any page to view mySQL debug info)" ,
$SKIN->form_yes_no( "sql_debug", $INFO[\'sql_debug\'] )
) );
-----------------------------------------
and below that ADD:
-----------------------------------------
//-----------------------------------------------------------------------------------------------------------
$ADMIN->html .= $SKIN->add_td_basic( \'Auto-PM New Users Settings\', \'left\', \'catrow2\' );
//-----------------------------------------------------------------------------------------------------------
// START PM to new users mod
$ADMIN->html .= $SKIN->add_td_row( array( "Send PM to new users?" ,
$SKIN->form_yes_no( "pm_send", $INFO[\'pm_send\'] )
) );
$ADMIN->html .= $SKIN->add_td_row( array( "Registration PM From id
This must be the numerical memberID" ,
$SKIN->form_input( "pm_id", $INFO[\'pm_id\'] )
) );
$ADMIN->html .= $SKIN->add_td_row( array( "PM Subject" ,
$SKIN->form_input( "pm_subject", $INFO[\'pm_subject\'] )
) );
$ADMIN->html .= $SKIN->add_td_row( array( "PM Sent to New Members
use %USER% in the message and it will be replaced by their username" ,
$SKIN->form_textarea( "pm_msg", $INFO[\'pm_msg\'] )
) );
// END PM to new users mod
-----------------------------------------
Close sources/admin/ad_settings.php
-----------------------------------------
-----------------------------------------
Step 3: Login to Admin CP and goto Board Settings > Basic Config
-----------------------------------------
edit the 4 new settings to suit your needs
Send PM to new users? (YES/NO)- this turns the entire mod on and off
Registration PM From id - who do you want the PM to come from (MUST BE THE NUMERICAL ID!)
PM Subject - the subject line of the new pm
PM Sent to New Members - the main text of the pm
-----------------------------------------
ALL DONE !!
-----------------------------------------
А выдает слудющию шибку:
Warning: Compilation failed: nothing to repeat at offset 0 in forum/sources/Register.php on line 666
А в этой строке:
if (preg_match( "/$n/i", $in_username ))
Как решить эту проблему?
Жду Ответов.
С Уважением,
Алекс.