candy-plugins icon indicating copy to clipboard operation
candy-plugins copied to clipboard

Help Required: Custom hardcoded text colors

Open websterz opened this issue 7 years ago • 0 comments

Hello, I just started plugin development, and my first plugin is very simple which just replaces all the text messages according to roles, like for admins it will be red and for moderators it will be orange, and for normal users it will be black.

I have following code which adds simple text to the message but i am not able to get the roles of the users who sent message.

I tried different techniques but failed to get roles.

Here is my code, can any body suggest how do i get roles:

var CandyShop = (function(self) { return self; }(CandyShop || {}));

CandyShop.Roles = (function(self, Candy, $) {
	self.init = function init() {			
		$(Candy).on('candy:view.message.before-show', function(e, args) {			
			args.message = args.message+ ' - admin';// + self.Role();			
		});
	};
	return self;
}(CandyShop.Roles || {}, Candy, jQuery));

Thank you!

websterz avatar Mar 08 '17 10:03 websterz