I have a server running where I use php to run a bash script to verify certain information of a user. For example, I have a webhosting server set up, and in order to be able to
I know this is probably old thread but just in case this also works well:
id -Gn "username"|grep -c "groupname"
if any number > 0 is returned then user is a member of that group.