> identify [...] the current visitor

    var callback = function(user) {
        // user's an object with members anon and name
        // user.anon is true if the current user is not logged in
    };
    config.extensions.tiddlyweb.getUserInfo(callback);

Combined with the recent snippet about retrieving space members*:

    config.extensions.tiddlyweb.getUserInfo(function(user) {
        if(user.anon) {
            // unknown visitor
        } else {
            var host = config.extensions.tiddlyweb.host;
            var space = config.extensions.tiddlyspace.currentSpace.name;
            space = new tiddlyweb.Space(space, host);
            space.members().get(function(members, status, xhr) {
                if(members.contains(user.name)) {
                    // space member
                } else {
                    // logged-in user
                }
            }, errback); // error callback to be defined
        }
    });


-- F.


* http://groups.google.com/group/tiddlywiki/msg/1184193d6e685b6c

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywikidev?hl=en.

Reply via email to