ติดตั้ง MOD Avatar of poster on Index and Viewforum 1.3.0

แนะนำ Mod ต่างๆ ของ PHPBB3 แนะนำความสามารถ ของ mod การติดตั้ง การเข้ากันได้กับเวอร์ชั่น

Moderator: mindphp

ภาพประจำตัวสมาชิก
modtanoy_pen
PHP Hero Member
PHP Hero Member
โพสต์: 116
ลงทะเบียนเมื่อ: 19/10/2012 4:27 pm

ติดตั้ง MOD Avatar of poster on Index and Viewforum 1.3.0

โพสต์ที่ยังไม่ได้อ่าน โดย modtanoy_pen »

รายละเอียด MOD Avatar of poster on Index and Viewforum 1.3.0
mod ตัวนี้มีไว้สำหรับให้แสดงรูปประจำตัวผู้ที่โพสข้อความล่าสุดในกระทู้ซึ่งจะแสดงหน้าแรกและหัวข้อกระทู้
พัฒนาโดย : ABDev
Version : 1.0.0
phpBB Version(s) : 3.0.11
โหลดไดที่ : https://www.phpbb.com/customise/db/download/id_84732
ไฟล์ภาษาไทย :
language_th.zip
(1.6 KiB) ดาวน์โหลดแล้ว 226 ครั้ง
1.jpg
1.jpg (30.02 KiB) Viewed 2868 times
2.png
2.png (118.04 KiB) Viewed 2868 times
แก้ไขล่าสุดโดย modtanoy_pen เมื่อ 21/12/2012 10:41 am, แก้ไขไปแล้ว 5 ครั้ง.
ภาพประจำตัวสมาชิก
modtanoy_pen
PHP Hero Member
PHP Hero Member
โพสต์: 116
ลงทะเบียนเมื่อ: 19/10/2012 4:27 pm

Re: ติดตั้ง MOD Avatar of poster on Index and Viewforum 1.3.0

โพสต์ที่ยังไม่ได้อ่าน โดย modtanoy_pen »

ตัวอย่างการติดตั้ง

1. Copy: root/images/apiv_logo_small.png
To: images/apiv_logo_small.png
2. Copy: root/language/en/mods/info_acp_apiv.php
To: language/en/mods/info_acp_apiv.php
3. Copy: root/umil/*.*
To: umil/*.*
4. Copy: root/db_update.php
To: db_update.php

Open: includes/acp/acp_board.php
คำค้นหา

โค้ด: เลือกทั้งหมด

break;

			case 'message':
เพิ่มก่อนคำที่ค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
				$this->apiv_config($display_vars);
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
	// borrowed and adapted from "aos who visited a topic" mod
	function apiv_config(&$display_vars)
	{
		global $user;

		for ( $legend = 1; isset($display_vars['vars']['legend' . $legend]); $legend++ )
		{
			$legend;
		}

		$options = array(
			'legend' . $legend => 'APIV',
			'avatar_max_dimensions' => array('lang' => 'APIV_MAX_DIMENSIONS', 'validate' => 'int', 'type' => 'text:7:15', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
			'avatar_forums_last_poster_show' => array('lang' => 'APIV_FORUMS_LAST_POSTER_SHOW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
			'avatar_topics_first_poster_show' => array('lang' => 'APIV_TOPICS_FIRST_POSTER_SHOW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
			'avatar_topics_last_poster_show' => array('lang' => 'APIV_TOPICS_LAST_POSTER_SHOW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),

			'legend' . ($legend + 1) => 'ACP_SUBMIT_CHANGES',
		);

		foreach ( $options as $key => $val )
		{
			$display_vars['vars'][$key] = $val;
		}
		unset($key);
	}
//-- fin mod : apiv ------------------------------------------------------------
ภาพประจำตัวสมาชิก
modtanoy_pen
PHP Hero Member
PHP Hero Member
โพสต์: 116
ลงทะเบียนเมื่อ: 19/10/2012 4:27 pm

Re: ติดตั้ง MOD Avatar of poster on Index and Viewforum 1.3.0

โพสต์ที่ยังไม่ได้อ่าน โดย modtanoy_pen »

Open: includes/acp/acp_users.php
คำค้นหา

โค้ด: เลือกทั้งหมด

avatar_delete('user', $user_row);
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
								user_update_avatar($user_row['user_id'], '', 0, 0, 0);
//-- fin mod : apiv ------------------------------------------------------------
Open: includes/mcp/mcp_post.php
คำค้นหา

โค้ด: เลือกทั้งหมด

sync('topic', 'topic_id', $post_info['topic_id'], false, false);
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
		$avatar_info = '';
		if ( !empty($userdata['user_avatar']) )
		{
			$avatar_info = serialize(array(
				'avatar' => $userdata['user_avatar'],
				'type' => (int) $userdata['user_avatar_type'],
				'width' => (int) $userdata['user_avatar_width'],
				'height' => (int) $userdata['user_avatar_height'],
			));
		}

		if ( $post_info['topic_last_post_id'] == $post_id )
		{
			$sql = 'UPDATE ' . TOPICS_TABLE . '
				SET topic_last_poster_avatar = \'' . $db->sql_escape($avatar_info) . '\'
				WHERE topic_last_poster_id = ' . (int) $post_info['user_id'];
			$db->sql_query($sql);
		}

		if ( $post_info['forum_last_post_id'] == $post_id )
		{
			$sql = 'UPDATE ' . FORUMS_TABLE . '
				SET forum_last_poster_avatar = \'' . $db->sql_escape($avatar_info) . '\'
				WHERE forum_last_poster_id = ' . (int) $post_info['user_id'];
			$db->sql_query($sql);
		}

		if ( $post_info['topic_first_post_id'] == $post_id )
		{
			$sql = 'UPDATE ' . TOPICS_TABLE . '
				SET topic_first_poster_avatar = \'' . $db->sql_escape($avatar_info) . '\'
				WHERE topic_poster = ' . (int) $post_info['user_id'];
			$db->sql_query($sql);
		}
//-- fin mod : apiv ------------------------------------------------------------
ภาพประจำตัวสมาชิก
modtanoy_pen
PHP Hero Member
PHP Hero Member
โพสต์: 116
ลงทะเบียนเมื่อ: 19/10/2012 4:27 pm

Re: ติดตั้ง MOD Avatar of poster on Index and Viewforum 1.3.0

โพสต์ที่ยังไม่ได้อ่าน โดย modtanoy_pen »

Open: includes/functions_admin.php
คำค้นหา

โค้ด: เลือกทั้งหมด

}
			$db->sql_freeresult($result);

			if (!sizeof($forum_ids))
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
				$forum_data[$forum_id]['last_poster_avatar'] = '';
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$result = $db->sql_query($sql);

				while ($row = $db->sql_fetchrow($result))
				{
					$post_info[$row['post_id']] = $row;
				}
				$db->sql_freeresult($result);
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
				$sql = str_replace('SELECT ', 'SELECT u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, ', $sql);
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$forum_data[$forum_id]['last_poster_colour'] = $post_info[$data['last_post_id']]['user_colour'];
เพิ่มหลังคำที่ค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
							$forum_data[$forum_id]['last_poster_avatar'] = serialize(array(
								'avatar' => $post_info[$data['last_post_id']]['user_avatar'],
								'type' => $post_info[$data['last_post_id']]['user_avatar_type'],
								'width' => $post_info[$data['last_post_id']]['user_avatar_width'],
								'height' => $post_info[$data['last_post_id']]['user_avatar_height'],
							));
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$forum_data[$forum_id]['last_poster_colour'] = '';
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
							$forum_data[$forum_id]['last_poster_avatar'] = '';
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

// 6: Now do that thing
			$fieldnames = array(
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
			$fieldnames += array('last_poster_avatar');
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

if (preg_match('#(name|colour|subject)$#', $fieldname))
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
// here we added
//	|avatar
//-- modify
คำค้นหา
subject
เพิ่มในบันทัดหลังจากคำค้นหา เพิ่มบรรทัดนี้หลังจากบันทัดก่อน

โค้ด: เลือกทั้งหมด

//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$result = $db->sql_query($sql);

			while ($row = $db->sql_fetchrow($result))
			{
				if ($row['topic_moved_id'])
เพิ่มก่อนคำที่ค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
			$sql = str_replace('SELECT ', 'SELECT t.topic_first_poster_avatar, t.topic_last_poster_avatar, ', $sql);
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$result = $db->sql_query($sql);

			$post_ids = array();
			while ($row = $db->sql_fetchrow($result))
เพิ่มก่อนคำที่ค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
			$sql = str_replace('SELECT ', 'SELECT u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, ', $sql);
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$topic_data[$topic_id]['first_poster_colour'] = $row['user_colour'];
เพิ่มหลังคำที่ค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
					$topic_data[$topic_id]['first_poster_avatar'] = serialize(array(
						'avatar' => $row['user_avatar'],
						'type' => $row['user_avatar_type'],
						'width' => $row['user_avatar_width'],
						'height' => $row['user_avatar_height'],
					));
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$topic_data[$topic_id]['last_poster_colour'] = $row['user_colour'];
เพิ่มหลังคำที่ค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
					$topic_data[$topic_id]['last_poster_avatar'] = serialize(array(
						'avatar' => $row['user_avatar'],
						'type' => $row['user_avatar_type'],
						'width' => $row['user_avatar_width'],
						'height' => $row['user_avatar_height'],
					));
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$result = $db->sql_query($sql);

					$post_ids = array();
					while ($row = $db->sql_fetchrow($result))
เพิ่ทก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
					$sql = str_replace('SELECT ', 'SELECT u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, ', $sql);
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$sync_shadow_topics[$orig_topic_id]['topic_first_poster_colour'] = $row['user_colour'];
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
								$sync_shadow_topics[$orig_topic_id]['topic_first_poster_avatar'] = serialize(array(
									'avatar' => $row['user_avatar'],
									'type' => $row['user_avatar_type'],
									'width' => $row['user_avatar_width'],
									'height' => $row['user_avatar_height'],
								));
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$sync_shadow_topics[$orig_topic_id]['topic_last_poster_colour'] = $row['user_colour'];
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
								$sync_shadow_topics[$orig_topic_id]['topic_last_poster_avatar'] = serialize(array(
									'avatar' => $row['user_avatar'],
									'type' => $row['user_avatar_type'],
									'width' => $row['user_avatar_width'],
									'height' => $row['user_avatar_height'],
								));
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

// These are fields that will be synchronised
			$fieldnames = array(
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
			$fieldnames += array('first_poster_avatar', 'last_poster_avatar');
//-- fin mod : apiv ------------------------------------------------------------
ภาพประจำตัวสมาชิก
modtanoy_pen
PHP Hero Member
PHP Hero Member
โพสต์: 116
ลงทะเบียนเมื่อ: 19/10/2012 4:27 pm

Re: ติดตั้ง MOD Avatar of poster on Index and Viewforum 1.3.0

โพสต์ที่ยังไม่ได้อ่าน โดย modtanoy_pen »

Open: includes/functions_display.php
คำค้นหา

โค้ด: เลือกทั้งหมด

$forum_rows[$parent_id]['forum_last_poster_colour'] = $row['forum_last_poster_colour'];
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
				$forum_rows[$parent_id]['forum_last_poster_avatar'] = $row['forum_last_poster_avatar'];
//-- fin mod : apiv ------------------------------------------------------------
คำค้้นหา

โค้ด: เลือกทั้งหมด

// Assign subforums loop for style authors
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
		user_display_avatar($row, 'forum_last', 'forumrow', $config['avatar_forums_last_poster_show']);
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

if ($return_moderators)
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
	if ( $config['avatar_forums_last_poster_show'] )
	{
		$template->assign_var('AVATAR_MAX_DIMENSIONS', $config['avatar_max_dimensions']);
	}
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
function user_display_avatar($row, $prefix = '', $tpl_switch, $display)
{
	if ( !$display || empty($row[$prefix . '_poster_avatar']) )
	{
		return;
	}

	global $config, $template;

	$avatar = unserialize($row[$prefix . '_poster_avatar']);
	if ( $avatar['width'] >= $avatar['height'] )
	{
		$avatar_width = ($avatar['width'] > $config['avatar_max_dimensions']) ? $config['avatar_max_dimensions'] : $avatar['width'];
		$avatar_height = ($avatar_width == $config['avatar_max_dimensions']) ? round($config['avatar_max_dimensions'] / $avatar['width'] * $avatar['height']) : $avatar['height'];
	}
	else
	{
		$avatar_height = ($avatar['height'] > $config['avatar_max_dimensions']) ? $config['avatar_max_dimensions'] : $avatar['height'];
		$avatar_width = ($avatar_height == $config['avatar_max_dimensions']) ? round($config['avatar_max_dimensions'] / $avatar['height'] * $avatar['width']) : $avatar['width'];
	}

	$template->alter_block_array($tpl_switch, array(
		strtoupper($prefix) . '_POSTER_AVATAR' => get_user_avatar($avatar['avatar'], $avatar['type'], $avatar_width, $avatar_height),
		strtoupper($prefix) . '_POSTER_AVATAR_MARGIN' => ($avatar_width == $config['avatar_max_dimensions']) ? 5 : ($config['avatar_max_dimensions'] - $avatar_width + 5),
	), true, 'change');
}
//-- fin mod : apiv ------------------------------------------------------------
ภาพประจำตัวสมาชิก
modtanoy_pen
PHP Hero Member
PHP Hero Member
โพสต์: 116
ลงทะเบียนเมื่อ: 19/10/2012 4:27 pm

Re: ติดตั้ง MOD Avatar of poster on Index and Viewforum 1.3.0

โพสต์ที่ยังไม่ได้อ่าน โดย modtanoy_pen »

Open: includes/functions_posting.php
คำค้นหา

โค้ด: เลือกทั้งหมด

$update_sql[$forum_id][] = "forum_last_poster_colour = ''";
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
			$update_sql[$forum_id][] = "forum_last_poster_avatar = ''";
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$result = $db->sql_query($sql);

		while ($row = $db->sql_fetchrow($result))
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
		$sql = str_replace('SELECT ', 'SELECT u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, ', $sql);
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

}
		$db->sql_freeresult($result);
	}
	unset($empty_forums, $ids, $last_post_ids);
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
			$avatar_info = serialize(array(
				'avatar' => $row['user_avatar'],
				'type' => (int) $row['user_avatar_type'],
				'width' => (int) $row['user_avatar_width'],
				'height' => (int) $row['user_avatar_height'],
			));

			$update_sql[$row["{$type}_id"]][] = "{$type}_last_poster_avatar = '" . $db->sql_escape($avatar_info) . "'";
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$result = $db->sql_query_limit($sql, 1);
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
			$sql = str_replace('SELECT ', 'SELECT u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, ', $sql);
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

// Decrementing topic_replies here is fine because this case only happens if there is more than one post within the topic - basically removing one "reply"
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
			$avatar_info = serialize(array(
				'avatar' => $row['user_avatar'],
				'type' => (int) $row['user_avatar_type'],
				'width' => (int) $row['user_avatar_width'],
				'height' => (int) $row['user_avatar_height'],
			));

			$sql_data[TOPICS_TABLE] .= ', topic_first_poster_avatar = \'' . $db->sql_escape($avatar_info) . '\'';
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

if (isset($poll['poll_options']) && !empty($poll['poll_options']))
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
			$sql_data[TOPICS_TABLE]['sql'] += array(
				'topic_first_poster_avatar' => serialize(array(
					'avatar' => $user->data['user_avatar'],
					'type' => $user->data['user_avatar_type'],
					'width' => $user->data['user_avatar_width'],
					'height' => $user->data['user_avatar_height'],
				)),
				'topic_last_poster_avatar' => '',
			);
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

}

		unset($sql_data[POSTS_TABLE]['sql']);
	}

	$make_global = false;
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
			$sql_data[TOPICS_TABLE]['sql']['topic_last_poster_avatar'] = serialize(array(
				'avatar' => $user->data['user_avatar'],
				'type' => $user->data['user_avatar_type'],
				'width' => $user->data['user_avatar_width'],
				'height' => $user->data['user_avatar_height'],
			));
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($user->data['user_colour']) . "'";
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
			$avatar_info = serialize(array(
				'avatar' => $user->data['user_avatar'],
				'type' => (int) $user->data['user_avatar_type'],
				'width' => (int) $user->data['user_avatar_width'],
				'height' => (int) $user->data['user_avatar_height'],
			));

			$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_avatar = '" . $db->sql_escape($avatar_info) . "'";
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$result = $db->sql_query($sql);
						$row = $db->sql_fetchrow($result);
						$db->sql_freeresult($result);

						// salvation, a post is found! jam it into the forums table
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
						$sql = str_replace('SELECT ', 'SELECT u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, ', $sql);
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'";
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
						$avatar_info = serialize(array(
							'avatar' => $row['user_avatar'],
							'type' => (int) $row['user_avatar_type'],
							'width' => (int) $row['user_avatar_width'],
							'height' => (int) $row['user_avatar_height'],
						));

						$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_avatar = '" . $db->sql_escape($avatar_info) . "'";
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = ''";
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
						$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_avatar = ''";
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$result = $db->sql_query($sql);
				$row = $db->sql_fetchrow($result);
				$db->sql_freeresult($result);

				// salvation, a post is found! jam it into the forums table
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
				$sql = str_replace('SELECT ', 'SELECT u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, ', $sql);
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'";
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
				$avatar_info = serialize(array(
					'avatar' => $row['user_avatar'],
					'type' => (int) $row['user_avatar_type'],
					'width' => (int) $row['user_avatar_width'],
					'height' => (int) $row['user_avatar_height'],
				));

				$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_avatar = '" . $db->sql_escape($avatar_info) . "'";
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = ''";
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
				$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_avatar = ''";
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$result = $db->sql_query($sql);
			$row = $db->sql_fetchrow($result);
			$db->sql_freeresult($result);

			// salvation, a post is found! jam it into the forums table
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
			$sql = str_replace('SELECT ', 'SELECT u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, ', $sql);
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'";
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
			$avatar_info = serialize(array(
				'avatar' => $row['user_avatar'],
				'type' => (int) $row['user_avatar_type'],
				'width' => (int) $row['user_avatar_width'],
				'height' => (int) $row['user_avatar_height'],
			));

			$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_avatar = '" . $db->sql_escape($avatar_info) . "'";
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_post_time = ' . (int) $current_time;
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
			$avatar_info = serialize(array(
				'avatar' => $user->data['user_avatar'],
				'type' => (int) $user->data['user_avatar_type'],
				'width' => (int) $user->data['user_avatar_width'],
				'height' => (int) $user->data['user_avatar_height'],
			));

			$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_avatar = '" . $db->sql_escape($avatar_info) . "'";
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$result = $db->sql_query($sql);
			$row = $db->sql_fetchrow($result);
			$db->sql_freeresult($result);

			// salvation, a post is found! jam it into the topics table
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
			$sql = str_replace('SELECT ', 'SELECT u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, ', $sql);
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'";
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
			$avatar_info = serialize(array(
				'avatar' => $row['user_avatar'],
				'type' => (int) $row['user_avatar_type'],
				'width' => (int) $row['user_avatar_width'],
				'height' => (int) $row['user_avatar_height'],
			));

			$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_avatar = '" . $db->sql_escape($avatar_info) . "'";
//-- fin mod : apiv ------------------------------------------------------------
ภาพประจำตัวสมาชิก
modtanoy_pen
PHP Hero Member
PHP Hero Member
โพสต์: 116
ลงทะเบียนเมื่อ: 19/10/2012 4:27 pm

Re: ติดตั้ง MOD Avatar of poster on Index and Viewforum 1.3.0

โพสต์ที่ยังไม่ได้อ่าน โดย modtanoy_pen »

Open: includes/functions_user.php
คำค้นหา

โค้ด: เลือกทั้งหมด

/**
* Adds an user
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
function user_update_avatar($user_id, $new_avatar, $new_avatar_type, $new_avatar_width, $new_avatar_height)
{
	global $db;	

	$avatar_info = '';
	if ( !empty($new_avatar) )
	{
		$avatar_info = serialize(array(
			'avatar' => $new_avatar,
			'type' => (int) $new_avatar_type,
			'width' => (int) $new_avatar_width,
			'height' => (int) $new_avatar_height,
		));
	}

	$sql = 'UPDATE ' . FORUMS_TABLE . '
		SET forum_last_poster_avatar = \'' . $db->sql_escape($avatar_info) . '\'
		WHERE forum_last_poster_id = ' . (int) $user_id;
	$db->sql_query($sql);

	$sql = 'UPDATE ' . TOPICS_TABLE . '
		SET topic_first_poster_avatar = \'' . $db->sql_escape($avatar_info) . '\'
		WHERE topic_poster = ' . (int) $user_id;
	$db->sql_query($sql);

	$sql = 'UPDATE ' . TOPICS_TABLE . '
		SET topic_last_poster_avatar = \'' . $db->sql_escape($avatar_info) . '\'
		WHERE topic_last_poster_id = ' . (int) $user_id;
	$db->sql_query($sql);
}
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

avatar_delete('user', $userdata);
					}
				}
เพิ่มหลังคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
				$user_id = ($custom_userdata === false) ? $user->data['user_id'] : $custom_userdata['user_id'];
				user_update_avatar($user_id, $sql_ary['user_avatar'], $sql_ary['user_avatar_type'], $sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']);
//-- fin mod : apiv ------------------------------------------------------------
Open: styles/prosilver/template/forumlist_body.html
คำค้นหา

โค้ด: เลือกทั้งหมด

<dd class="posts">{forumrow.POSTS} <dfn>{L_POSTS}</dfn></dd>
					<dd class="lastpost"><span>
ค้นหาในบรรทัด

โค้ด: เลือกทั้งหมด

<dd class="lastpost">
เพิ่มในบรรทัดหลังคำค้นหาในบรรทัด

โค้ด: เลือกทั้งหมด

<!-- IF forumrow.FORUM_LAST_POSTER_AVATAR --><div style="float: left; padding-top: 0px; margin-left: 5px; margin-right: {forumrow.FORUM_LAST_POSTER_AVATAR_MARGIN}px;">{forumrow.FORUM_LAST_POSTER_AVATAR}</div><!-- ENDIF -->
Open: styles/prosilver/template/viewforum_body.html
คำค้นหา

โค้ด: เลือกทั้งหมด

<!-- IF topicrow.S_UNREAD_TOPIC -->
คำค้นหาในบรรทัด

โค้ด: เลือกทั้งหมด

<!-- IF topicrow.S_UNREAD_TOPIC -->
เพิ่มในบรรทัดก่อนคำค้นหาในบรรทัด

โค้ด: เลือกทั้งหมด

<!-- IF topicrow.TOPIC_FIRST_POSTER_AVATAR --><span style="float: left; padding-top: 3px; margin-right: {topicrow.TOPIC_FIRST_POSTER_AVATAR_MARGIN}px;">{topicrow.TOPIC_FIRST_POSTER_AVATAR}</span><!-- ENDIF -->
คำค้นหา

โค้ด: เลือกทั้งหมด

<dd class="lastpost">
คำค้นหาในบรรทัด

โค้ด: เลือกทั้งหมด

dd class="lastpost">
เพิ่มในบรรทัดหลังคำค้นหาในบรรทัด

โค้ด: เลือกทั้งหมด

<!-- IF topicrow.TOPIC_LAST_POSTER_AVATAR --><div style="float: left; padding-top: 0px; margin-left: 5px; margin-right: {topicrow.TOPIC_LAST_POSTER_AVATAR_MARGIN}px;">{topicrow.TOPIC_LAST_POSTER_AVATAR}</div><!-- ENDIF -->
ภาพประจำตัวสมาชิก
modtanoy_pen
PHP Hero Member
PHP Hero Member
โพสต์: 116
ลงทะเบียนเมื่อ: 19/10/2012 4:27 pm

Re: ติดตั้ง MOD Avatar of poster on Index and Viewforum 1.3.0

โพสต์ที่ยังไม่ได้อ่าน โดย modtanoy_pen »

Open: viewforum.php
คำค้นหา

โค้ด: เลือกทั้งหมด

// Grab icons
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
if ( $config['avatar_topics_first_poster_show'] || $config['avatar_topics_last_poster_show'] )
{
	$template->assign_var('AVATAR_MAX_DIMENSIONS', $config['avatar_max_dimensions']);
}
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา

โค้ด: เลือกทั้งหมด

$s_type_switch = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0;
เพิ่มก่อนคำค้นหา

โค้ด: เลือกทั้งหมด

//-- mod : apiv ----------------------------------------------------------------
//-- add
		user_display_avatar($row, 'topic_first', 'topicrow', $config['avatar_topics_first_poster_show']);
		user_display_avatar($row, 'topic_last', 'topicrow', $config['avatar_topics_last_poster_show']);
//-- fin mod : apiv ------------------------------------------------------------
คำค้นหา
ภาพประจำตัวสมาชิก
modtanoy_pen
PHP Hero Member
PHP Hero Member
โพสต์: 116
ลงทะเบียนเมื่อ: 19/10/2012 4:27 pm

Re: ติดตั้ง MOD Avatar of poster on Index and Viewforum 1.3.0

โพสต์ที่ยังไม่ได้อ่าน โดย modtanoy_pen »

คำแนะนำ
ทำการติดตั้งไฟล์ db_update.php ไปที่เบราว์เซอร์ของคุณพิมพ์ ตัวอย่าง domain.tld/phpBB3/db_update.php
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 65