Har gjort så gott jag kan och förstår att jag ska göra. Hoppas att ni inte tycker att jag är jättekonstig eller jobbig.
Kod: Markera allt
##############################################################
## Mod Title: Ignore Users Mod
## Mod Version: 1.1.1 RELEASE
## Author: GunnerX < gunnerx@gunnerx.net > Romar Armas - www.gunnerx.net
## Description: This Mod enables users to set up an ignore list.
## The posts of the users in this list will be ignored and unseen.
## Demo url at: http://www.gunnerx.net/phpBB21/
##
## Installation Level: (advanced)
## Installation Time: 30 Minutes
## Files To Edit: language/lang_english/lang_main.php,
## includes/constants.php,
## includes/topic_review.php,
## viewtopic.php
## templates/subSilver/subSilver.cfg
## templates/subSilver/viewtopic_body.tpl
## Included Files: ignore.php, ignore_body.tpl, icon_mini_ignore.gif, icon_ignore.gif
##############################################################
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
##############################################################
## Author Note:
## v1.1.1 Minor bug fix in viewtopic.php
## v1.1.0 New updated version with more functions
## v1.0.0 Release: I have added functionality in the viewtopic to add a poster
## to the ignore list. Also fixed a bug which allowed users to be listed
## multiple times.
## BETA: I did not add instructions as to where you would like to put the link
## to the ignore.php function. You can add the link anywhere you would like.
## Examples are: Top menu links, inside the profile.php or inside each post.
## It really is up to you. I placed it on the top menu.
##
##############################################################
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ COPY IMAGES ]------------------------------------------
#
copy icon_mini_ignore.gif to templates/subSilver/images/icon_mini_ignore.gif
copy icon_ignore.gif to templates/subSilver/images/icon_ignore.gif
copy icon_ignore.gif to templates/subSilver/images/lang_english/icon_ignore.gif
#
#-----[ COPY FILES ]------------------------------------------
#
copy ignore.php to ignore.php
copy ignore_body.tpl to templates/subSilver/ignore_body.tpl
#
#-----[ CREATE TABLE ]------------------------------------------
#
CREATE TABLE phpbb_ignore (
user_id mediumint(8) NOT NULL default '0',
user_ignore mediumint(8) NOT NULL default '0'
) TYPE=MyISAM;
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all Folks!
// -------------------------------------------------
#
#-----[ BEFORE, ADD ]------------------------------------------
#
//
// Ignore User Function
//
$lang['Ignore_list'] = "Ignore Function";
$lang['Ignore_users'] = "These Users are in your Ignore List";
$lang['Ignore_add'] = "Add User to Ignore List";
$lang['Ignore_delete'] = "Remove User from Ignore List";
$lang['Ignore_added'] = "User added to Ignore List";
$lang['Ignore_deleted'] = "User removed from Ignore List";
$lang['Ignore_submit'] = "Ignore User";
$lang['Ignore_exists'] = "User is Already on Ignore List";
$lang['Click_return_ignore'] = "Click %sHERE%s to return to the Ignore Page";
$lang['Ignore_user_warn'] = "You cannot Ignore Yourself!!!";
$lang['Post_user_ignored'] = "You have added this person to your <b>Ignore List</b>.";
$lang['Click_view_ignore'] = "Click %sHERE%s to view this post.";
#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]------------------------------------------
#
define('PAGE_GROUPCP', -11);
#
#-----[ AFTER, ADD ]------------------------------------------
#
define('PAGE_IGNORE', -12);
#
#-----[ FIND ]------------------------------------------
#
define('GROUPS_TABLE', $table_prefix.'groups');
#
#-----[ AFTER, ADD ]------------------------------------------
#
define('IGNORE_TABLE', $table_prefix.'ignore');
#
#-----[ OPEN ]------------------------------------------
#
includes/topic_review.php
#
#-----[ FIND ]------------------------------------------
#
//
// Go ahead and pull all data for this topic
//
$sql = "SELECT u.username, u.user_id, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
AND p.post_id = pt.post_id
ORDER BY p.post_time DESC
LIMIT " . $board_config['posts_per_page'];
#
#-----[ REPLACE WITH ]------------------------------------------
#
//
// Go ahead and pull all data for this topic
//
$sql = "SELECT u.username, u.user_id, u.user_level, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
AND p.post_id = pt.post_id
ORDER BY p.post_time DESC
LIMIT " . $board_config['posts_per_page'];
#
#-----[ FIND ]------------------------------------------
#
//
// Okay, let's do the loop, yeah come on baby let's do the loop
// and it goes like this ...
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
$user_id = $userdata['user_id'];
#
#-----[ FIND ]------------------------------------------
#
$poster_id = $row['user_id'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
if ( $user_id != ANONYMOUS )
{
$sql = "SELECT user_ignore
FROM " . IGNORE_TABLE . "
WHERE user_id = $user_id
AND user_ignore = $poster_id";
if( !$res = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not get data from ignore table', __LINE__, __FILE__, $sql);
}
}
if(($db->sql_numrows($res) == 0) || ($user_id == ANONYMOUS) || ($row['user_level'] == ADMIN) || ($row['user_level'] == MOD))
{
#
#-----[ FIND ]------------------------------------------
#
}
while ( $row = $db->sql_fetchrow($result) );
#
#-----[ BEFORE, ADD ]------------------------------------------
#
}
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
#
#-----[ AFTER, ADD ]------------------------------------------
#
if ( !isset($bypass) )
{
$post_bypass = 0;
}
else
{
$post_bypass = $bypass;
}
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
WHERE p.topic_id = $topic_id
$limit_posts_time
AND pt.post_id = p.post_id
AND u.user_id = p.poster_id
ORDER BY p.post_time $post_time_order
LIMIT $start, ".$board_config['posts_per_page'];
#
#-----[ REPLACE WITH ]------------------------------------------
#
$sql = "SELECT u.username, u.user_id, u.user_level, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
WHERE p.topic_id = $topic_id
$limit_posts_time
AND pt.post_id = p.post_id
AND u.user_id = p.poster_id
ORDER BY p.post_time $post_time_order
LIMIT $start, ".$board_config['posts_per_page'];
#
#-----[ FIND ]------------------------------------------
#
for($i = 0; $i < $total_posts; $i++)
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$user_id = $userdata['user_id'];
$counter = 0;
#
#-----[ FIND ]------------------------------------------
#
$poster_id = $postrow[$i]['user_id'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
if ( $user_id != ANONYMOUS )
{
$sql = "SELECT user_ignore
FROM " . IGNORE_TABLE . "
WHERE user_id = $user_id
AND user_ignore = $poster_id";
if( !$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not get data from ignore table', __LINE__, __FILE__, $sql);
}
$post_ignored = $db->sql_numrows($result);
}
else
{
$post_ignored = 0;
}
$counter++;
#
#-----[ FIND ]------------------------------------------
#
$poster = ( $poster_id == ANONYMOUS ) ? $lang['Guest'] : $postrow[$i]['username'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
if (( $post_ignored > 0 ) && ( $poster_id != ANONYMOUS ) && ( $post_bypass != $postrow[$i]['post_id'] ) && ($postrow[$i]['user_level'] != ADMIN) && ($postrow[$i]['user_level'] != MOD))
{
$post_date = create_date($board_config['default_dateformat'], $postrow[$i]['post_time'], $board_config['board_timezone']);
//
// Define the little post icon
//
if ( $userdata['session_logged_in'] && $postrow[$i]['post_time'] > $userdata['user_lastvisit'] && $postrow[$i]['post_time'] > $topic_last_read )
{
$mini_post_img = $images['icon_minipost_new'];
$mini_post_alt = $lang['New_post'];
}
else
{
$mini_post_img = $images['icon_minipost'];
$mini_post_alt = $lang['Post'];
}
$message = $lang['Post_user_ignored'] . ' ' . sprintf($lang['Click_view_ignore'], '<a href="' . append_sid("viewtopic.$phpEx?p=" . $postrow[$i]['post_id'] . "&bypass=" . $postrow[$i]['post_id'] . "#" . $postrow[$i]['post_id']) . '">', '</a>');
$ignore = '';
$poster_rank = '';
$rank_image = '';
$poster_joined = '';
$poster_posts = '';
$poster_from = '';
$poster_avatar = '';
$poster_member = '';
$post_subject = '';
$user_sig = '';
$l_edited_by = '';
$mini_post_img = '';
$search_img = '';
$search = '';
$edit_img = '';
$edit = '';
$quote_img = '';
$quote = '';
$ip_img = '';
$ip = '';
$delpost_img = '';
$delpost = '';
$profile_img = '';
$profile = '';
$pm_img = '';
$pm = '';
$email_img = '';
$email = '';
$www_img = '';
$www = '';
$icq_status_img = '';
$icq_img = '';
$icq = '';
$aim_img = '';
$aim = '';
$msn_img = '';
$msn = '';
$yim_img = '';
$yim = '';
}
else
{
#
#-----[ FIND ]------------------------------------------
#
$temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$poster_id");
$profile_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" border="0" /></a>';
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$temp_url = append_sid("ignore.$phpEx?mode=add&username=$poster&topic=$topic_id");
$ignore = '<a href="' . $temp_url . '"><img src="' . $images['icon_ignore'] . '" alt="' . $lang['Ignore_add'] . '" title="' . $lang['Ignore_add'] . '" border="0" /></a>';
#
#-----[ FIND ]------------------------------------------
#
}
else
{
$profile_img = '';
$profile = '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$ignore = '';
#
#-----[ FIND ]------------------------------------------
#
else
{
$l_edited_by = '';
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
}
#
#-----[ FIND ]------------------------------------------
#
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
#
#-----[ REPLACE WITH ]------------------------------------------
#
$row_color = ( !($counter % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($counter % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
#
#-----[ FIND ]------------------------------------------
#
'MINI_POST_IMG' => $mini_post_img,
'PROFILE_IMG' => $profile_img,
'PROFILE' => $profile,
#
#-----[ AFTER, ADD ]------------------------------------------
#
'IGNORE' => $ignore,
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<td valign="top" align="right" nowrap="nowrap">{postrow.QUOTE_IMG} {postrow.EDIT_IMG} {postrow.DELETE_IMG} {postrow.IP_IMG}</td>
#
#-----[ REPLACE WITH ]------------------------------------------
#
<td valign="top" align="right" nowrap="nowrap">{postrow.IGNORE} {postrow.QUOTE_IMG} {postrow.EDIT_IMG} {postrow.DELETE_IMG} {postrow.IP_IMG}</td>
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/subSilver.cfg
#
#-----[ FIND ]------------------------------------------
#
$images['icon_latest_reply'] = "$current_template_images/icon_latest_reply.gif";
$images['icon_newest_reply'] = "$current_template_images/icon_newest_reply.gif";
#
#-----[ AFTER, ADD ]------------------------------------------
#
$images['icon_ignore'] = "$current_template_images/{LANG}/icon_ignore.gif";
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM