форум vBSupport.ru > vBulletin > vBulletin 3.8.x > Вопросы по vBulletin 3.8
Register Меню vBsupport Изображения Files Manager О рекламе Today's Posts Search
  • Родная гавань
  • Блок РКН снят
  • Premoderation
  • For English speaking users
  • Каталог Фрилансеров
  • If you want to buy some product or script
  • Администраторам
VBsupport перешел с домена .ORG на родной .RU Ура! Пожалуйста, обновите свои закладки - VBsupport.ru
Блок РКН снят, форум доступен на всей территории России, включая новые терртории, без VPN
На форуме введена премодерация ВСЕХ новых пользователей

Почта с временных сервисов, типа mailinator.com, gawab.com и/или прочих, которые предоставляют временный почтовый ящик без регистрации и/или почтовый ящик для рассылки спама, отслеживается и блокируется, а так же заносится в спам-блок форума, аккаунты удаляются
for English speaking users:
You may be surprised with restriction of access to the attachments of the forum. The reason is the recent change in vbsupport.org strategy:

- users with reputation < 10 belong to "simple_users" users' group
- if your reputation > 10 then administrator (kerk, Luvilla) can decide to move you into an "improved" group, but only manually

Main idea is to increase motivation of community members to share their ideas and willingness to support to each other. You may write an article for the subject where you are good enough, you may answer questions, you may share vbulletin.com/org content with vbsupport.org users, receiving "thanks" equal your reputation points. We should not only consume, we should produce something.

- you may:
* increase your reputation (doing something useful for another members of community) and being improved
* purchase temporary access to the improved category:
10 $ for 3 months. - this group can download attachments, reputation/posts do not matter.
20 $ for 3 months. - this group can download attachments, reputation/posts do not matter + adds eliminated + Inbox capacity increased + files manager increased permissions.

Please contact kerk or Luvilla regarding payments.

Important!:
- if your reputation will become less then 0, you will be moved into "simple_users" users' group automatically.*
*for temporary groups (pre-paid for 3 months) reputation/posts do not matter.
Уважаемые пользователи!

На форуме открыт новый раздел "Каталог фрилансеров"

и отдельный раздел для платных заказов "Куплю/Закажу"

Если вы хотите приобрести какой то скрипт/продукт/хак из каталогов перечисленных ниже:
Каталог модулей/хаков
Ещё раз обращаем Ваше внимание: всё, что Вы скачиваете и устанавливаете на свой форум, Вы устанавливаете исключительно на свой страх и риск.
Сообщество vBSupport'а физически не в состоянии проверять все стили, хаки и нули, выкладываемые пользователями.
Помните: безопасность Вашего проекта - Ваша забота.
Убедительная просьба: при обнаружении уязвимостей или сомнительных кодов обязательно отписывайтесь в теме хака/стиля
Спасибо за понимание
 
 
 
 
nop
Продвинутый
Default как правильно чистить личные сообщения?
0

Добрый всем день.
Таблица с личками достигла размера в 700 мб. Есть желание её почистить, но как это сделать правильно? Если просто удалить через базу запись, то во входящих у пользователя всё равно останется этот мессадж. Только ссылка будет вести вникуда.
Вопрос вот в чём: как почистить личку правильно? И если никак, то какими проблемами может грозить удаление записей из таблицы pmtext через базу?
Bot
Yandex Bot Yandex Bot is online now
 
Join Date: 05.05.2005
Реклама на форуме А что у нас тут интересного? =)
 
 
anelly
Эксперт
 
anelly's Avatar
Default
2

штатным способом - через админку, периодически чищу) особенно у тех, кто давно не заходил

Пользователи - статистика личных сообщений- удалить все личные сообщения - поюзерно)
 
 
BTC
СпециалистЪ
 
BTC's Avatar
Default
2

@nop, Вам в помощь штатная функция вб для удаления ЛС:
PHP Code:
function delete_user_pms($userid$updateuser true)
{
    global 
$vbulletin$vbphrase;

    
$userid intval($userid);

    
// array to store pm ids message ids
    
$pms = array();
    
// array to store the number of pmtext records used by this user
    
$pmTextCount = array();
    
// array to store the ids of any pmtext records that are used soley by this user
    
$deleteTextIDs = array();
    
// array to store results
    
$out = array();

    
// first zap all receipts belonging to this user
    
$vbulletin->db->query_write("DELETE FROM " TABLE_PREFIX "pmreceipt WHERE userid = $userid");
    
$out['receipts'] = $vbulletin->db->affected_rows();

    
// now find all this user's private messages
    
$messages $vbulletin->db->query_read("
        SELECT pmid, pmtextid
        FROM " 
TABLE_PREFIX "pm
        WHERE userid = 
$userid
    "
);
    while (
$message $vbulletin->db->fetch_array($messages))
    {
        
// stick this record into our $pms array
        
$pms["$message[pmid]"] = $message['pmtextid'];
        
// increment the number of PMs that use the current PMtext record
        
$pmTextCount["$message[pmtextid]"] ++;
    }
    
$vbulletin->db->free_result($messages);

    if (!empty(
$pms))
    {
        
// zap all pm records belonging to this user
        
$vbulletin->db->query_write("DELETE FROM " TABLE_PREFIX "pm WHERE userid = $userid");
        
$out['pms'] = $vbulletin->db->affected_rows();
        
$out['pmtexts'] = 0;

        
// update the user record if necessary
        
if ($updateuser AND $user fetch_userinfo($userid))
        {
            
$updateduser true;
            
$userdm =& datamanager_init('User'$vbulletinERRTYPE_SILENT);
            
$userdm->set_existing($user);
            
$userdm->set('pmtotal'0);
            
$userdm->set('pmunread'0);
            
$userdm->set('pmpopup''IF(pmpopup=2, 1, pmpopup)'false);
            
$userdm->save();
            unset(
$userdm);
        }
    }
    else
    {
        
$out['pms'] = 0;
        
$out['pmtexts'] = 0;
    }

    
// in case the totals have been corrupted somehow
    
if (!isset($updateduser) AND $updateuser AND $user fetch_userinfo($userid))
    {
        
$userdm =& datamanager_init('User'$vbulletinERRTYPE_SILENT);
        
$userdm->set_existing($user);
        
$userdm->set('pmtotal'0);
        
$userdm->set('pmunread'0);
        
$userdm->set('pmpopup''IF(pmpopup=2, 1, pmpopup)'false);
        
$userdm->save();
        unset(
$userdm);
    }

    foreach (
$out AS $k => $v)
    {
        
$out["$k"] = vb_number_format($v);
    }

    return 
$out;

В функцию можно добавить переменную и условие по дате + изменения в запросы внести)
 
 
nop
Продвинутый
Default
0

Quote:
Originally Posted by anelly View Post
штатным способом - через админку, периодически чищу) особенно у тех, кто давно не заходил

Пользователи - статистика личных сообщений- удалить все личные сообщения - поюзерно)
это где такое? Что за вобла?
 
 
Sven
Front-End Developer
 
Sven's Avatar
Default
0

Quote:
Originally Posted by nop View Post
это где такое? Что за вобла?
Любая, в админке.
 
 
BTC
СпециалистЪ
 
BTC's Avatar
Default
1

@nop, вырезка из /admincp/usertools.php

PHP Code:
// ###################### Start Remove User's PMs #######################
if ($_REQUEST['do'] == 'removepms')
{

    
print_delete_confirmation('user'$vbulletin->GPC['userid'], 'usertools''killpms''private_messages_belonging_to_the_user');
}

// ###################### Start Remove User's PMs #######################
if ($_POST['do'] == 'killpms')
{

    
$result delete_user_pms($vbulletin->GPC['userid']);

    
define('CP_REDIRECT'"user.php?do=edit&amp;u=" $vbulletin->GPC['userid']);
    
print_stop_message('deleted_x_pms_y_pmtexts_and_z_receipts'$result['pms'], $result['pmtexts'], $result['receipts']);
}

// ###################### Start Remove PMs Sent by User #######################
if ($_REQUEST['do'] == 'removesentpms')
{

    
print_delete_confirmation('user'$vbulletin->GPC['userid'], 'usertools''killsentpms''private_messages_sent_by_the_user');
}

// ###################### Start Remove User's PMs #######################
if ($_POST['do'] == 'killsentpms')
{

    
$user $db->query_first("SELECT userid, username FROM " TABLE_PREFIX "user WHERE userid = " $vbulletin->GPC['userid']);

    if (!
$user['userid'])
    {
        
print_stop_message('invalid_user_specified');
    }

    
$pmtextids '0';
    
$pmtexts $db->query_read("SELECT pmtextid FROM " TABLE_PREFIX "pmtext WHERE fromuserid = " $vbulletin->GPC['userid']);
    while (
$pmtext $db->fetch_array($pmtexts))
    {
        
$pmtextids .= ",$pmtext[pmtextid]";
    }
    
$db->free_result($pmtexts);

    
define('CP_REDIRECT'"user.php?do=edit&amp;u=" $vbulletin->GPC['userid']);

    if (
$pmtextids == '0')
    {
        
print_stop_message('no_private_messages_matched_your_query');
    }
    else
    {
        
$pmids '0';
        
$pmarray = array();
        
$pms $db->query_read("
            SELECT pm.*, user.username
            FROM " 
TABLE_PREFIX "pm AS pm
            LEFT JOIN " 
TABLE_PREFIX "user AS user USING(userid)
            WHERE pm.pmtextid IN(
$pmtextids)
        "
);
        while (
$pm $db->fetch_array($pms))
        {
            
$pmids .= ",$pm[pmid]";
            
$pmarray["$pm[username]"][] = $pm;
        }
        
$db->free_result($pms);

        
$users = array();

        foreach(
$pmarray AS $username => $pms)
        {
            
$pmunread 0;
            foreach(
$pms AS $pm)
            {
                if (
$pm['messageread'] == 0)
                {
                    
$pmunread ++;
                }
            }
            
$pmtotal sizeof($pms);
            
$users["$pm[userid]"] = array('pmtotal' => $pmtotal'pmunread' => $pmunread);
        }

        
$db->query_write("DELETE FROM " TABLE_PREFIX "pm WHERE pmid IN($pmids)");

        if (!empty(
$users))
        {
            
$pmtotalsql 'CASE userid ';
            
$pmunreadsql 'CASE userid ';
            foreach(
$users AS $id => $x)
            {
                
$pmtotalsql .= "WHEN $id THEN pmtotal - $x[pmtotal] ";
                
$pmunreadsql .= "WHEN $id THEN pmunread - $x[pmunread] ";
            }
            
$pmtotalsql .= 'ELSE pmtotal END';
            
$pmunreadsql .= 'ELSE pmunread END';

            
$userids implode(', 'array_keys($users));

            
$db->query_write("
                UPDATE " 
TABLE_PREFIX "user
                SET pmtotal = 
$pmtotalsql,
                pmunread = 
$pmunreadsql
                WHERE userid IN(
$userids)
            "
);
            
$db->query_write("
                UPDATE " 
TABLE_PREFIX "user
                SET pmpopup = IF(pmpopup=2 AND pmunread = 0, 1, pmpopup)
                WHERE userid IN(
$userids)
            "
);
        }

        
print_stop_message('deleted_private_messages_successfully');
    }

Покрутите и напишите нужный вам костыль\тулзу по датам и т.д.
Все примеры использованных функций указаны.
 
 
Luvilla
Гость
Default

Quote:
Originally Posted by nop View Post
это где такое?
Пользователи - Статистика личных сообщений /admincp/usertools.php?do=pmstats
 
 
nop
Продвинутый
Default
0

Quote:
Originally Posted by Luvilla View Post
Пользователи - Статистика личных сообщений /admincp/usertools.php?do=pmstats
Так там же не массовое удаление. Чистить по каждому пользователю в отдельности чтоли?))) У меня 210.000 пользователей.
 
 
Luvilla
Гость
Default

Quote:
Originally Posted by nop View Post
Так там же не массовое удаление.
ты спросил "где это"
а про нЕ-массовое - это было сказано раньше
Quote:
Originally Posted by anelly View Post
поюзерно
 
 
Konkere
Знаток
 
Konkere's Avatar
Default
0

Code:
UPDATE user SET pmtotal = 0;
UPDATE user SET pmunread = 0;
UPDATE usertextfield SET pmfolders = '';
TRUNCATE TABLE pm;
TRUNCATE TABLE pmreceipt;
TRUNCATE TABLE pmtext;
По идее должно удалить все личные сообщения и обнулить настройки пользователей.
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT +4. The time now is 08:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.