How to add the profile details in the email notification?

Started by PLAYBOY, September 24, 2018, 05:05:21 AM

Previous topic - Next topic

PLAYBOY

Visitors has to answer some questions to apply for a membership in my forum. Once they applied I get a notification to check their profile and approve/disapprove their applications based on their answers for those questions.

But the email notification I get has only their profile link, pending memberships link.

Is there anyway, I can add their profile details (which has the answers to the membership questions also) into that notification email?

PLAYBOY

Is it a very hard problem to solve? Is there not anyone that can help me on this please?

Sir Osis of Liver

For reasons unknown, custom profile fields, which I assume you are using for membership questions, are stored in smf_themes table.  Don't know if that info is available when notification email is created, I doubt it.  You may have to add a db query to retrieve the fields and add them to the email.  You have to go to the forum anyway to approve/reject the registrant, is it a big problem to view their profile?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

PLAYBOY

Quote from: Sir Osis of Liver on September 24, 2018, 10:05:25 PM
For reasons unknown, custom profile fields, which I assume you are using for membership questions, are stored in smf_themes table.  Don't know if that info is available when notification email is created, I doubt it.  You may have to add a db query to retrieve the fields and add them to the email.  You have to go to the forum anyway to approve/reject the registrant, is it a big problem to view their profile?


Thank you for the help. It is a big problem to go to the forum for every application because we accept only 1/10 of the applications. So If I could see their application without going to the forum every time, it could really help me.

I don`t think I`m using a mod for this. It`s in the Profile fields section as you can see in the attached image

Can someone please help me on this?

Sir Osis of Liver

It's not a mod, custom profile fields is a core feature.  Would require some coding to retrieve the fields from db and add them to email.  Somewhat beyond me.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

PLAYBOY

Do you know any mod that will do the job? or anyone that is going to be willing to help on this?

I can`t believe there`s no code that is already in the files that I can just add into the email like [profile_details] and it`ll send me the entire profile as well other stuff

Sir Osis of Liver

I think the email parameters come from Subs-Post.php -



function loadEmailTemplate($template, $replacements = array(), $lang = '', $loadLang = true)
{
global $txt, $mbname, $scripturl, $settings, $user_info;

// First things first, load up the email templates language file, if we need to.
if ($loadLang)
loadLanguage('EmailTemplates', $lang);

if (!isset($txt['emails'][$template]))
fatal_lang_error('email_no_template', 'template', array($template));

$ret = array(
'subject' => $txt['emails'][$template]['subject'],
'body' => $txt['emails'][$template]['body'],
);

// Add in the default replacements.
$replacements += array(
'FORUMNAME' => $mbname,
'SCRIPTURL' => $scripturl,
'THEMEURL' => $settings['theme_url'],
'IMAGESURL' => $settings['images_url'],
'DEFAULT_THEMEURL' => $settings['default_theme_url'],
'REGARDS' => $txt['regards_team'],
);


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Those are just the default replacements; any place that sends an email can pass in additional replacements.

As for why they're in the themes table, originally a combination of 'it's the only place where an arbitrary amount of items can be stored for any individual user' and 'too lazy to do it more cleanly'.

PLAYBOY

So is there anyway to add profile details i nthe email through any of the methods? if so, can you help me out on this please?

Advertisement: