Not being able to register a user to shared roster group to my ejabberd server using php script

253 Views Asked by At

I have a few departments in our workplace. Whenever we register a new employee, we need to register this employee to this department so that all other members in the department can see him/her and also chat with him/her.

What should be the best way to do this? should I use MUC or shared roster groups. I want to do this using a php's script.. how can I do this?

1

There are 1 best solutions below

8
Badlop On

Gow to ejabberd's WebAdmin -> your vhost -> Shared Roster Groups -> and create a group "department1", with Displayed groups: department1.

Then, you can add accounts to that group by calling this command, for example:

$ ejabberdctl srg_user_add user1 localhost department1 localhost

Try this, check it works as you want, and later you can see how to call this command using PHP. If you enable ejabberd_xmlrpc you can make XML-RPC queries to ejabberd. Or if you install mod_rest (from ejabberd-contrib git repository), you can use ReST calls.