Email from PM - Unsubscribe

e107 CMS » Forums » e107 v1.x Support » Core Code Support << Previous thread | Next thread >>
Go to page  1 2
swata4
Oct 24 2011, 06:14AM
Registered Member #30637
Joined: Sep 17 2006, 11:49AM
Posts: 132
Hi,

I was wondering if anyone had any advice for me. I like recieving email notifications on PM, however my previous host accused me of spam and warned me about sending such emails. Users have no way of turning off "Notifications on PM" themselves. And theres no unsubscribe button in the emails from E107. I was informed that that's not legal?

Thanks,
- Kev
Go to top
Moc
Oct 24 2011, 06:37AM
  • e107 Site administrator
  • e107 Security Team
  • e107 Support Team
  • e107 Documentation Team
Registered Member #44563
Joined: Apr 12 2008, 03:01AM
Location: The Netherlands
Posts: 3510
They do have a point. As a (temporary) solution you could add a disclaimer to your website stating that registration means getting those emails. It would be an excellent feature request though. Might even code something myself lateron.

Edit: this is the other way around but there is an option to enable those emails only for a specific userclass. So you instead of opt-out you have a opt-in system. Only if you want to receive those emails you are added to a userclass that gets those emails.
[ Edited Oct 24 2011, 06:40AM ]
Go to top
swata4
Oct 28 2011, 09:14AM
Registered Member #30637
Joined: Sep 17 2006, 11:49AM
Posts: 132
Moc,

I can one up your idea.

use the auto-assign plugin in conjunction. All new members will become part of "Email on PM" when they register and then you use your idea by setting a user class to receive emails.

They can chose to OPT out. Then we can change the default email to a link, "To stop receiving notifications, click here and untick "Notify" or whatever.

You sir, are brilliant.
[ Edited Oct 28 2011, 09:14AM ]
Go to top
Moc
Oct 28 2011, 09:20AM
  • e107 Site administrator
  • e107 Security Team
  • e107 Support Team
  • e107 Documentation Team
Registered Member #44563
Joined: Apr 12 2008, 03:01AM
Location: The Netherlands
Posts: 3510
Thanks for that compliment, not sure if I deserve it lol
Glad you managed to figure out a way.

I'll add an option to opt-out from PM emails as a user to the feature request tracker. Once I get so me spare time I'll do some coding for it
Go to top
swata4
Oct 28 2011, 09:34AM
Registered Member #30637
Joined: Sep 17 2006, 11:49AM
Posts: 132
Keep up the great work. You contribute a lot of E107... and... my wesbites... lol.
Go to top
Moc
Oct 28 2011, 02:09PM
  • e107 Site administrator
  • e107 Security Team
  • e107 Support Team
  • e107 Documentation Team
Registered Member #44563
Joined: Apr 12 2008, 03:01AM
Location: The Netherlands
Posts: 3510
Just a follow up- this has been added in the feature request section: [-link-]
Go to top
Nowwhat
Oct 28 2011, 05:20PM
  • e107 Support Team
Registered Member #38024
Joined: Jul 05 2007, 12:08PM
Location: Europe (France)
Posts: 1729
I have a solution.

First create a "Extended User Field".



The name should be "user_pmotou".
Copy all the info.
This structure will be visible for all site members, and will be there when the user signs up.
The site member can go any time to Settings, and change the option "Yes/No".
This was the fun part.

Now, the fun starts.
Open this file:
/e107_plugins/pm/pm_class.php

Locate the function
function pm_send_notify($uid, $pminfo, $pmid, $attach_count = 0)
It should be on line 201.

Make it look like this: [-link-]
Check that I ADDED right after this function a new function just behind pm_send_notify() being called user_opt_out()

So, function pm_send_notify() changed a bit.
Function user_opt_out() was added.

How does it work: before the actual mail is build and send in pm_send_notify(), the new function user_opt_out() checks if the user to who the mail is going to be send to, WANTS to receive a mail (when he gets PM'd).
No signaling will been done to the guy who send the PM.

I wrote and tested this for e107 0.7.26 only.

Remember:
This is core patching.
I didn't say this.
You didn't do this.
Go to top
Website
Crytiqal
Oct 29 2011, 01:45AM
  • e107 Support Team
Registered Member #53493
Joined: Oct 31 2009, 04:55AM
Location: Looks like a room...
Posts: 538
@Nowwhat

Good solution but your syntax makes it quite confusing for me.

If user_opt_out($uid) is TRUE, then send an email.
Where I would expect if the user has opt out (true) no email would be send

Or am I reading something wrong here?

Also, so you say the fun part is adding the extended user field, but the fun starts right after that
[ Edited Oct 29 2011, 01:48AM ]
Go to top
Nowwhat
Oct 29 2011, 08:00AM
  • e107 Support Team
Registered Member #38024
Joined: Jul 05 2007, 12:08PM
Location: Europe (France)
Posts: 1729
Correct for the "user_opt_out($uid) is TRUE", the function should return "FALSE" when the user did not opted out.
A corrected version, more logic: [-link-]

And actually, both parts were fun to write
(it was 3:45 AM)
[ Edited Oct 29 2011, 08:01AM ]
Go to top
Website
BLuDKLoT
Nov 05 2011, 06:37PM
Registered Member #55853
Joined: May 05 2010, 06:59PM
Location: Menifee, CA
Posts: 60
Hey man I got the field set up but I don't understand how to place the code. Can I get more instruction please? I just don't understand where to paste what.

Thank you.
Go to top
Website
Crytiqal
Nov 06 2011, 01:52AM
  • e107 Support Team
Registered Member #53493
Joined: Oct 31 2009, 04:55AM
Location: Looks like a room...
Posts: 538
It says right here:

wrote ...
Now, the fun starts.
Open this file:
/e107_plugins/pm/pm_class.php

Locate the function
function pm_send_notify($uid, $pminfo, $pmid, $attach_count = 0)
It should be on line 201.


Then change that to this:
[-link-]
Go to top
BLuDKLoT
Nov 06 2011, 03:36PM
Registered Member #55853
Joined: May 05 2010, 06:59PM
Location: Menifee, CA
Posts: 60
ok I've done that and I dont understand. This is why I posted please provide MORE info, but thanks for making me feel even more stupid. Is there anyone else that can please explain in greater detail. Thank you.
[ Edited Nov 06 2011, 03:37PM ]
Go to top
Website
Nowwhat
Nov 07 2011, 02:00AM
  • e107 Support Team
Registered Member #38024
Joined: Jul 05 2007, 12:08PM
Location: Europe (France)
Posts: 1729
Locating a file (on your web server !), taking it into and editor, cherching a text, cut (from the link shown above) and pasting the code into the file (replacing the function pm_send_notify() and adding a new function, which is part of the code block you pasted isn't hard.
But it needs a huge pile of know-how to do so.

WHAT do you NOT understand ?
Go to top
Website
BLuDKLoT
Nov 07 2011, 01:55PM
Registered Member #55853
Joined: May 05 2010, 06:59PM
Location: Menifee, CA
Posts: 60
I see what it says. I can read the directions. But I can't see what to change. I don't understand code and when I open the two examples they look so freaking different to me I can't figure out what to place where. It just doesn't make sense to me I don't know how else to explain it. Can someone just post something i can upload to make the changes? The first example has barely anything, the after is almost an entire page, I can't can't fucking read it and it's beginning to piss me off so much cuz I know it's a simple little fucking thing I can't figure out. Fuck it, never mind I'll find something else to use.
Go to top
Website
Moc
Nov 07 2011, 03:12PM
  • e107 Site administrator
  • e107 Security Team
  • e107 Support Team
  • e107 Documentation Team
Registered Member #44563
Joined: Apr 12 2008, 03:01AM
Location: The Netherlands
Posts: 3510
Calm down, no need to start swearing all along.

There is one file you need to change. It's the /e107_plugins/pm/pm_class.php file. As this is a core file we normally do not advise changing it as it will get overwritten in an update if not documented properly.

I've edited the file for you, it's up for download for 48 hours (send me a PM if you haven't had time to dl it yet): [-link-]

Now, there are two things you need to do:
- Unzip the download, overwrite the current /e107_plugins/pm/pm_class.php with the downloaded one.
- Follow the instructions by nowwhat above regarding the Extended User Field.
Go to top
BLuDKLoT
Nov 07 2011, 06:33PM
Registered Member #55853
Joined: May 05 2010, 06:59PM
Location: Menifee, CA
Posts: 60
Cheers man.
Go to top
Website
kgrayjr
Jul 16 2012, 07:35PM
Registered Member #145054
Joined: Feb 27 2012, 03:58PM
Posts: 8
Curious, if anyone still has the code available. Seems the links are no longer active.

Was really excited when I found this thread, for it would resolve some issues I am having with my host (proving auto-sent mail was asked for).

Tried to write something up real quick, just not sure where I went wrong. Does not send mail when "Yes" is chosen for "user_pmotou"

The link below is the part of code I added and changed, in case someone can see where I goofed.

[-link-]

Just slapped into a textarea real quick, so no highlighting

Thanks for your time
Go to top
septor
Jul 16 2012, 08:23PM
  • e107 Site administrator
  • e107 Security Team
  • e107 Support Team
  • e107 Documentation Team
Registered Member #37
Joined: Aug 11 2002, 03:20AM
Location: United States
Posts: 2647
I'd imagine Moc still has the files laying around. Hopefully this time he creates a gist so it doesn't get lost in paste2's garbage collection.

I'd post the changes but I have no idea what was in the new function.
[ Edited Jul 16 2012, 08:27PM ]
Go to top
Website
Moc
Jul 17 2012, 01:54AM
  • e107 Site administrator
  • e107 Security Team
  • e107 Support Team
  • e107 Documentation Team
Registered Member #44563
Joined: Apr 12 2008, 03:01AM
Location: The Netherlands
Posts: 3510
Gist: [-link-]
Line 201

Then follow the instructions posted by Nowwhat above.

NOTE: this was written for 0.7.26, I've got no clue if this file is compatible with the latest version. Check for changes between 0.7.26 - 1.0.1!
[ Edited Jul 17 2012, 04:57AM ]
Go to top
kgrayjr
Jul 17 2012, 05:30PM
Registered Member #145054
Joined: Feb 27 2012, 03:58PM
Posts: 8
Thanks for the reply. Seems not to work with 1.0.1, but at least I know I am on the right track with my version
Go to top
Go to page  1 2  

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System