0

Is there a way for me to access specific information from the apostrophe-users module in a page template?

For example, if I added a "nickname" field to apostrophe-users and would like to show a personalized welcome message on the home page to every user, is there a way to do something similar to

<p>Hi, {{ data.user.title }}</p>

in home.html but instead showing the nickname?

{{ data.user.nickname }} currently gives me nothing. Is there another solution?

viridius
  • 3
  • 2

1 Answers1

0

If you add a nickname field to apostrophe-users at project level you should have access to that property in your template, as you outline.

A basic implementation would look like:

In your /lib/modules/apostrophe-users/index.js

module.exports = {
  addFields:[
    {
      name: 'nickname',
      label: 'Nickname',
      type: 'string'
    }
  ]
}

Would give you access to {{ data.user.nickname }}

Stuart Romanek
  • 2,157
  • 1
  • 7
  • 9