Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Email address and registered timestamp in VanillaForums?

I need to integrate with a custom VanillaForums theme running on Vanilla 2.1.11, and requires the following:

      window.intercomSettings = {
        // TODO: The current logged in user's full name
        name: "{screen_name}",
        // TODO: The current logged in user's email address.
        email: "{email}",
        // TODO: The current logged in user's sign-up date as a Unix timestamp.
        created_at: "{created_at}",
        app_id: "{app_id}"

Screen name is easy, I can just use {$User.Name} -- but after doing {$User|@debug_print_var} it doesn't look like I have access to the logged in user's email address nor when their account was created at.

How would this be accomplished?

Best Answer


  • Options
    hgtonighthgtonight ∞ · New Moderator
    edited June 2015

    I assume you are adding this script via editing your default.master.tpl file. You can make more information available via a Smarty plugin. Or you could add the generated script via a plugin hook.

    E.g. :

        public function base_afterRenderAsset_handler($sender) {
            if($sender->EventArguments['AssetName'] === 'Head' && $sender->MasterView != 'admin') {
                $script = "jQuery(document).ready(function($) {
                echo Wrap($script, 'script', array('type' => 'text/javascript'));

    Or you could add the pertinent information via a definition and then reference it in a standard external JS script.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    I already have a plugin that I use from Peregrine that exposes member roles via a Smarty tag e.g. {check_role name="Member"} -- I was thinking about extending it to add functions that return the logged in user's email address and creation time (as a Unix timestamp) of the user account.

    But I'm not sure where to get that information? I was pouring over the UserModel class looking for the info, but it feels a bit needle in haystack-ish.

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Not sure about how you want to use it, but the users "properties" you can get from the user model should be the columns the user table has. So look at your dbs table GDN_User and you will find a column "DateInserted" which should hold the information you are looking for. You can access the column if you have a user object simply by using $User->DateInserted

  • Options

    Okay, sorry for being so dense about this but... how can I get the user object for the currently logged in user?

  • Options

    @R_J that did the trick, thanks for the assistance, I have it working now!

Sign In or Register to comment.