This forum is archived. Posts are preserved for historical reference. For current help, join us on Discord.

Messaging System Mods

In Modifications and Hackery · Started by Brandin on 2017-06-28 5:02 pm · 84364 views · 35 replies

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.
if (isset($_POST['delete']))
as opposed to
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:
<input type="checkbox" name="checkbox[<?=$m2->id?>]" value="<?=$m2->id?>"/>

Now you can do:
if (isset($_POST['delete'])) {
$delete = $_POST['checkbox'];
if (count($delete) > 0 && $deletion_count = deleteThread($deletions,$user->data()->id,1)) {
$successes[] = lang("MESSAGE_DELETE_SUCCESSFUL", array($deletion_count));
}
else {
$errors[] = lang("SQL_ERROR");
}
}
if (isset($_POST['unarchive'])) {
$unarchives= $_POST['unarchive'];
if (count($unarchives) > 0 && $unarchive_count = unarchiveThread(...) {
$successes[] = lang("MESSAGE_UNARCHIVE_SUCCESSFUL", array($unarchive_count));
}
else {
$errors[] = lang("SQL_ERROR");
}
}

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.
Thank you Karesn - this worked. Once I get this all deployed and cleaned up, I'll post it here for everyone!
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:
jqwerty.js
https://pastebin.com/ngMRCMBd
combobox.js
https://pastebin.com/xSM7Sath
messages.php
https://pastebin.com/rBFcmGST
**note the init call is for being in
usersc
folder
message.php
https://pastebin.com/Hgs7ieGM
**note the init call is for being in
usersc
folder
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 ;)
Awesome! I'll add it!
Do you have a copy of your updateUser function?
I just pasted all of my functions in case you need any of them :)

https://pastebin.com/zbjXYgjt
Where do you have those language keys pasted?
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
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.
Do you have your USER_MESSAGE_EXEMPT language?
I just pasted my whole DB in case I forgot any others for you - sorry.

https://pastebin.com/meEZpGEK

Of course I actually don't have that one!!! LOL
User is {3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}m1{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d} exempted from messages.

Looks like it got lost when I migrated my DB.
That did the trick!
I tested this Mudmin - no issues other then me forgetting to give you the nounderline CSS!

http://pasted.co/860a150e
Where does this go?
Where does this go?
I have it in my custom.css
‹ Prev12