|
Use User Profile Fields in AdminCP Emails
This modification is in the archives.
This is a very quick mod. This is my first release, so I appologize if I've missed any normal verbage or protocols.
I tried to make this simple, but I'm not the best at explaining things. Let me know if you have any questions and I'll do my best to help you out. This was requested here: index.php?t=150947 This mod will allow you to insert your custom User Profile Fields into emails sent via AdminCP. I have not tested it, but this might work for other mods that use the email.php script in admincp. See below for the modification. You can also download the attached txt file if you wish. ** This mod requires that you edit a core file. If you upgrade, you will need to re-edit the file. ** In the following examples, I have created a field, field12, that holds 'Game Version'. This mod works best for text fields and single drop-down lists. Step 1: Noting Your Fields Go to your User Profile Fields and make note of which fields you want to use in your emails. Also make note of the field Name, seen to the left of Display Order (i.e. field12). Step 2: Editing File Open admin/email.php - make a backup just in case! Step 3: Pulling fields from database Around line 130, find Code:
SELECT user.userid, user.usergroupid, user.username, user.email, user.joindate, useractivation.activationid After add Code:
, userfield.field12 Add additional ones if you have multiple fields you want to use in your emails. Your lines should look something like this: Code:
SELECT user.userid, user.usergroupid, user.username, user.email, user.joindate, useractivation.activationid, userfield.field12 Step 4: Naming the Variables In this step you will name the variables that you use in your email. Just like $username inserts the member's username, you will want to choose something easy to remember and short. I've chosen $gameversion. Around line 163, find Code:
array('$email', '$username', '$userid'),
After '$userid' add the variable you want to use, including the dollar sign. Code:
, '$gameversion' Your line 163 should look something like this: Code:
array('$email', '$username', '$userid', '$gameversion'),
Around line 164, find Code:
array($user['email'], $user['username'], $user['userid']), After $user['userid'] add in $user['X'] where X is the field's name. Code:
$user['field12']), Your line 164 should look like this: Code:
array($user['email'], $user['username'], $user['userid'], $user['field12']), Step 6: Testing You DID make a backup copy, right? Good! Now, save and upload the email.php file, and send an email to yourself via AdminCP using your spiffy new variable!
Download
This modification is archived, downloads are still allowed. |
|||||||||