...

View Full Version : Need help with this "else if" coding



ClassicNancy
06-02-2007, 09:28 PM
I am wanting to delete or Zap the PM's in my forum folders. Right now the function is for permanently deleting the delete folder only. I have been able to get it to do the inbox too BUT only if I remove the call to delete the deleted folder. How would I write it to make it delete the other folders? Here is the code.

else if ($HTTP_GET_VARS["zap"])
zap_deleted_items($HTTP_GET_VARS);

The other folders are Inbox and sent_items

PappaJohn
06-03-2007, 12:13 AM
zap_deleted_items($HTTP_GET_VARS);
is not a php function, it's likely a function included with the forum.

You'd have to modify zap_deleted_items to zap the other folders as well.

ClassicNancy
06-03-2007, 01:29 AM
Ok....here is that code...what should I do with it??

function zap_deleted_items($vars)
// Permanently deletes the contents of the deleted items folder
{
pm_zap_deleted_items(USER_ID);
$folder_id = $vars["ref"];
redirect("/pm.php?folder_id=$folder_id");
}

PappaJohn
06-03-2007, 01:46 AM
Well, it looks like that function is calling another custom function pm_zap_deleted_items

Which forum is this, btw?

ClassicNancy
06-03-2007, 01:53 AM
Ok her eis that code. It is wowbb.



function pm_zap_deleted_items($user_id)
// Deletes the contents of the deleted items folder
{
list($user_id) = sanitize(array($user_id));

$result = db_query("SELECT pm_id FROM wowbb_pm WHERE user_id=$user_id AND pm_folder_id=102");
if (db_num_rows($result))
{
while ($row = db_fetch_row($result))
$message_ids[] = $row["pm_id"];
pm_delete_messages($user_id, $message_ids);
pm_update_message_status();
}
}

ClassicNancy
06-03-2007, 01:54 AM
I already made a copy for each folder of that code....so must not work that way...what I changed was the folder name and the 102 to the folder #.

PappaJohn
06-03-2007, 02:00 AM
Well, the problem is that function is also calling custom functions:

pm_delete_messages
pm_update_message_status

That means, it will not be as simple as copying that code for the other folders.

You would need to know how these other messages are stored. The last function you posted refers to pm_folder_id which suggests that the id number either refers to the user, a flag used in the pm table to denote which folder they are stored in, or a separate table.

Without knowing how the forum software is storing these PM's (and referencing them) it would be impossible to say how to do what you want.

In any event, it will likely involve more coding that just copy/paste a function.

Sorry, but I've never used wowbb, so I'm not familiar with how it works.

ClassicNancy
06-03-2007, 02:10 AM
ok thank you...I did get it to delete the inbox files by changing it to that folder name so thought it would work ok.

PappaJohn
06-03-2007, 02:22 AM
Since it worked once it was a good try.

I'm sure it's possible to do what you want, I'm just not familiar with that software to help.

ClassicNancy
06-03-2007, 02:24 AM
Thank you for your time..I appreciate it. :thumbsup:

bla
06-03-2007, 09:40 PM
You shouldn't use underscores for your own functions.
They are used for php functions and you should try to avoid using them.

ClassicNancy
06-04-2007, 02:28 AM
You shouldn't use underscores for your own functions.
They are used for php functions and you should try to avoid using them.

That's how the code already is in the forum.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum