The following warnings occurred: | ||||||||||||||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
![]() |
Messaging System Mods - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28) +--- Forum: Modifications and Hackery (https://userspice.com/forums/forumdisplay.php?fid=29) +--- Thread: Messaging System Mods (/showthread.php?tid=615) |
Messaging System Mods - karsen - 07-18-2017 My last code was just an example I created from scratch to show multiple buttons to adapt to the messaging script as I didn't have access to the code at the time. Your buttons both have the same name (Submit). If you give your buttons unique names (delete and unarchive), you can check for that button in $_POST['buttonName'] and process that button's function, otherwise you'll have to check the value to determine the function you want. Code: if (isset($_POST['delete'])) Code: if (isset($_POST['submit']) && $_POST['submit'] = 'delete') Also in your Unarchive/Delete modal, I'd change the checkbox name to have a prefix for the array: Code: <input type="checkbox" name="checkbox[<?=$m2->id?>]" value="<?=$m2->id?>"/> Now you can do: Code: if (isset($_POST['delete'])) { Code: $delete = $_POST['checkbox']; Code: if (count($delete) > 0 && $deletion_count = deleteThread($deletions,$user->data()->id,1)) { Code: $successes[] = lang("MESSAGE_DELETE_SUCCESSFUL", array($deletion_count)); Code: } Code: else { Code: $errors[] = lang("SQL_ERROR"); Code: } Code: } Code: if (isset($_POST['unarchive'])) { Code: $unarchives= $_POST['unarchive']; Code: if (count($unarchives) > 0 && $unarchive_count = unarchiveThread(...) { Code: $successes[] = lang("MESSAGE_UNARCHIVE_SUCCESSFUL", array($unarchive_count)); Code: } Code: else { Code: $errors[] = lang("SQL_ERROR"); Code: } Code: } Again this is untested but try these changes and see how it goes. I had to hack up your code enough to work with my site that a full hastebin wouldn't help much. Messaging System Mods - Brandin - 07-19-2017 Thank you Karesn - this worked. Once I get this all deployed and cleaned up, I'll post it here for everyone! Messaging System Mods - Brandin - 08-05-2017 Here is the most recent update. Hastebin was down at the time, so Pastebin it is! Language Keys: https://pastebin.com/HqrkW8h1 Custom Functions: https://pastebin.com/07CU1vXW JS: Code: jqwerty.js Code: combobox.js Code: messages.php **note the init call is for being in Code: usersc Code: message.php **note the init call is for being in Code: usersc Code: admin_user.php **put this after your block user edit ~ line 168 And later on whenever in your body put the checkbox, I put it above block: https://pastebin.com/V3JZDXcr DB alters: -Add msg_exempt int 1 default 0 to your users table -Add archive_from, archive_to, hidden_from, hidden_to to message_threads int 1 default 0 I can't think of anything else you will need! I have yet to finish the snooping feature in the admin portal because I don't have to use it yet, but when I do I will! Known issue! Is the "check / uncheck all" will only work on unarchive threads when you have both unarchived and archived threads. I have yet to find a fix for this yet, but I will let you know when I do - or if you do even better ![]() Messaging System Mods - mudmin - 08-05-2017 Awesome! I'll add it! Messaging System Mods - mudmin - 08-05-2017 Do you have a copy of your updateUser function? Messaging System Mods - Brandin - 08-05-2017 I just pasted all of my functions in case you need any of them ![]() https://pastebin.com/zbjXYgjt Messaging System Mods - mudmin - 08-05-2017 Where do you have those language keys pasted? Messaging System Mods - Brandin - 08-05-2017 They're here: https://pastebin.com/HqrkW8h1 I have them in my DB because I use all of my languages through a foreach so I can't really paste the whole language file lol Messaging System Mods - mudmin - 08-05-2017 Ahh. Ok. Hmm. I'll keep at that. The only other change I made was to change the exempt thing from a checkbox to a dropdown since it's right below another dropdown. Messaging System Mods - mudmin - 08-05-2017 Do you have your USER_MESSAGE_EXEMPT language? |