Group tag not displayed by default on posts.


  • GNU/Linux

    When a new user is added to the system via oauth i have some logic setup to add them to a specific user group depending on some data from my main application, very similar to the built-in isAdmin check.

    The user is added to the group successfully but when they make a post the group tag is not displayed. They have to go into their user profile settings and select the group, even if they only have one.

    I'm running 0.7.0-dev if that helps.


  • GNU/Linux

    Already asked @psychobunny for a setting for this, also to display multiple groups (or as much that would fit into the theme being used).

    Also ability to hide the admin created groups from user created groups under the tab.

    Rewards essentials plugin works well, just needs functionality for all this I think to kick it into gear. Another plugin developer was also developing a plugin that made proper use of all this also. 0.7.0 release may have all this anyway 👍 which should be soon


  • GNU/Linux

    @Codejet Yea, I saw your post and almost replied but I thought since @psychobunny said it might be a bug it's worthy of it's own thread.

    Multiple group tags and group tag weighting would be nice but right now I'm just trying to get everything that "should" work working so I can open the forum to the users.


  • GNU/Linux

    I'd be satisfied for a way to force the group as "active" or "displayed" on the user, just not sure how to do that.

    Here's the modified code from the nodebb-plugin-sso-oauth by @julien for my site integration if it helps. I heard in 0.7.0 there were some changes to the user object so this issue may be caused by an incompatibility in this plugin since it was made for 0.6.x I assume.

    OAuth.login = function(payload, callback) {
    	OAuth.getUidByOAuthid(payload.oAuthid, function(err, uid) {
    		if(err) {
    			return callback(err);
    		}
    
    		if (uid !== null) {
    			// Existing User
    			callback(null, {
    				uid: uid
    			});
    		} else {
    			// New User
    			var success = function(uid) {
    				// Save provider-specific information to the user
    				User.setUserField(uid, constants.name + 'Id', payload.oAuthid);
    				db.setObjectField(constants.name + 'Id:uid', payload.oAuthid, uid);
    
    				if (payload.isAdmin) {
    					Groups.join('administrators', uid, function(err) {
    						callback(null, {
    							uid: uid
    						});
    					});
    				} else {
                        // --- My Modifications --- //
    					if (payload.role == '6') {
    						Groups.join('VIP', uid, function(err) {
    							callback(null, {
    								uid: uid
    							});
    						});
                        // -- End -- //
    					} else {
    						callback(null, {
    							uid: uid
    						});
    					}
    
    				}
    			};
    
    			User.getUidByEmail(payload.email, function(err, uid) {
    				if(err) {
    					return callback(err);
    				}
    
    				if (!uid) {
    					User.create({
    						username: payload.handle,
    						email: payload.email
    					}, function(err, uid) {
    						if(err) {
    							return callback(err);
    						}
    
    						success(uid);
    					});
    				} else {
    					success(uid); // Existing account -- merge
    				}
    			});
    		}
    	});
    };

  • Admin

    They have to go into their user profile settings and select the group, even if they only have one.

    Yeah, let me add this as an issue to our tracker, happened to forget about this

    EDIT: https://github.com/NodeBB/NodeBB/issues/3118


Log in to reply
 

Suggested Topics

| |