Page 1 of 1

Whats wrong with this code?

PostPosted: Wed Feb 21, 2007 8:51 pm
Author: Pogue Moran
this somewhat with my phpbbplus board with PCP but am having problems getting this to work on IM 141. For some reason my def_userfuncs_custom.php code isn't working right and when I go to alter page display the page goes blank.

Here is the code:

Code: Select all
//----------------------------------- // // user_repprof output function // //----------------------------------- function pcp_output_repprof($field_name, $view_userdata, $map_name='') {    global $board_config, $phpbb_root_path, $phpEx, $lang, $images, $userdata, $db;    global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields;      $img = '';    $res = '';    $txt = '';    $img = get_reputation_medals($view_userdata['user_reputation']) . " <br><span>(<a>" . $lang['Votes'] . "</a>: " . $row_rep['count_reps'] . ")</span>";       // result       $res = pcp_output_format($field_name, $txt, $img, $map_name);        return $res; }


def_userfields.php

Code: Select all
     'user_repprof' => array(             'lang_key'     => 'Reputation',             'class'        => 'generic',             'type'         => 'VARCHAR',             'dsp_func'     => 'pcp_output_repprof',          ),  


Attached also is the install instructions for the original mod.

Re: Whats wrong with this code?

PostPosted: Wed Feb 28, 2007 11:21 pm
Author: Teelk
You'll pretty much have to incorporate the entire viewtopic.php/usercp_viewprofile.php code into the function.

This part specifically...
Code: Select all
    // START ADD Reputation Mod v.1.0.0     $reputation = '';     if ($postrow[$i]['user_id'] != ANONYMOUS)     {         if ($rep_config['rep_disable'] == 0)         {             if ($postrow[$i]['user_reputation'] == 0)             {                 $reputation = $lang['Zero_reputation'];             } else             {                 if ($rep_config['graphic_version'] == 0)                 {                     // Text version                     $reputation =  $lang['Reputation'] . ": ";                     if ($postrow[$i]['user_reputation'] > 0)                     {                         $reputation .= "<strong><font>" . round($postrow[$i]['user_reputation'],1) . "</font></strong>";                     } else {                         $reputation .= "<strong><font>" . round($postrow[$i]['user_reputation'],1) . "</font></strong>";                     }                     $reputation_add = '';                 } else {                     // Graphic version                     get_reputation_medals($postrow[$i]['user_reputation']);                 }             }             $reputation .=  " <a><img><img></a>";             $sql = "SELECT COUNT(user_id) AS count_reps                     FROM " . REPUTATION_TABLE . " AS r                     WHERE r.user_id = " . $postrow[$i]['user_id'] . "                     GROUP BY user_id";             if ( !($result = $db->sql_query($sql)) )             {                 message_die(GENERAL_ERROR, "Could not obtain reputation stats for this user", '', __LINE__, __FILE__, $sql);             }             $row_rep = $db->sql_fetchrow($result);             if ($row_rep)             {                 $reputation .= "<br><a>" . $lang['Votes'] . "</a>: " . $row_rep['count_reps'];             }         }     }     // END ADD Reputation Mod v.1.0.0


- $postrow[$i] being $view_userdata
- make $rep_config a global
- and $txt = $reputation; or $img = $reputation; Could be one or the other, or you may have to split it up, I'm not sure as I'm not familiar with the inner workings of the MOD.