Quote:
Originally Posted by g-force2k2
I don't know why the calculation doesn't exactly work, but see the information on this [ POST ] for a possible fix. I don't know why it's creating this error, if someone could help me in any way I would appreciate it.
Regards,
g-force2k2
|
Well, in the install you might want to update your code to include the table prefixes:
Code:
function update_phrasegroups ( $phrasegroup, $languageid=1 )
{
global $DB_site ;
$getid = $DB_site->query_first ( "SELECT phrasetypeid FROM " . TABLE_PREFIX . "phrasetype WHERE fieldname='$phrasegroup'" ) ;
$phrasetypeid = $getid['phrasetypeid'] ;
$phrases = $DB_site->query ( "SELECT varname AS v, text AS t FROM " . TABLE_PREFIX . "phrase WHERE phrasetypeid=" . $phrasetypeid . " ORDER BY varname" ) ;
while ( $phrase = $DB_site->fetch_array ( $phrases ) ) :
$parray[$phrase['v']] = preg_replace( '/\{([0-9])+\}/siU', '%\\1$s', $phrase['t'] ) ;
endwhile ;
$DB_site->query ( "UPDATE " . TABLE_PREFIX . "language SET phrasegroup_$phrasegroup='" . addslashes ( serialize ( $parray ) ) . "' WHERE languageid=$languageid" ) ;
}
As I got an install error as I'm using table prefixes.
I also had to adjust the member.php bit to include table prefixes, and performed the same addition of an ORDER BY to set the right one at the top:
Code:
$show[useractiveness] = 0 ;
if ( $userinfo[posts] ) :
$forumids = implode ( "', '", get_noaccess_forumids ( ) ) ;
$tfarray = $DB_site->query_first ( "SELECT COUNT(*) AS aposts," . TABLE_PREFIX . "forum.title AS aftitle, " . TABLE_PREFIX . "thread.forumid AS aforumid
FROM " . TABLE_PREFIX . "thread
LEFT JOIN " . TABLE_PREFIX . "post ON " . TABLE_PREFIX . "post.threadid = " . TABLE_PREFIX . "thread.threadid
LEFT JOIN " . TABLE_PREFIX . "forum ON " . TABLE_PREFIX . "forum.forumid = " . TABLE_PREFIX . "thread.forumid
LEFT JOIN " . TABLE_PREFIX . "deletionlog ON ( " . TABLE_PREFIX . "deletionlog.primaryid = " . TABLE_PREFIX . "thread.threadid AND type = 'thread' )
WHERE " . TABLE_PREFIX . "forum.forumid NOT IN ( '$forumids' )
AND " . TABLE_PREFIX . "thread.visible=1
AND " . TABLE_PREFIX . "deletionlog.primaryid IS NULL
AND " . TABLE_PREFIX . "post.userid = $userinfo[userid]
GROUP BY " . TABLE_PREFIX . "forum.forumid ORDER BY 1 DESC LIMIT 1" ) ;
$_activeposts = $tfarray['aposts'] ;
$_activeurl = "<a href=\"forumdisplay.php?$session[sessionurl]f=" . $tfarray['aforumid'] . "\">" . $tfarray['aftitle'] . "</a>" ;
$_activeperc = round ( ( ( $_activeposts / $userinfo['posts'] ) * 100 ), 2 ) . "%" ;
$show[useractiveness] = 1 ;
endif ;
As regards the math for the percentile... it's fine
For the sum shown in the earlier post, it did correctly return 38.42%
But it looks like that user has lost a value for the $userinfo['posts'] var... because that value is a direct $_activeposts * 100 rounded sum. So either put in or remove the quotes around 'posts' to see what happens
That should see you fine.