My php isn’t amazing and I’m struggling with retrieving the value of a field in the UAM database so I can show a menu to only logged in users in the group I created called “members”.
I got as far as this…
<?php global $wpdb; $members = $wpdb->get_var( "SELECT * FROM diamint_uam_accessgroups GROUP BY groupname ORDER BY groupname LIMIT 0, 30"); echo '<p>User is in group '.$members . '</p>'; ?>
Returns “User is in group 1” (regardless of whether or not you’re logged in – so it’s not quite what I need)
I need to get the correct syntax for the following…
<?php if ( $user_ID) && ( $members = "1") ?> <?php wp_nav_menu( array('menu' => 'Members' )); ?> <?php else : ?> <?php wp_nav_menu( array('menu' => 'Main Nav' )); ?> <?php endif; ?>
[Please post code snippets between backticks or use the code button.]
- The topic ‘IF/Else – how to show menu to members in UAM group’ is closed to new replies.