Skip to content
Extended Meteor.userId() and Meteor.user()
CoffeeScript JavaScript
Branch: master
Clone or download
Latest commit 0fe25b5 Sep 19, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial version. Dec 19, 2015
.travis.yml Initial version. Dec 19, 2015
.versions Version bump. Sep 20, 2019
LICENSE Initial version. Dec 19, 2015
README.md Update for Meteor 1.5.1. Jul 16, 2017
lib.coffee Initial version. Dec 19, 2015
package.js Version bump. Sep 20, 2019
server.coffee Update for Meteor 1.5.1. Jul 16, 2017
tests.coffee Use Mongo.Collection. Dec 20, 2015

README.md

Extended Meteor.userId() and Meteor.user()

Adding this package to your Meteor application:

  • makes Meteor.userId() work also inside the publish endpoint functions (even for Meteor versions prior to 1.5.1)
  • prevents direct modification of the user's profile from the client, which is otherwise allowed by Meteor
  • extends Meteor.user(userId) into Meteor.user(userId, fields) which now accepts an argument to limit queried fields (and thus function's reactivity); userId is optional and if not specified Meteor.userId() is used instead

Both client and server side.

Installation

meteor add peerlibrary:user-extra

Examples

Template.user.helpers({
  username: function () {
    var user = Meteor.user({username: 1});
    return user && user.username;
  }
});
You can’t perform that action at this time.