PDA

View Full Version : Mod Nhắn PM khi thành viên mới đăng kí ( cái nì dành cho IBF


LSB_conan
24-05-2004, 10:37
Chà ....
toàn là IBF sao ko có PHPBB nhỉ .
bữa nào post lên chơi hen cho bà con tham khảo.
Nào bắt đầu nhé .
cái mod này có nghĩa là khi thành viên mới đăng kí xong thì diễn đàn sẽ tự động gửi tin nhắn đến thành viên thông báo chúc mừng ấy mà.
ok
Các file cần sửa:

./sources/Register.php
./sources/Admin/ad_settings.php


Nhớ Backup khi hack mod

Mở sources/Register.php


Tìm cài đoạn này :
[code:1:a1c235b975]
//+--------------------------------------------
//| Insert into the DB
//+--------------------------------------------

$member['password'] = md5( $member['password'] );

$db_string = $std->compile_db_string( $member );

$DB->query("INSERT INTO ibf_members (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
[/code:1:a1c235b975]
rồi sau đó thêm vào phía trên nó đó ok. với đoạn code sau :
[code:1:a1c235b975]//+--------------------------------
//| Auto Send PM To New Users V4.0
//+--------------------------------

if($ibforums->vars['auto_pm_on'] == 1) {
$DB->query("SELECT MAX(msg_id) as message_id FROM ibf_messages");
$auto_pm = $DB->fetch_row();
$auto_pm_messageid = $auto_pm['message_id'] + 1;
$current_time = time();
$pm_message = str_replace("*username*",$in_username,$ibforums->vars['auto_pm_message']);
$pm_subject = str_replace("*username*",$in_username,$ibforums->vars['auto_pm_subject']);
require "./sources/lib/post_parser.php";

$this->parser = new post_parser();
$pm_message = $this->parser->convert( array( 'TEXT' => $pm_message,
'SMILIES' => 1,
'CODE' => $ibforums->vars['msg_allow_code'],
'HTML' => $ibforums->vars['msg_allow_html']
) );

$pm_message = addslashes($pm_message);
$DB->query("INSERT INTO ibf_messages & #40;msg_id,msg_date,read_state,title,message,from_ id,vid,member_id,recipient_id,attach_type,attach_f
ile,cc_users,tracking,read_date) VALUES ('','{$current_time}','0','{$pm_subject}','{$pm_me ssage}','{$ibforums->vars['auto_pm_from']}','in','{$member_id}','{$mem ber_id}', 'NULL', 'NULL', 'NULL', '0', 'NULL')");
$member['msg_from_id'] = $ibforums->vars['auto_pm_from'];
$member['msg_msg_id'] = $auto_pm_messageid;
$member['new_msg'] = 1;
$member['msg_total'] += 1;
$member['show_popup'] = $ibforums->vars['show_pm_popup'];

}[/code:1:a1c235b975]
Save và upload

Tiếp theo mở file: sources/Admin/ad_settings.php

Tìm cái này:
[code:1:a1c235b975]
case 'url':
$this->url();
break;
case 'dourl':
$this->save_config( array ( 'number_format', '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;
[/code:1:a1c235b975]



Thay nó bằng:


[code:1:a1c235b975]

case 'url':
$this->url();
break;
case 'dourl':
$this->save_config( array ( 'number_format', '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', 'auto_pm_on', 'show_pm_popup', 'auto_pm_subject', 'auto_pm_message', 'auto_pm_from' ) );
break;

[/code:1:a1c235b975]


Chú ý:
Cái này bạn có thể thêm vào sau
[code:1:a1c235b975]
'sql_debug'
[/code:1:a1c235b975]
là:


[code:1:a1c235b975]
, 'auto_pm_on', 'show_pm_popup', 'auto_pm_subject', 'auto_pm_message', 'auto_pm_from'
[/code:1:a1c235b975]


Tiếp đó tìm cái đoạn này:


[code:1:a1c235b975]


$ADMIN->html .= $SKIN->add_td_row( array( "<b>Debug level</b>" ,
$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( "<b><i>ENABLE</I> SQL Debug Mode?</b><br>(If yes, add '&debug=1' to any page to view mySQL debug info)" ,
$SKIN->form_yes_no( "sql_debug", $INFO['sql_debug'] )
) );
[/code:1:a1c235b975]



Dán bên dưới:


[code:1:a1c235b975]

//--------------------------------------------------------------------------------

$ADMIN->html .= $SKIN->add_td_basic( 'Auto PM To New Users', 'left', 'catrow2' );

//--------------------------------------------------------------------------------
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Enable Auto PM?</b><br>(If yes, new users who register will get a PM from you)" ,
$SKIN->form_yes_no( "auto_pm_on", $INFO['auto_pm_on'] )
) );

$ADMIN->html .= $SKIN->add_td_row( array( "<b>Show New Message Popup?</b><br>(If yes, when a user has registered and logs into there account it will popup the New PM window, else it will just show 1 New Messages.)" ,
$SKIN->form_yes_no( "show_pm_popup", $INFO['show_pm_popup'] )
) );

$ADMIN->html .= $SKIN->add_td_row( array( "<b>New Registration PM From?</b><br>(The User ID to send the PM from when a new user joins)<br />You're User ID is: <b>".$MEMBER['id']."</b>" ,
$SKIN->form_input( "auto_pm_from", $INFO['auto_pm_from'] )
) );

$ADMIN->html .= $SKIN->add_td_row( array( "<b>PM Subject</b><br>(The subject a new PM will have)" ,
$SKIN->form_input( "auto_pm_subject", $INFO['auto_pm_subject'] )
) );

$ADMIN->html .= $SKIN->add_td_row( array( "<b>PM Sent to New Users</b><br>(Use *username* will replace that with the new users, username)" ,
$SKIN->form_textarea( "auto_pm_message", $INFO['auto_pm_message'] )
) );

[/code:1:a1c235b975]


Save và upload lên forum của bạn

LSB_conan
24-05-2004, 10:39
Sau đó bạn vào ACP vàd thiết lập thông số ở phần này:

System Settings/General Configuration/ chọn Auto PM To New Users

1) Enable Auto PM? bạn chọn Yes.
2) Show New Message Popup? bạn cũng chọn Yes
3) New Registration PM From? Bạn điền số 1 vì bạn là Thành viên thứ nhất của diễn đàn mà
4) PM Subject Bạn đánh tiêu đề cho tin nhắn
5) PM Sent to New Users Nội dung bạn gửi đến thành viên mới, dùng

[code:1:744570f94c]
*username*
[/code:1:744570f94c]
để hiện tên thành viên mới trong nội dung. Giả sử:
Chào *username* !!! Tức nó sẽ thay tên tv mới vào cái đó
Thế rồi bạn mún uýnh nội dung chi vô cái khung đó cũng được...
have fun !!!