Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    New Coder
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need help with this "else if" coding

    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

  • #2
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    Code:
    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.

  • #3
    New Coder
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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");
    }

  • #4
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    Well, it looks like that function is calling another custom function pm_zap_deleted_items

    Which forum is this, btw?

  • #5
    New Coder
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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();
    }
    }

  • #6
    New Coder
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 #.

  • #7
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    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.

  • #8
    New Coder
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #9
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    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.

  • #10
    New Coder
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you for your time..I appreciate it.

  • #11
    bla
    bla is offline
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You shouldn't use underscores for your own functions.
    They are used for php functions and you should try to avoid using them.

  • #12
    New Coder
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bla View Post
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •