Last updated July 16, 2009. Created by mathieso on July 16, 2009.
Log in to edit this page.
If a user is not a member of any groups, the My Groups block can still show.
To hide the block when the user is not a member of any groups, do the following:
1. Go to admin/build/block
2. Find the My Groups block. Click the Configure link.
3. Scroll down to "Page specific visibility settings." Check "Show if the following PHP code returns TRUE"
4. Paste this in the <textarea>:
<?php
global $user;
$uid= $user->uid;
$sql = "SELECT COUNT(*) FROM {og_uid} WHERE uid = %d";
$cnt = db_result(db_query($sql, $uid));
return $cnt > 0;
?>5. Click the "Save block" button.