Skip to content

Instantly share code, notes, and snippets.

@josephhinson
Created May 20, 2015 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephhinson/773ffb9ab88cf50c5bd0 to your computer and use it in GitHub Desktop.
Save josephhinson/773ffb9ab88cf50c5bd0 to your computer and use it in GitHub Desktop.
Wishlist Member Levels and Login Form
<?php ?>
<div class="member-login">
<?php if (is_user_logged_in()):
$loggedin = true;
$user = wp_get_current_user();
$levels = WLMAPI::GetUserLevels($user->ID);
$getlevels = WLMAPI::GetLevels();
endif; ?>
<a class="button" href="javascript:void(null);" onclick="jQuery('.dropdown-box').toggle();">
<?php if ($loggedin): ?>
My Membership
<?php else : ?>
Login
<?php endif; ?>
</a>
<div class="dropdown-box<?php if($loggedin) : ?> loggedin<?php endif; ?>" style="display:none;">
<?php if ($loggedin): ?>
<div class="courselinks">
<?php foreach ($levels as $level=>$levelname) {
$redir_id = $getlevels[$level]['loginredirect'];
?>
<p><a href="<?php echo get_permalink($redir_id); ?>"><?php echo $levelname; ?></a></p>
<?php } // endfor ?>
<p><a href="<?php bloginfo('url'); ?>/wp-admin/profile.php">Edit My Profile</a></p>
<p><a href="<?php echo wp_logout_url(); ?>">Logout</a></p>
</div>
<?php else : ?>
<?php wp_login_form(); ?>
<?php endif; ?>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment