Getting problem while getting group id of current logged in user
I would use api to find groups of logged in user

$result = civicrm_api3('Contact', 'getsingle', [
  'return' =&gt; ["group"],
  'id' =&gt; 'user_contact_id',
]);

or 

$result = civicrm_api3('GroupContact', 'getsingle', [
  'return' =&gt; ["group_id"],
  'contact_id' =&gt; 'user_contact_id',
]);


HTH

Pradeep