The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Messaging System Mods
#21
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']))
as opposed to
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.
  Reply


Messages In This Thread
Messaging System Mods - by Brandin - 06-28-2017, 05:02 PM
Messaging System Mods - by Brandin - 06-28-2017, 08:00 PM
Messaging System Mods - by firestorm - 06-29-2017, 09:40 AM
Messaging System Mods - by Brandin - 06-29-2017, 10:11 AM
Messaging System Mods - by firestorm - 06-29-2017, 12:02 PM
Messaging System Mods - by Brandin - 06-29-2017, 12:05 PM
Messaging System Mods - by mudmin - 06-29-2017, 01:22 PM
Messaging System Mods - by jdmfarms - 07-03-2017, 12:28 PM
Messaging System Mods - by Brandin - 07-03-2017, 01:02 PM
Messaging System Mods - by firestorm - 07-03-2017, 08:51 PM
Messaging System Mods - by faguss - 07-04-2017, 04:20 PM
Messaging System Mods - by Brandin - 07-04-2017, 06:22 PM
Messaging System Mods - by Brandin - 07-06-2017, 02:20 PM
Messaging System Mods - by Brandin - 07-06-2017, 05:25 PM
Messaging System Mods - by Brandin - 07-06-2017, 05:37 PM
Messaging System Mods - by firestorm - 07-06-2017, 07:16 PM
Messaging System Mods - by faguss - 07-10-2017, 11:45 AM
Messaging System Mods - by Brandin - 07-13-2017, 10:03 PM
Messaging System Mods - by karsen - 07-15-2017, 03:53 PM
Messaging System Mods - by Brandin - 07-18-2017, 12:05 PM
Messaging System Mods - by karsen - 07-18-2017, 06:38 PM
Messaging System Mods - by Brandin - 07-19-2017, 12:14 PM
Messaging System Mods - by Brandin - 08-05-2017, 06:31 PM
Messaging System Mods - by mudmin - 08-05-2017, 08:59 PM
Messaging System Mods - by mudmin - 08-05-2017, 09:29 PM
Messaging System Mods - by Brandin - 08-05-2017, 09:31 PM
Messaging System Mods - by mudmin - 08-05-2017, 09:38 PM
Messaging System Mods - by Brandin - 08-05-2017, 09:39 PM
Messaging System Mods - by mudmin - 08-05-2017, 09:43 PM
Messaging System Mods - by mudmin - 08-05-2017, 09:45 PM
Messaging System Mods - by Brandin - 08-05-2017, 09:49 PM
Messaging System Mods - by mudmin - 08-05-2017, 10:09 PM
Messaging System Mods - by Brandin - 08-06-2017, 10:30 AM
Messaging System Mods - by mudmin - 08-06-2017, 12:54 PM
Messaging System Mods - by mudmin - 08-06-2017, 12:54 PM
Messaging System Mods - by Brandin - 08-06-2017, 01:01 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)