

-Yêu cầu:
+phải dùng mod thông báo by inu share tại đây

+Áp dụng với wap dùng tags(). Đối với wap dùng bbcode::tags() thì cũng làm tương tự chỉ khác bước "tìm" thôi

Bắt đầu thôi

-Mở users/thongbao.php tìm:
Code PHP:
<?php
$hanhdong=array("trả lời bạn","thích bài viết của bạn");?>
Thay lại thành:
Code PHP:
<?php
$hanhdong=array("trả lời bạn","thích bài viết của bạn","tag tên bạn");?>
Lưu file đó lại

-Mở file incfiles/bbcode.php chèn vào ngay dưới:
Code PHP:
<?php
defined('_IN_JOHNCMS') or die('Error: restricted access');?>
code sau:
Code PHP:
<?phpfunction tagtv($var){$db=mysql_fetch_array(mysql_query("select * from users where name='{$var}'"));
if(mysql_num_rows(mysql_query("select * from users where name='{$var}'"))==0){$ra='@'.$var.'';
} else {$ra='@<a href="../users/profile.php?user='.$db['id'].'">'.$var.'</a>';
}
return $ra;
}?>
Sau đó tìm tiếp:
Code PHP:
<?phpfunction tags($var) {?>
chèn vào ngay phía dưới:
Code PHP:
<?php
$var = preg_replace(array ('#@([\w\d]{2,})#se'), array ("''.tagtv('$1').''"), str_replace("]\n", "]", $var));?>
ok lưu lại

-cuối cùng mở forum/includes/say.php tìm:
Code PHP:
<?php
$msg = isset($_POST['msg']) ??>
ra 2 kết quả giống nhau

Code PHP:
<?php
$tagtv = isset($_POST['msg']) ? trim($_POST['msg']) : '';?>
xong tìm tiếp:
Code PHP:
<?php
$fadd = mysql_insert_id();?>
cũng sẽ ra 2 kết quả


Code PHP:
<?php///mod tag thanh vienif(preg_match('#@([\w\d]{2,})#si',$tagtv)){preg_match_all('#@([\w\d]{2,})#si',$tagtv,$arr);
foreach($arr[1] as $tag){$db=mysql_fetch_array(mysql_query("select * from users where name='{$tag}'"));
if(mysql_num_rows(mysql_query("select * from users where name='{$tag}'"))==0 || $db['id']==$user_id){
} else {mysql_query("INSERT INTO `thongbao` SET
`id_from`='".$user_id."',
`id_to` = '".$db['id']."',
`hanhdong`='2',
`id_forum`='".$id."',
`text` = '".$_GET['page']."|',
`type`='f',
`time` = '" . time() . "'
");
}
}
}///ket thuc mod tag thanh vien?>
tiếp ta thêm vào ngay bên trên kết quả tìm đc thứ hai đoạn code sau :
Code PHP:
<?php///mod tag thanh vienif(preg_match('#@([\w\d]{2,})#si',$tagtv)){preg_match_all('#@([\w\d]{2,})#si',$tagtv,$arr);
foreach($arr[1] as $tag){$db=mysql_fetch_array(mysql_query("select * from users where name='{$tag}'"));
if(mysql_num_rows(mysql_query("select * from users where name='{$tag}'"))==0 || $db['id']==$user_id){
} else {$sobai=mysql_result(mysql_query("select count(*) from forum where refid = '{$th}' and type='m' order by time desc"),0);$sopage=ceil($sobai/$kmess);mysql_query("INSERT INTO `thongbao` SET
`id_from`='".$user_id."',
`id_to` = '".$db['id']."',
`hanhdong`='2',
`id_forum`='".$th."',
`text` = '".$sopage."|',
`type`='f',
`time` = '" . time() . "'
");
}
}
}///ket thuc mod tag thanh vien?>
Done...lưu lại và ra test thành quả ngay thôi
