Look at this thread - it explains how to be able to add user attributes placeholders in your emails. Hope that helps!

To all forum users: Search the forums when you got a question first! Your question may have already been asked many times before and also many times answered. The search feature is your best friend on any forums of this kind!

I have come up with a solution to the problem of Placeholders not being processed in System Emails (eg subscribe etc - See Issue 3288). I'm just new to phplist, but was disappointed that the first email a user receives after registering weren't able to be personalised... A bit of a letdown, as personalisation was the reason I went with phplist

This is what I did. First, I created two functions in the file admin/commonlib/lib/userlib.php. The first processes Custom Placeholders (user-defined), the second some System-defined Placeholders:

/* Function works successfully. I guess it needs some sort of check to make sure parameters are supplied???
(to avoid a crash if $systemmessage or $userid are not supplied)
Someone should check for insecurities/inefficiencies as I don't know php well */

(As an aside, I have shortened the second procedure above to only those ones which successfully work. I show the full one below with all my comments and the placeholders which don't work. Someone eslse may have more success).

It seems to process Custom (userdefined) placeholders fine; since I don't know php or sql very well, I wasn't able to get any more of the Globals working (see Full Function below). Maybe someone with a bit more skill can do so...

As I mentioned, I don't know php, so someone really needs to go through it and check the code for insecurities/inefficiencies etc. For now my Custom Placeholders are showing up in (un)subscribe emails, along with system placeholders [DOMAIN] and [WEBSITE], so that's a start until someone else can get the rest of the System placeholders working (or at least those that are meant to according to documentation http://docs.phplist.com/Placeholders.

I guess the concept could also be extended to not just the message body, but the subject line of (un)subscribe emails too... Another day.

As mentioned above, I list the full Builtin Placeholders function below. I only have a few builtins working (limited by lack of php & sql knowledge).

--- FULL FUNCTION ---

function RJC_ReplaceBuiltinPlaceholders($systemmessage = '',$userid = 0) {
/* Function to replace Builtin Placeholders with the proper values from the database
PS: Made so that placeholders are replaced in System Messages (eg Subscribe/Unsubscribe emails)
(See Issue 3288):
NOTE: Does it cause a clash with specs as listed http://docs.phplist.com/Placeholders (eg Allowed In)???
Maybe some of these should be removed from this function to avoid any problems??? */

/* The commented lines don't work successfully; someone who's more adept at select tables
should be able to help us out here...
I assume it needs to select tables from database for various user info; don't know php and sql enough
to do it confidently. */

/* I guess the function needs some sort of check to make sure parameters are supplied???
(to avoid a crash if $systemmessage or $userid are not supplied)
Someone should check for insecurities/inefficiencies as I don't know php well */

/* I guess for completeness I should put the lot, even [LISTS] is already processed (eg in index.php).
In theory, if they've already been processed in index.php, then the placeholders won't exist when this function is run, so
no harm done. This needs to be verified */
// $systemmessage = ereg_replace('\[USERDATA\]', /*something goes here*/, $systemmessage);
// $systemmessage = ereg_replace('\[LISTS\]', /*something goes here*/, $systemmessage);

//upcase the keys here because the format within email messages is the [UPPER CASE] $user_att_values_upper=array_change_key_case($user_att_values, CASE_UPPER); $condition_regex = '/\{CONDITIONAL\|\[(.*?)\]\|(.*?)\|(.*?)\}/si';

/** * We want to modify both the htmlmessage and the textmessage * We want to do that that by using the same code for both, but without using a function * The easiest way to do that is by putting both variables in an array by reference and loop through * that array. */ $changemessages = Array(&$htmlmessage, &$textmessage);

wow amazing add-on! Almost all confirmation mails are in html and with the attributes.

The only mail that doesn't work with the HTML is the mail when the user has changed it's information.Does anyone know how to make this work?

*** Update: The problem with the changed information e-mail is the fact that somewhere in the code the it puts a '\' before every "-sign. Does someone know how to solve this issue? It seems to be a PHP thing called 'addslashes', but I can't find the problem in the LIB file

I can't seem to get this mod working. I have checked and rechecked my code. I'm not great a php. Can someone take a look at my code (admin/lib) and let me know if I'm doing something wrong. Thank you for any suggestions: