The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Auto-email for members when their post gets edited

View previous topic View next topic Go down

Do you agree or disagree ?

75% 75% 
[ 3 ]
25% 25% 
[ 1 ]
 
Total Votes : 4

Auto-email for members when their post gets edited

Post by DVAted on March 26th 2015, 7:37 pm

Hello! I'd like to suggest that when a staff member edits a user's post, it should send an e-mail to the user. Thank you in advance!

DVAted
Forumember

Posts : 50
Reputation : 3
Language : English

http://gunetwork.org

Back to top Go down

Re: Auto-email for members when their post gets edited

Post by DVAted on March 28th 2015, 1:43 pm

bumping this. I'd like some more votes, some comments, please :wouhou:
have a nice day

DVAted
Forumember

Posts : 50
Reputation : 3
Language : English

http://gunetwork.org

Back to top Go down

Re: Auto-email for members when their post gets edited

Post by Daemon on March 28th 2015, 6:28 pm

Try this code, for punbb version:
Code:
jQuery(document).ready(function() {
if(_userdata["user_level"] > 0) {
  if(window.location.href.search('/t') >= 0) {
  jQuery('a[href*="mode=editpost"]').click(function() {
             var jUser = jQuery(this).parents('.post').find('.username, .author a').text();
             var jLink = jQuery(this).parents('.post').find('.posthead a[href^="/t"]').attr('href');
             if(jUser != _userdata["username"]) {
                sessionStorage.setItem("member_post_edited", jUser);
                sessionStorage.setItem("link_to_post", jLink);
             }
  });
  }
  if(window.location.href.search('mode=editpost') >= 0) {
  var x = sessionStorage.getItem('member_post_edited');
  if(x) {
     var y = sessionStorage.getItem('link_to_post');
     jQuery('input[name="post"]').click(function(d) {
       d.preventDefault();
       jQuery.post('/post?p=' + jQuery('input[name="p"]').val() + '&mode=editpost', {
                   'message': jQuery('textarea').sceditor('instance').val(),
                   'post': 'submit',
                   'attach_sig': '1'
       }).done(function(e) {
               var href = jQuery(e).find('a[href^="/viewtopic"]').attr('href');
               jQuery.post('/privmsg', {
                           'mode': 'post',
                           'post': '1',
                           'folder': 'inbox',
                           'username': x,
                           'subject': 'Your post has been edited by a staff member',
                           'message': '[b]Link to the edited post:[/b] ' + window.location.protocol + '//' + window.location.host + y + ''
               }).done(function() {
                       alert("The member was successfully notified");
                       sessionStorage.removeItem('member_post_edited');
                       sessionStorage.removeItem('link_to_post');
                       location.href = href;
               }).fail(function() {
                       alert("An error occurred while trying to send a notification");
                       location.href = href;
               });
       }).fail(function() {
               alert("An error occurred while trying to edit post. Try again");
       });
     });
  }
  }
}
});
Wink

Daemon
New Member

Posts : 15
Reputation : 9
Language : Português

Back to top Go down

Re: Auto-email for members when their post gets edited

Post by DVAted on April 2nd 2015, 10:57 am

thank you, Daemon
I have phpbb2 but I'll try it out

much appreciation Very good

DVAted
Forumember

Posts : 50
Reputation : 3
Language : English

http://gunetwork.org

Back to top Go down

Re: Auto-email for members when their post gets edited

Post by Str0ng on April 2nd 2015, 3:34 pm

And.. is possible something similar but notify when a mod edited a profile field? Via pm? (Phpbb3)

Ty!

Str0ng
Forumember

Posts : 51
Reputation : 7
Language : Spanish

http://www.seasonal-trackers.com

Back to top Go down

Re: Auto-email for members when their post gets edited

Post by DVAted on November 3rd 2015, 4:30 pm

Bumping this, I know
I have an update though
Daemon's punBB script didn't work on my phpBB2 site
but a friend helped me adapt a different script
this one:
Code:
$(document).ready(function () {
   //=====Put stuff here
      //=====Edit notification (ACP=>General=>Forum=>Security=>Unauthorize unofficial forms to post messages and private messages on the forum : NO)
      if(_userdata["user_level"] > 0) {
        if(window.location.href.search('/t') >= 0) {
        $('a[href*="mode=editpost"]').click(function() {
                var jUser = $(this).parents('.post').find('.name a').text();
                var trid = $(this).closest('.post').attr('id').substring(1);
                var jTitle = $(document).find("title").text();
                var jLink = window.location.pathname+'#'+trid;
                if(jUser != _userdata["username"]) {
                  sessionStorage.setItem("member_post_edited", jUser);
                  sessionStorage.setItem("link_to_post", jLink);
                  sessionStorage.setItem("topic_title", jTitle);
                }
        });
        }
        if(window.location.href.search('mode=editpost') >= 0) {
        var x = sessionStorage.getItem('member_post_edited');
        if(x) {
          var y = sessionStorage.getItem('link_to_post');
          var zt = sessionStorage.getItem('topic_title');
          $('input[name="post"]').click(function(d) {
           d.preventDefault();
           $.post('/post?p=' + $('input[name="p"]').val() + '&mode=editpost', {
                    'message': $('textarea').sceditor('instance').val(),
                    'post': 'submit',
                    'edit_reason': $("input[type='text'][name='edit_reason']").val(),
                    'attach_sig': '1'
           }).done(function(e) {
                 var href = $(e).find('a[href^="/viewtopic"]').attr('href');
                 $.post('/privmsg', {
                          'mode': 'post',
                          'username': x,
                          'subject': 'Your post has been edited by a staff member',
                          'post': 1,
                          'message': '[color=#FF9933]Link to the edited post: [b][url=' + window.location.protocol + '//' + window.location.host + y + ']'+zt+'[/url][/b][hr]Reason for editing: ' + $("input[type='text'][name='edit_reason']").val() + '[/color]'
                 }).done(function() {
                       alert("The member was successfully notified");
                       sessionStorage.removeItem('member_post_edited');
                       sessionStorage.removeItem('link_to_post');
                       sessionStorage.removeItem('topic_title');
                       location.href = href;
                 }).fail(function() {
                       alert("An error occurred while trying to send a notification");
                       location.href = href;
                 });
           }).fail(function() {
                 alert("An error occurred while trying to edit post. Try again");
           });
          });
        }
        }
      }
      //=====Edit notification End
   //=====Put stuff End!
});
It is setup so that when a staff member edits another user's post, it automatically sends a PM to that member saying that the post has been edited, what the "edit reason" entry was (if any) and giving a link to the post. I couldn't ask for more.
For a few months it worked relatively well on regular posts.

We couldn't edit topic openers, though, unless we pressed "Preview" first and then it wouldn't send the notification to the topic starter. But that was manageable.
A few months ago Sad it stopped working altogether.
Couldn't edit anyone's posts anymore. Not even my own.
The "send" or "preview" buttons became inoperable, so I had to remove the script.

We've been going without it for a while, but I'd really like to get it back and working.
Can you tell what's wrong with it? Why it doesn't work anymore?
Should I make a new topic under Script/Coding problems?

Thanks a lot for your support so far. You guys are the greatest crew of all time cheers

DVAted
Forumember

Posts : 50
Reputation : 3
Language : English

http://gunetwork.org

Back to top Go down

Re: Auto-email for members when their post gets edited

Post by DVAted on December 13th 2015, 11:01 pm

more bump
some fresh monday eyes on this could prove highly helpful
give it a shot, masters of script Wink

DVAted
Forumember

Posts : 50
Reputation : 3
Language : English

http://gunetwork.org

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum