I really need help. I have been researching this, and all I've accomplished is confusing myself even more!
I have a page that allows the user to edit an email. The text within the TinyMCE textarea is saved to the database. I need it to be able to use shortcuts such as [ShipDate] and [TrackingNumber], and then when the user clicks "Send Email", I will extract every one of these and replace it with a value from the database.
I am trying to figure out how to integrate preg_replace to accomplish this, but I'm confused by all the symbols that follow it, so I have no clue as to how I would signify the different types ([ShipDate] vs [TrackingNumber], etc.) I'm also not sure how to make sure it gets ALL of the "variables" from the text.
I also tried to figure out if there was a way to add a shortcode button to TinyMCE that would allow the user to simply click a button to insert the ship date, then process it when the email was sent, but didn't have any luck there either.
Can anyone help me figure out the best way to do this? An email may look like this:
Your order has shipped on [ShipDate] by [ShippingMethod]. Your tracking number is [TrackingNumber]. To track your order, go to [TrackingURL].
Can anyone help? I appreciate it!!!