We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
  • Pages:
  • 1
  • 2
[ C ] Edit Alert
Topic Started: Jul 14 2015, 11:18 AM (766 Views)
JamieMN
Member
[ *  *  * ]
I'm using a "Reason for Edit" modification [Code below] for my forums, is there a way we can do it so when someone edits a topic, it sends an alert [PM] to Staff members?

Code:
 
<script type='text/javascript'>
var edit_reason = {
reason_required: true, // will prevent an edit without a reason
admin_exempt: true, // makes admins not have to give a reason
mod_exempt: true, // makes mods not have to give a reason
appears_without_edit_notice: false, // if true, this will appear if no edit notice is present

messages: {
reason_title: "Reason for Edit", // on the posting page, what comes before the blank
reason_post_title: "Reason", // what appears in topics below div.editby
reason_check_failed: "You must input a reason for your edit." // used if reason_required is true
}
};
</script>
<script type='text/javascript' src='http://z3.ifrm.com/313/104/0/p380505/reason_for_edit.js'></script>
Offline Profile Goto Top
 
Replies:
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
I'm pretty sure you can send the edit alert PM to an indefinite amount of users. Though, each user the PM is sent to will require an additional AJAX request.
Offline Profile Goto Top
 
JamieMN
Member
[ *  *  * ]
I don't think an additional AJAX would be a problem. :)
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Fellow coders, can I make this work with a for loop and array, or some other way to send to multiple users? I currently can only get the code to process for one user only:
Code:
 
<script type="text/javascript">
$(function() {
var uName = 'USERNAME';

if (location.href.indexOf('/post/?mode=3&type=1') !== -1) {
$('form[name="posting"]').submit(function() {
var username = $('#top_info strong a').text();
var pID = location.href.split('&p=')[1].split('&pg=')[0];
var tID = location.href.split('&t=')[1].split('&p=')[0];

$.get(main_url + 'msg/?c=2&force_ads', function(data) {
var xc = $('input[name="xc"]', data).val();
var secure = $('input[name="secure"]', data).val();
$.post(main_url + 'msg/?c=3&sd=1&force_ads', {
xc: xc,
msg: '0',
fwd: '0',
convo: '0',
draft_edit: '0',
secure: secure,
name: uName,
title: username + ' Has Edited a Post',
post: 'Here\'s the post that [b]' + username + '[/b] edited: ' + main_url + 'single/?p=' + pID + '&t=' + tID
});
});
});
}
});
</script>
Offline Profile Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

Have you tried something along the lines of this?
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
It appears a function does the trick:
Code:
 
<script type="text/javascript">
function addUser(uName) {
if (location.href.indexOf('/post/?mode=3&type=1') !== -1) {
$('form[name="posting"]').submit(function() {
var username = $('#top_info strong a').text();
var pID = location.href.split('&p=')[1].split('&pg=')[0];
var tID = location.href.split('&t=')[1].split('&p=')[0];

$.get(main_url + 'msg/?c=2&force_ads', function(data) {
var xc = $('input[name="xc"]', data).val();
var secure = $('input[name="secure"]', data).val();
$.post(main_url + 'msg/?c=3&sd=1&force_ads', {
xc: xc,
msg: '0',
fwd: '0',
convo: '0',
draft_edit: '0',
secure: secure,
name: uName,
title: username + ' Has Edited a Post',
post: 'Here\'s the post that [b]' + username + '[/b] edited: ' + main_url + 'single/?p=' + pID + '&t=' + tID
});
});
});
}
}

addUser('USERNAME');
addUser('USERNAME');
addUser('USERNAME');
</script>
Offline Profile Goto Top
 
JamieMN
Member
[ *  *  * ]
Thanks Cory!
Request is complete. ^^
Offline Profile Goto Top
 
Roby
Member Avatar
#27

Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic
  • Pages:
  • 1
  • 2