Here's what I have I don't know how it works with IM 141s version of PCP but this is what worked with the version I have. In your def_userfuncs_custom.php add:
- Code: Select all
function pcp_output_medal_count_viewtopic($field_name, $view_userdata, $map_name='') { global $db, $lang, $phpEx; $res = $img = $txt = ''; // Medal MOD $medal =''; $sql = "SELECT m.medal_id, m.medal_name 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 { $medal_count = ($medal_count) ? $lang['Medals'] . ': <a>' . $medal_count . '</a>' . ' (<a>' . $lang['View_More'] . '</a>)' : $lang['Medals'] . ': ' . $lang['None']; } $txt = $medal_count; $res = pcp_output_format($field_name, $txt, $img, $map_name); return $res; } function pcp_output_medal_list_viewtopic($field_name, $view_userdata, $map_name='') { global $db, $lang, $phpEx, $board_config, $template; $res = $img = $txt = ''; //Medal MOD if ( $board_config['allow_medal_display'] ) { $order = ( $board_config['medal_display_order'] ) ? "RAND()" : "m.medal_name"; $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 (!empty($rowset)) { $split_row = $medal_cols - 1; $s_colspan = 0; $row = 0; $col = 0; $template->set_filenames(array('medal_topic' => 'medal_topic_body.tpl')); $template->assign_block_vars('medal', array()); 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++; } } $db->sql_freeresult($result); ob_start(); $template->pparse('medal_topic'); $txt = ob_get_contents(); ob_end_clean(); $template->_tpldata['medal.'] = ''; $template->_tpldata['medal.medal_row.'] = ''; $template->_tpldata['medal.medal_row.medal_col.'] = ''; } } } $res = pcp_output_format($field_name, $txt, $img, $map_name); return $res; }
In def_usermaps.php:
- Code: Select all
Find viewtopic.leftwherever you want to put the medals and the count put 'medal_count' => array( 'txt' => true, 'style' => '%s', 'dsp_func' => 'pcp_medal_count_viewtopic', ), 'medal_list' => array( 'txt' => true, 'style' => '%s', 'dsp_func' => 'pcp_medal_list_viewtopic', ),
Attached are the files as well for making its own tab for medal display on the public part of the profile. I found it gets too cluttered if you put the medals on the main page. I have members with 8-10 medals a piece so listing them on the main profile would get cluttered.
[url=http]Medals Files[/url]
Also in language/lang_english/lang_extend_pcp_addons.php add the following two entries
- Code: Select all
$lang['profilcp_medals_shortcut'] = 'Medal Case'; $lang['profilcp_medals_pagetitle'] = 'Medals';
I think those are the edits I have
Edited Feb 26th at 11:19 AM EST