buddypress-group-email-subscription icon indicating copy to clipboard operation
buddypress-group-email-subscription copied to clipboard

Items in digests should have "Reply to thread" mailto link when RBE is active

Open boonebgorges opened this issue 7 years ago • 6 comments

A client is migrating from a proprietary system to BP + BPGES + RBE. The proprietary system has a cool feature in digest emails where each item has a "Reply to Thread" mailto link. I wonder if BPGES could do something similar: when RBE is detected, ask RBE for the appropriate Reply-To address, and then put a button into the digest near the "View" link.

@r-a-y Is this pretty easy to do? Do you think it's worth putting into BPGES itself? I can always do it in a client-specific plugin, but it seems to me that this might be generally useful.

boonebgorges avatar May 30 '17 17:05 boonebgorges

It should be quite straightforward for forum items.

You need to create the correct querystring with the following: bbpg=GROUP_ID&bbpt=TOPIC_ID

If there is a bbPress reply ID then the querystring needs to be: bbpg=GROUP_ID&bbpt=TOPIC_ID&bbpr=REPLY_ID

I believe these parameters should be available in the digest item generation function.

Then, use the following to generate the Reply-To email address:

			$querystring = apply_filters( 'bp_rbe_encode_querystring', bp_rbe_encode( array( 'string' => $querystring ) ), $querystring );

			// Inject the querystring into the email address
			$address = bp_rbe_inject_qs_in_email( $querystring );

The main issue is this would only show up for forum items in the digest and not any other items.

If we are going to add this into GES, we should add this for group activity items as well. We might have a problem with how group activity comments are parsed and recorded for GES emails, but this will probably need some investigation.

r-a-y avatar May 30 '17 17:05 r-a-y

Hi @r-a-y - I've got this mostly working, but I can't seem to get the querystrings right - they sometimes match, but generally do not. I'm having a hard time debugging because I'm on WP Engine and can't set up a proper log. Any chance you'd mind looking it over to see if anything jumps out at you?

https://gist.github.com/boonebgorges/600e646e9b988cf7adc9207083b7488e

boonebgorges avatar Jun 07 '17 20:06 boonebgorges

What does the RBE log show?

If you need to change the RBE log path, define BP_RBE_DEBUG_LOG_PATH to a writable directory.

r-a-y avatar Jun 07 '17 21:06 r-a-y

Ohh! Take back my bug report. I'm using an IMAP connection, and it's acting flaky. The replies came through - they just took a long time.

It's weird, though - the hashed querystrings I'm generating in the Gist end up being different from the ones in the "All Email" notifications I get. Maybe RBE is adding more params to the hash before the regular email is sent? Does it make sense that foo and bar in [email protected] and [email protected] could both represent the same bbpg, bbpt, and bbpr? (Like, maybe they're being assembled in a different order?)

boonebgorges avatar Jun 07 '17 21:06 boonebgorges

Ohh! Take back my bug report. I'm using an IMAP connection, and it's acting flaky.

With IMAP, if you make any changes, you must deactivate the plugin and reactivate it to start fresh. Otherwise, RBE will use the older code that is in memory.

Not really related, but I would recommend using the IMAP auto-connect option in the RBE settings page. Actually, not sure how WP Engine handles long-running processes that is initiated via HTTP, so you might want to ignore this advice! :)

Does it make sense that foo and bar in [email protected] and [email protected] could both represent the same bbpg, bbpt, and bbpr? (Like, maybe they're being assembled in a different order?)

This. The hash might be different, but all that matters is when RBE decoded that hash and what parameters get parsed. If you are not getting the correct parameters, then something is wrong somewhere. The RBE debug log will tell you what parameters have been parsed, so start there.

r-a-y avatar Jun 07 '17 21:06 r-a-y

With IMAP, if you make any changes, you must deactivate the plugin and reactivate it to start fresh. Otherwise, RBE will use the older code that is in memory.

Aha. I'd made my changes in a different plugin, but I guess the entire WP application is running in a separate thread. I'll keep this in mind.

This. The hash might be different, but all that matters is when RBE decoded that hash and what parameters get parsed. If you are not getting the correct parameters, then something is wrong somewhere. The RBE debug log will tell you what parameters have been parsed, so start there.

Well, in my case, the log is telling me that the paramaters are being parsed correctly, so there's not much need for further debugging. I just found it a bit mysterious that the email addresses looked different. I'll refrain from touching my house of cards :-D

boonebgorges avatar Jun 07 '17 21:06 boonebgorges