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
#22
Thank you Karesn - this worked. Once I get this all deployed and cleaned up, I'll post it here for everyone!
  Reply
#23
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
https://pastebin.com/ngMRCMBd
Code:
combobox.js
https://pastebin.com/xSM7Sath

Code:
messages.php
https://pastebin.com/rBFcmGST
**note the init call is for being in
Code:
usersc
folder

Code:
message.php
https://pastebin.com/Hgs7ieGM
**note the init call is for being in
Code:
usersc
folder

Code:
admin_user.php
https://pastebin.com/citgeGcd
**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 Wink
  Reply
#24
Awesome! I'll add it!
  Reply
#25
Do you have a copy of your updateUser function?
  Reply
#26
I just pasted all of my functions in case you need any of them Smile

https://pastebin.com/zbjXYgjt
  Reply
#27
Where do you have those language keys pasted?
  Reply
#28
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
  Reply
#29
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.
  Reply
#30
Do you have your USER_MESSAGE_EXEMPT language?
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)