Sending an email from activitystream – can we delay it a bit?…
Hi there, Bit of an odd question, this…
We have a website being set up that uses BuddyPress, Buddypress Group Email Subscription & a customised plugin to allow users to create a post with some custom fields (courtesy of Gravity Forms) & for all subscribed users to receive an email in digest form or if they prefer, an email whenever someone posts to the group they are subscribed to.
The functionality is all good for the digests etc. However, the users want to be able to see all the fields in their post – custom fields, the lot.
I have created a function that builds the email content using SQL. I tested using a page & passing $post_id as an integer.
However, when trying to add the functionality to the email-side of things, the point at which the post is added to the activity stream didn’t pull the custom fields from wp_postmeta. the data from wp_posts is fine, just nothing where the data from wp_postmeta should be.
I identified that it would work flawlessly if I tried to get the PREVIOUS posts content+metadata (I just did $post_id– as a test: When I submitted a post I got the previous posts’ data, metadata & all as expected.)
I can only conclude that wp_postmeta does have the relevant data in it when the post is added to the activity stream.
The following sequence of events is occurring when someone hits the “Submit” button when posting:
1. wp_posts is updated
2. post added to activity stream
3. wp_postmeta is updated
If I could change the sequence of this, I’d be very happy!
Right now I’m only really focusing on the “All Email” aspect.
@becskr kindly suggested that I should look in bp-subscription-activity-digest.php line 444 & add a call to my functionality there using a plugin, but when I just change variable $message to “TEST” (just to see if I can affect the email content), the content of the email does not change.
I’m just wondering if ALL Email is handled by a different function, as it sends a different type of email out, compared to a digest.
Is there a point at which the email is generated that I may be able to intercept & add my own little function before the email is sent? Does anyone know where that function is located?
Any advice appreciated, as always!
WordPress 3.5, BuddyPress 1.6.4, Group Email Subscription 3.3.1
You must be logged in to reply to this topic.