![]() |
Use User Profile Fields in AdminCP Emails
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: https://vborg.vbsupport.ru/showthread.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, 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, 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! Quote:
|
Will be great if this was done via plugins...
|
Sorry, I don't know how to do that :(
|
Quote:
|
This is a great idea. :)
|
Quote:
|
This mod still works for 3.7, although I haven't figured out how to add it to that section :)
If you have upgraded and use this mod, please remember to re-edit your files! |
All times are GMT. The time now is 09:17 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|