[BETA] Medal System MOD [ Latest: 0.4.6 ]

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
burnthome
Registered User
Posts: 144
Joined: Thu Jan 08, 2004 9:13 am
Contact:

Post by burnthome »

hi,
i have found that admin/moderator cannot delete user medals...do you have any solution?
Kinsman
Registered User
Posts: 207
Joined: Sun Jan 02, 2005 6:04 am
Contact:

Post by Kinsman »

probably the known htmlspecial characyer bug, in the very first post would be my guess! :P
ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Post by ycl6 »

Kinsman wrote: probably the known htmlspecial characyer bug, in the very first post would be my guess! :P

Yes it is :wink:

~Mac
Kinsman
Registered User
Posts: 207
Joined: Sun Jan 02, 2005 6:04 am
Contact:

Post by Kinsman »

hey mac, great to see you back! :D hows it all going?

i have used this thread to its full extent, all my code seems ok now, but i still cant see any medals in viewtopic, everything else works a treat, great mod! :lol:

any ideas on getting the medals to show up in view topic :?:
xtheprophetx
Registered User
Posts: 12
Joined: Sat Jan 01, 2005 11:16 pm

Post by xtheprophetx »

DOH! I skim through all the posts in this thread....233+ of them....and I don't revisit the very first one =[

Ok, the user medal removal thing is no longer a problem I'm having :roll:

Thanks
ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Post by ycl6 »

Kinsman wrote: any ideas on getting the medals to show up in view topic :?:

You set up the col and row number in acp?

~Mac
Kinsman
Registered User
Posts: 207
Joined: Sun Jan 02, 2005 6:04 am
Contact:

Post by Kinsman »

yep set to 3x3 and my medal images are 60 x 25, you can see them here at www.junglewraiths.net/medals
MrDSL
Registered User
Posts: 283
Joined: Thu Jul 15, 2004 1:52 am
Contact:

Post by MrDSL »

The problem I have with the mod is when viewing medals in the topics section everyone has all the same medals. Its really weird it just displays all assigned medals images for every user. It displays the images in the profile section just fine though.

Anyone else experience this or know a fix?
Kinsman
Registered User
Posts: 207
Joined: Sun Jan 02, 2005 6:04 am
Contact:

Post by Kinsman »

hey, at least you see your!, you dont have display random medal ticked do you? :wink:
MrDSL
Registered User
Posts: 283
Joined: Thu Jul 15, 2004 1:52 am
Contact:

Post by MrDSL »

Well display random should only randomly display that users medals. Mine will display all medal images for everyone even if they haven't been assigned that medal.

So if your looking at a topic and user1 and user2 reply. Lets say user1 has 3 medals and user2 has zero medals. In the topics section both will display the exact same medals even when user2 isn't suppose to have any.

It displays correctly in the profile section so I assume it must be the code. This is the code I am using for the topics section

Code: Select all

	$medal ='';
	$sql = "SELECT m.medal_id, m.medal_name, m.medal_image
		FROM " . MEDAL_TABLE . " m, " . MEDAL_USER_TABLE . " mu
		WHERE mu.user_id = '" . $view_userdata['user_id'] . "'
		AND m.medal_id = mu.medal_id
		ORDER BY m.medal_name";
	
	if(!$result = $db->sql_query($sql))
		message_die(GENERAL_ERROR, "Error getting medal information", "", __LINE__, __FILE__, $sql);
		
	$medal_list = $db->sql_fetchrowset($result);
	$medal_count = count($medal_list);

	if ( $view_userdata['user_id'] == ANONYMOUS )
	{
		$medal_count = '';
	} 
	else
	{
		$txt .= ($medal_count) ? $lang['Medals'] . ': <a href="profile.php?mode=viewprofile&u=' . $view_userdata['user_id'] .'#medal" class="gensmall">' . $medal_count . '</a>' . ' (<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $view_userdata['user_id']) .'#medal" class="gensmall">' . $lang['View_More'] . '</a>)' : $lang['Medals'] . ': ' . $lang['None'];
        
	}
	if ( $board_config['allow_medal_dispaly'] )
	{
		$order = ( $board_config['medal_display_order'] ) ? "RAND()" : "m.medal_name";

		$template->assign_block_vars('medal', array());

		$sql = "SELECT m.medal_id, m.medal_name, m.medal_image
			FROM " . MEDAL_TABLE . " m, " . MEDAL_USER_TABLE . " mu
			WHERE mu.user_id = '" . $view_userdata['user_id'] . "'
			AND m.medal_id = mu.medal_id
			ORDER BY " . $order;
	
		if ($result = $db->sql_query($sql))
		{
			$rowset = array();

			while ($row = $db->sql_fetchrow($result))
			{
				$rowset[$row['medal_image']]['medal_name'] = $row['medal_name'];
				if ($rowset[$row['medal_image']]['medal_name'] == $row['medal_name'])
				$rowset[$row['medal_image']]['medal_count'] += 1;
			}

			// Check Medal config in ACP
			$medal_rows = $board_config['medal_display_row'];
			$medal_cols = $board_config['medal_display_col'];
			$medal_width = ( $board_config['medal_display_width'] ) ? 'width="'.$board_config['medal_display_width'].'"' : '';
			$medal_height = ( $board_config['medal_display_height'] ) ? 'height="'.$board_config['medal_display_height'].'"' : '';
	
			if ($medal_list)
			{
				$split_row = $medal_cols - 1;

				$s_colspan = 0;
				$row = 0;
				$col = 0;

				while (list($medal_image, $medal) = @each($rowset))
				{
					if (!$col)
			       		{ 
						$template->assign_block_vars('medal.medal_row', array()); 
					}

					$template->assign_block_vars('medal.medal_row.medal_col', array(
						'MEDAL_IMAGE' => $phpbb_root_path . $medal_image,
						'MEDAL_WIDTH' => $medal_width,
						'MEDAL_HEIGHT' => $medal_height,
						'MEDAL_NAME' => $medal['medal_name'],
						'MEDAL_COUNT' => '('. $lang['Medal_amount'] . $medal['medal_count']. ')')
					);

					$s_colspan = max($s_colspan, $col + 1);

					if ($col == $split_row)
					{
						if ($row == $medal_rows - 1) { break; }
						$col = 0;
						$row++;
					}
					else { $col++; }
				}
			}
		}
xtheprophetx
Registered User
Posts: 12
Joined: Sat Jan 01, 2005 11:16 pm

Post by xtheprophetx »

No idea about the random image issue, but perhaps the reason that Kinsman and I can't get the images to show at all in our viewtopic is somewhere in this section:


$template->assign_block_vars('postrow', array(
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'POSTER_NAME' => $poster,
'POSTER_RANK' => $poster_rank,
'RANK_IMAGE' => $rank_image,
'POSTER_JOINED' => $poster_joined,
'POSTER_POSTS' => $poster_posts,
'POSTER_FROM' => $poster_from,
'POSTER_AVATAR' => $poster_avatar,
'POSTER_MEDAL_COUNT' => $medal_count, // Medal MOD

'POST_NUMBER' => ($i + $start + 1),
'POST_DATE' => $post_date,
'POST_SUBJECT' => $post_subject,



What I'm thinking is that there is suppose to be a
'POSTER_MEDAL_IMAGE' => #medal_image

or something in there.

Thoughts? MrDSL, does yours have something after hte POSTER_MEDAL_COUNT line?
MrDSL
Registered User
Posts: 283
Joined: Thu Jul 15, 2004 1:52 am
Contact:

Post by MrDSL »

The only thing added to the postrow is

Code: Select all

'POSTER_MEDAL_COUNT' => $medal_count,	// Medal MOD
To make it display is

Code: Select all

<br />{postrow.POSTER_MEDAL_COUNT}<br />
		<!-- BEGIN medal -->
		<table border="0" cellspacing="0" cellpadding="5">
		<!-- BEGIN medal_row -->
		<tr align="left" valign="middle"> 
		  <!-- BEGIN medal_col -->
		  <td><img src="{postrow.medal.medal_row.medal_col.MEDAL_IMAGE}" border="0" alt="{postrow.medal.medal_row.medal_col.MEDAL_NAME} {postrow.medal.medal_row.medal_col.MEDAL_COUNT}" title="{postrow.medal.medal_row.medal_col.MEDAL_NAME} {postrow.medal.medal_row.medal_col.MEDAL_COUNT}" {postrow.medal.medal_row.medal_col.MEDAL_WIDTH} {postrow.medal.medal_row.medal_col.MEDAL_HEIGHT} /></td>
		  <!-- END medal_col -->
		</tr>
		<!-- END medal_row -->
		</table>
		<!-- END medal -->
		</span><br /></td>

No clue
MrDSL
Registered User
Posts: 283
Joined: Thu Jul 15, 2004 1:52 am
Contact:

Post by MrDSL »

I decided to move up to version 2.2.2 and now when I display the images in viewtopic it adds each image onto each post.

So say 5 people replied to a topic and they all have 1 medal assigned to them..

The first post will be correct.
The second post will have the person above thems image and then theirs.
The third person will have the 2 ppl above thems post and then theres and so on..
Kinsman
Registered User
Posts: 207
Joined: Sun Jan 02, 2005 6:04 am
Contact:

Post by Kinsman »

mmm, well i have that code for display in my viewtopicbody.tpl

my thoughts are that its not "really" turned on in the ACP even though it sez it is.

im suspecting this becuase i had a few problems with the sql query being entered as show medal DISPALY. and couldnt make up my mind if it should be DISPLAY or not?

but when i etered it as DISPLAY i couldnt get the setting to stay on, so changed it back! :D
skylerjer
Registered User
Posts: 47
Joined: Mon Mar 15, 2004 8:36 am

Post by skylerjer »

I too am having the problem with the medals not showing up in viewtopic. I am getting the medal count and whatnot, but not the images of the metals themselves, despite having selected the correct options in admin control panel. Anybody know if switching to an older version takes care of this particular problem?
Post Reply

Return to “[2.0.x] MODs in Development”