Tips:

Share mod tag có noti như facebook

29.5.14 Unknown
Tác giả: Sưu tầm Internet Grin
-Yêu cầu:
+phải dùng mod thông báo by inu share tại đây Grin.
+Á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 Cười lăn lộn

Bắt đầu thôi cười ngoác miệng
-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ạiSmile

-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ạiSmile

-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 nhauSmile.ta thêm vào ngay bên dưới cả 2 chỗ tìm đc:
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ả Grin ta thêm vào ngay bên trên kết quả tìm đc thứ nhất đoạn code sauSmile
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}'"))==|| $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}'"))==|| $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 Cười lăn lộn

╔══╗
╚╗╔╝
╔╝ (¯`v´¯)
╚══`.¸.VL48 -

Từ khóa :
Share mod tag có noti như facebook Share mod tag có noti như facebook
9 10 1

Bài viết Share mod tag có noti như facebook