Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More correct pattern for publishing user.

Long, but probably better to show the pedantically correct thing so users don't
get hurt if they copy, paste and modify.

Fixes #1885
  • Loading branch information...
commit 8924417e23efb986984c5b77f5e1b6b8ea706591 1 parent f9c947a
@n1mmy n1mmy authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 docs/client/api.html
View
14 docs/client/api.html
@@ -1585,11 +1585,19 @@ <h2 id="accounts_api"><span>Accounts</span></h2>
published to the client. You can publish additional fields for the
current user with:
- Meteor.publish(null, function () {
- return Meteor.users.find({_id: this.userId},
- {fields: {'other': 1, 'things': 1}});
+ // server
+ Meteor.publish("userData", function () {
+ if (this.userId) {
+ return Meteor.users.find({_id: this.userId},
+ {fields: {'other': 1, 'things': 1}});
+ } else {
+ this.ready();
+ }
});
+ // client
+ Meteor.subscribe("userData");
+
If the autopublish package is installed, information about all users
on the system is published to all clients. This includes `username`,
`profile`, and any fields in `services` that are meant to be public
Please sign in to comment.
Something went wrong with that request. Please try again.