Announcement

Collapse
No announcement yet.

How to delete all PMs in a folder

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to delete all PMs in a folder

    In the ancient vB 3.0.xx there is a checkbox above the PM list, next to the total number of PMs in that particular folder. Common sense says that if I check that checkbox, all PMs in that folder are subject to the action I'll select from the menu at the end of the list. Unfortunately, this is not true, at least not when you select all messages and then select "Delete". Only the messages shown in that particular page are deleted.

    That's not logical and it is something I need and my members need. Is there a way to do change the code so that when selecting all messages all messages are deleted, moved, marked as read or unread etc.?

    Many thanks.
    John Caradimas

  • #2
    That is the way it works by design. There is no option to do it any other wa. Sorry.
    Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
    Change CKEditor Colors to Match Style (for 4.1.4 and above)

    Steve Machol Photography


    Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


    Comment


    • #3
      So Steve, by design, one has to go to as many pages as there are messages divided by whatever number of messages are shown per page, and do the same thing again and again? I am surprised. Time to work some code.

      Thanks
      John Caradimas

      Comment


      • #4
        Steve, one more question if you allow me.

        From what I see in the code, when a private message is deleted, the entry in the pm table is deleted, but not the entry in the pmtext. I suppose because this is done so that the message content is not lost if the message has been sent to more than one recipients and one of them deletes his message, but the others have not read it yet.

        I checked my pmtext table though, and I have something like 1600 pages there. Is there any cron script that cleans up this table or are admins suppose to take care of this manually or by a program?

        Tnx
        John Caradimas

        Comment


        • #5
          I am not aware of that at all. I tested this and the pmtext entry was deleted as well. Of course I do not have vB 3.0 to test this with so maybe it's something with your older version of vB. I strongly recommend that you upgrade to the current version.
          Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
          Change CKEditor Colors to Match Style (for 4.1.4 and above)

          Steve Machol Photography


          Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


          Comment


          • #6
            Steve, thanks for coming back to me.

            Here is the code from private.php, where the program deletes a PM.

            Code:
            case 'delete':
                        $pmids = array();
                        $textids = array();
            
                        // get the pmid and pmtext id of messages to be deleted
                        $pms = $DB_site->query("
                            SELECT pmid
                            FROM " . TABLE_PREFIX . "pm
                            WHERE userid = $bbuserinfo[userid]
                                AND pmid IN(" . implode(', ', $messageids) . ")
                        ");
            
                        // check to see that we still have some ids to work with
                        if ($DB_site->num_rows($pms) == 0)
                        {
                            $idname = $vbphrase['private_message'];
                            eval(print_standard_error('invalidid'));
                        }
            
                        // build the final array of pmids to work with
                        while ($pm = $DB_site->fetch_array($pms))
                        {
                            $pmids[] = $pm['pmid'];
                        }
            
                        // delete from the pm table using the results from above
                        $deletePmSql = "DELETE FROM " . TABLE_PREFIX . "pm WHERE pmid IN(" . implode(', ', $pmids) . ")";
                        $DB_site->query($deletePmSql);
            
                        build_pm_counters();
            
                        // all done, redirect...
                        $url = "private.php?$session[sessionurl]folderid=$folderid";
                        eval(print_standard_redirect('pm_messagesdeleted'));
                    break;
            The code above is from release 3.0.17.

            Code:
            case 'delete':
                        $pmids = array();
                        $textids = array();
            
                        // get the pmid and pmtext id of messages to be deleted
                        $pms = $db->query_read_slave("
                            SELECT pmid
                            FROM " . TABLE_PREFIX . "pm
                            WHERE userid = " . $vbulletin->userinfo['userid'] . "
                                AND pmid IN(" . implode(', ', $messageids) . ")
                        ");
            
                        // check to see that we still have some ids to work with
                        if ($db->num_rows($pms) == 0)
                        {
                            eval(standard_error(fetch_error('invalidid', $vbphrase['private_message'], $vbulletin->options['contactuslink'])));
                        }
            
                        // build the final array of pmids to work with
                        while ($pm = $db->fetch_array($pms))
                        {
                            $pmids[] = $pm['pmid'];
                        }
            
                        // delete from the pm table using the results from above
                        $deletePmSql = "DELETE FROM " . TABLE_PREFIX . "pm WHERE pmid IN(" . implode(', ', $pmids) . ")";
                        $db->query_write($deletePmSql);
            
                        build_pm_counters();
            
                        ($hook = vBulletinHook::fetch_hook('private_managepm_delete')) ? eval($hook) : false;
            
                        // all done, redirect...
                        $vbulletin->url = 'private.php?' . $vbulletin->session->vars['sessionurl'] . 'folderid=' . $vbulletin->GPC['folderid'];
                        eval(print_standard_redirect('pm_messagesdeleted'));
                    break;
            This is from 3.6.5, which I do not have installed, but it comes from the original distribution file. As you can see, there is no "DELETE FROM PMTEXT" in here either.

            I have no idea what release you are running but I do not think the code deletes the PMTEXT entry which corresponds to the PM entry.
            John Caradimas

            Comment


            • #7
              Please upgrade to the latest version of vB - 3.6.8 PL2. Then if you can verify there is a specific problem with that version, please post it in the Bug Tracker.
              Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
              Change CKEditor Colors to Match Style (for 4.1.4 and above)

              Steve Machol Photography


              Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


              Comment


              • #8
                I am sorry, but I ain't going to upgrade to a newer version than I am running now. My site is heavily hacked and adding all the mods to the new releases is too much for me.

                However, I downloaded the latest release and the code is exactly the same.

                Code:
                        case 'delete':
                            $pmids = array();
                            $textids = array();
                
                            // get the pmid and pmtext id of messages to be deleted
                            $pms = $db->query_read_slave("
                                SELECT pmid
                                FROM " . TABLE_PREFIX . "pm
                                WHERE userid = " . $vbulletin->userinfo['userid'] . "
                                    AND pmid IN(" . implode(', ', $messageids) . ")
                            ");
                
                            // check to see that we still have some ids to work with
                            if ($db->num_rows($pms) == 0)
                            {
                                eval(standard_error(fetch_error('invalidid', $vbphrase['private_message'], $vbulletin->options['contactuslink'])));
                            }
                
                            // build the final array of pmids to work with
                            while ($pm = $db->fetch_array($pms))
                            {
                                $pmids[] = $pm['pmid'];
                            }
                
                            // delete from the pm table using the results from above
                            $deletePmSql = "DELETE FROM " . TABLE_PREFIX . "pm WHERE pmid IN(" . implode(', ', $pmids) . ")";
                            $db->query_write($deletePmSql);
                
                            build_pm_counters();
                
                            ($hook = vBulletinHook::fetch_hook('private_managepm_delete')) ? eval($hook) : false;
                
                            // all done, redirect...
                            $vbulletin->url = 'private.php?' . $vbulletin->session->vars['sessionurl'] . 'folderid=' . $vbulletin->GPC['folderid'];
                            eval(print_standard_redirect('pm_messagesdeleted'));
                        break;
                Only the records from the PM table are deleted, not the ones from PMTEXT.

                I do not know if I should open a bug ticket, I can't test the new version, so opening a ticket will be stupid on my behalf. I am sure you can bring this issue to the developers attention yourself. I do not want to bother them with something I can't test myself.
                John Caradimas

                Comment


                • #9
                  Never mind Steve, I figure that you couldn't have forgotten such a serious thing. It is taken care of, by the Hourly Cleanup No 2 cron script.

                  Thanks
                  John Caradimas

                  Comment

                  Related Topics

                  Collapse

                  Working...
                  X