[erledigt] Topiccount in Miniprofil
Verfasst: 02.06.2007 20:48
Kann man diesen MOD auch so mit weiterentwickeln das es im Mini Profile auch angezeigt wird?
phpBB.de - Die deutsche phpBB-Community
https://www.phpbb.de/community/
Code: Alles auswählen
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_miniprofile.php
#
#-----[ FIND ]------------------------------------------
#
//
// Generate page
//
$gen_simple_header = TRUE;
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$sql = "SELECT COUNT(topic_id) AS topics
FROM ". TOPICS_TABLE ."
WHERE topic_poster = '". $profiledata['user_id'] ."'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not count topics", '', __LINE__, __FILE__, $sql);
}
$topics = $db->sql_fetchrow($result);
$poster_topics = ( $topics['topics'] == 0 ) ? $lang['None'] : $topics['topics'];
$regdate = $profiledata['user_regdate'];
$memberdays = max(1, round( ( time() - $regdate ) / 86400 ));
$topics_per_day = $topics['topics'] / $memberdays;
if ( $topics['topics'] != 0 )
{
$total_topics = get_db_stat('topiccount');
$topic_perc = ( $total_topics ) ? min(100, ($topics['topics'] / $total_topics) * 100) : 0;
}
else
{
$topic_perc = 0;
}
#
#-----[ FIND ]------------------------------------------
#
'POSTS' => $profiledata['user_posts'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_TOTAL_TOPICS' => $lang['Total_topics'],
'TOPIC_PERC' => $topic_perc . '%',
'TOPICS' => $poster_topics,
'TOPICS_DAY_STATS' => sprintf($lang['User_topic_day_stats'], $topics_per_day),
'TOPICS_PERCENT_STATS' => sprintf($lang['User_topic_pct_stats'], $topic_perc),
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_view_mini.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td valign="top" nowrap="nowrap"><span class="gen">{L_TOTAL_POSTS}:</span></td>
<td valign="top"><b><span class="gen">{POSTS}</span></b><br /><span class="genmed"><a href="{U_SEARCH_USER}" class="genmed" onclick="jump_to_allposts();return false;" target="_new">{L_SEARCH_USER_POSTS}</a></span></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_TOTAL_TOPICS}: </span></td>
<td valign="top"><b><span class="gen">{TOPICS}</span></b><br /><span class="genmed">[{TOPICS_PERCENT_STATS} / {TOPICS_DAY_STATS}]</span></td>
</tr>
Code: Alles auswählen
$topics_per_day = $topics['topics'] / $memberdays;
Code: Alles auswählen
$regdate = $profiledata['user_regdate'];
$memberdays = max(1, round( ( time() - $regdate ) / 86400 ));
das steht in dieser Datei schon drin, schau dir am besten beide an.cbrkiter hat geschrieben:Es war doch noch ein Fehler enthalten. Der dürfte aber nichts mit Deinem Problem zu tun haben. Suche in der usercp_miniprofile.php die ZeileDavor füge noch folgendes ein:Code: Alles auswählen
$topics_per_day = $topics['topics'] / $memberdays;
Code: Alles auswählen
$regdate = $profiledata['user_regdate']; $memberdays = max(1, round( ( time() - $regdate ) / 86400 ));
danke nochmal, habe den fehler gefunden, habe sie ins root verzeichnis gepackt und im includes war immernoch die altecbrkiter hat geschrieben:Ich habe Deine Dateien eben mit meinen verglichen und ich finde keinen wirklichen Unterschied. Bist Du Dir sicher, dass Du die usercp_miniprofile.php nach der Aktulisierung auch in das Verzeichnis /includes hochgeladen hast? Bevor Du meine letzte Änderung übernommen hast, hättest Du nämlich zumindest ein paar Fehlerzeilen angezeigt bekkommen müssen, da zuvor eine Division durch 0 enthalten war. Dies wurde lediglich durch meine letzte Änderung behoben. Mich wundert es derzeit, dass Du vorher nichts von der Fehlermeldung schriebst und vor allem wundert es mich, dass die Sprachvariable $lang['Total_topics'] nicht ins template übernommen wird. Und dies müsste mindestens sein, selbst wenn bei den anderen Variablen aufgrund von fehlerhaften Operationen Nullwerte enthalten wären. Wenn ich mir in Deinem Forum ein Profil anschaue, dann ist die Sprachvariable auf jeden Fall definiert.
Lade also bitte einfach nochmal die usercp_miniprofile.php in dein Verzeichnis /includes..