Skip to:
Content
Pages
Categories
Search
Top
Bottom

Sending an email from activitystream – can we delay it a bit?…


  • MatthewByrom
    Participant

    @matthewbyrom

    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!

    Version Numbers:
    WordPress 3.5, BuddyPress 1.6.4, Group Email Subscription 3.3.1

Viewing 2 replies - 1 through 2 (of 2 total)

  • shanebp
    Moderator

    @shanebp

    > & a customised plugin to allow users to create a post with some custom fields

    > 1. wp_posts is updated
    > 2. post added to activity stream
    > 3. wp_postmeta is updated

    And this all happens in the ‘customized plugin’ ?
    As well as your email function ? Which you call last ?

    If you aren’t sure which function is sending out your email, look at wp_mail.
    It has an apply_filters hook at the top.
    At least you can exclude or confirm that.
    ( And the whole function is pluggable – so you can over-ride it. )

    Long Shot – try:
    -setting your cpt to draft status
    -do your activity and postmeta handling
    -set your cpt status to publish
    -send your email


    MatthewByrom
    Participant

    @matthewbyrom

    Hi, @shanebp

    Oh no, not all this is happening in the one customised plugin. I was simply describing what appears to be happening in the system as a whole when you hit the Submit button in the customised post. This thing is one tortured mass of plugins. 🙁

    The Custom post page is generated by Gravity Forms. This is the plugin that handles creating a post & saving it.

    The Add-a-Post-to-Activity-Stream-so-it-sends-an-Email-Like-an-Update is provided by a custom plugin that extends the functionality of BuddyPress Group Email Subscription.

    It just seems that the timing’s out a bit.

    If I can make the postmeta handling occur before the post is added to the Activity Stream, then all will be well, as my own trivial addition to this will be fine.

    I’ll take a look at wp_mail. I thought that Buddypress may override what happens in there.

    Thanks for that & apologies for posting in the wrong part of the forum. Just noticed that.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sending an email from activitystream – can we delay it a bit?…’ is closed to new replies.
Skip to toolbar