开发者

Wordpress Membership Plugin Conditional Statement

I have plugin by WPMU that creates a membership system for your wordpress theme. Im trying to make it display a gallery only when a user is a premium member and Im completely lost. My code basicly grabs part of the url and pastes it into variables in my susbscription div to draw the information needed. I need it to check if the user is logged in but Im not sure how to do that. Here is my code, Thanks:

<?php get_header(); ?>
<?php
$url = $_SERVER['REQUEST_URI'];
$url = rtrim($url, '/');

function drawId($url) {
    return array_pop(explode('-', $url));
}
?>

<div class="main-container col2-right-layout">

    <div class="main">
    <p><?php echo drawId($url); ?></p>
    <?php get_template_part('loop');?>

    <div id="subscription">
    <p><?php echo nggcf_get_gallery_field(drawId($url), "Gallery Text"); /* where 1 is the gallery id */ ?></p>
    <?php echo do_shortcode('[nggalle开发者_开发技巧ry id='.drawId($url).']');?>
    </div>
    </div><!-- .main -->
</div><!-- .main-container col2-right-layout -->
<?php get_footer(); ?>


The following is copied and pasted from the plugin's support forms:

you can try any of the following for your customization needs:

current_user_is_member()

current_user_on_level($level_id)

current_user_on_subscription($sub_id)

And of course, you can get the level_id and sub_id from the respective membership level and subscription lists.


if you want to check if a user is logged in, in wordpress, it is just a condition like this:

if(is_user_logged_in()){
     //do you stuff
}

hope this help. read more here


This plugin allows only people that are logged in to your site to use the site: http://wordpress.org/extend/plugins/private-wp/

Maybe by creating memberships though your admin panel you could target the the user in that way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜