[2.2] - Set `rank` when using modUser->joinGroup

Current behavior always set the rank to 0, which could lead to changing the "primary group".

Please, let me know if you need some more details.