Welcome to Geeklog, Anonymous Monday, November 25 2024 @ 04:26 am EST

Geeklog Forums

Email users when story is published


Status: offline

caltman

Forum User
Junior
Registered: 07/12/04
Posts: 25
I know you can use the digest mode with cron to send a digest at the end of each day and you can use the Manual Digest Plugin to send digests if you don't have cron access (like me), but I wanted to automate this function for one of my websites.

This hack will send an email to all users (who have set it up in their preferences) when a new story has been published.

Step 0. Turn on and configure the digest settings in config.php

Step 1. Copy the function COM_emailUserTopics() from lib-common.php to lib-custom.php and rename it to whatever you want ( e.g. MY_emailUserTopics() ).

Step 2. Edit this new function to set the email subject and text to suit your needs.

Step 3. Add a call to this new function in the following files
/public_html/submit.php
/public_html/admin/story.php
/public_html/admin/moderation.php

I added it after the story had been saved to the database and after the lines:
COM_rdfUpToDateCheck ();
COM_olderStuff ();

Step 4. Test it on your self. The first email will include all stories on your site.

Step 5. Let your users know about it.

Regards,
Carter
 Quote

All times are EST. The time is now 04:26 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content