Hallo
Schmischi
Mach mal diese Änderung wieder rückgängig (das war nicht optimal gelöst).
Mahony hat geschrieben:
Öffne die includes/functions_user.php
Suche in der includes/functions_user.php
Code: Alles auswählen
function user_delete($mode, $user_id, $post_username = false)
{
global $cache, $config, $db, $user, $auth;
global $phpbb_root_path, $phpEx;
Füge danach ein
Code: Alles auswählen
//Begin Thanks Post MOD
$sql = 'DELETE
FROM ' . THANKS_TABLE . '
WHERE thanks_from = ' . $user_id;
$db->sql_query($sql);
//End Thanks Post MOD
Jetzt folgt die optimale Lösung.
Suche in der includes/functions_user.php
Code: Alles auswählen
function user_delete($mode, $user_id, $post_username = false)
{
global $cache, $config, $db, $user, $auth;
global $phpbb_root_path, $phpEx;
Füge danach ein
Code: Alles auswählen
//Begin Thanks Post MOD
$sql = 'UPDATE ' . THANKS_TABLE . '
SET thanks_from = ' . ANONYMOUS . "
WHERE thanks_from = $user_id";
$db->sql_query($sql);
$sql = 'UPDATE ' . THANKS_TABLE . '
SET thanks_to = ' . ANONYMOUS . "
WHERE thanks_to = $user_id";
$db->sql_query($sql);
//End Thanks Post MOD
Suche
Code: Alles auswählen
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_id = ' . $user_id;
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$user_row)
{
return false;
}
Füge danach ein
Code: Alles auswählen
//Begin Thanks Post MOD
if ($user_row['user_thanked'])
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_thanked = user_thanked + ' . $user_row['user_thanked'] . '
WHERE user_id = ' . ANONYMOUS;
$db->sql_query($sql);
}
if ($user_row['user_thanks'])
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_thanks = user_thanks + ' . $user_row['user_thanks'] . '
WHERE user_id = ' . ANONYMOUS;
$db->sql_query($sql);
}
if ($user_row['user_thanks_post'])
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_thanks_post = user_thanks_post + ' . $user_row['user_thanks_post'] . '
WHERE user_id = ' . ANONYMOUS;
$db->sql_query($sql);
}
//End Thanks Post MOD
Öffne viewtopic.php
Suche nach
Code: Alles auswählen
if ($poster_id == ANONYMOUS)
{
$user_cache[$poster_id] = array(
'joined' => '',
'posts' => '',
'from' => '',
Füge danach ein
Code: Alles auswählen
//Begin Thank Post MOD
'thanks' => (isset($row['user_thanks'])) ? $row['user_thanks'] : '',
'thanked' => (isset($row['user_thanked'])) ? $row['user_thanked'] : '',
'thanks_post' => (isset($row['user_thanks_post'])) ? $row['user_thanks_post'] : '',
//End Thank Post MOD
Suche
Code: Alles auswählen
//Begin Thank Post MOD
'thanks' => $row['user_thanks'],
'thanked' => $row['user_thanked'],
'thanks_post' => $row['user_thanks_post'],
//End Thank Post MOD
Ersetze mit
Code: Alles auswählen
//Begin Thank Post MOD
'thanks' => (isset($row['user_thanks'])) ? $row['user_thanks'] : '',
'thanked' => (isset($row['user_thanked'])) ? $row['user_thanked'] : '',
'thanks_post' => (isset($row['user_thanks_post'])) ? $row['user_thanks_post'] : '',
//End Thank Post MOD
Mit diesen Änderungen sind dann die Probleme mit gelöschten Usern vollständig beseitigt.
Hier noch ein Bugfix, damit sich ein User nicht über die URL bei sich selbst bedanken kann.
Öffne thanks.php
Suche nach
Code: Alles auswählen
$sql = 'SELECT thanks_from
FROM ' . THANKS_TABLE . '
WHERE post_id = ' . $post_id . '
AND thanks_from = ' . $user->data['user_id'];
$result = $db->sql_query($sql);
$thanked_post = $db->sql_fetchfield('thanks_from');
$db->sql_freeresult($result);
Füge danach ein
Code: Alles auswählen
//Begin NEW The user can not thank himself.
$poster_id = $row['poster_id'];
//End NEW The user can not thank himself.
Suche nach
Code: Alles auswählen
switch ($mode)
{
case 'thanks':
if($thanked_post)
{
trigger_error('THANKS_CANT_ADD');
}
Füge danach ein
Code: Alles auswählen
//Begin NEW The user can not thank himself.
if($user->data['user_id'] == $poster_id)
{
trigger_error('THANKS_DISALLOW');
}
//End NEW The user can not thank himself.
Grüße: Mahony