How to let only registered users see the link?

Asked

Viewed 29 times

-1

I have a site that already has restricted access to logged in users to post link. but I am not able to make the posted links visible only to registered users, please all help is welcome.

Follows code:

$register    = get_option('dt_register_user');
$idts        = get_post_meta($post->ID, "dt_string", $single = true); 
$return        =  return_links( $idts );
if($return == 1) {
?>

<div class="linktabs">
    <h2><?php _d('Links'); ?></h2>
    <ul class="idTabs">
        <?php /* set 1 */ if(count_type_link($idts, __d('Download')) == 1) { echo '<li><a href="#downloads">'. __d('Download'). '</a></li>'; } ?>
        <?php /* set 2 */ if(count_type_link($idts, __d('Torrent'))  == 1) { echo '<li><a href="#torrent">'. __d('Torrent'). '</a></li>'; } ?>
        <?php /* set 3 */ if(count_type_link($idts, __d('Watch online'))  == 1) { echo '<li><a href="#views">'. __d('ASSISTIR ONLINE CLIQUE ABAIXO'). '</a></li>'; } ?>
    </ul>
</div>

<?php if(count_type_link($idts, __d('Download'))  == 1) { ?>
<div id="downloads" class="sbox">
    <div class="links_table">
        <?php get_dt_links( $idts, __d('Download') ); ?>
    </div>
</div>
<?php } if(count_type_link($idts, __d('Torrent') )  == 1) { ?>
<div id="torrent" class="sbox">
    <div class="links_table">
        <?php get_dt_links( $idts, __d('Torrent') ); ?>
    </div>
</div>
<?php } if(count_type_link($idts, __d('Watch online') )  == 1) { ?>
<div id="views" class="sbox">
    <div class="links_table">
        <?php get_dt_links( $idts, __d('Watch online') ); ?>
    </div>
</div>
<?php } } if( is_user_logged_in() ) {  ?>
<div id="form" class="sbox">
    <div class="links_table">
        <?php get_template_part('inc/parts/form_links'); ?>
    </div>
</div>
<?php } elseif($register == 'true') { ?>
<div id="form" class="sbox">
    <div id="resultado_link_form">
        <div class="msg"><i class="icon-notification"></i><a class="clicklogin"><?php _d('Entrar'); ?></a> <?php _d('para postar links'); ?></div>
    </div>
</div>
<?php } ?>

1 answer

1

Face the question there is the following, you need to check if the user’s SESSAO is open to display the links, I’ll give you an example

if(isset($_SESSION['logado']) == true){
        include './menu/menulogado.php';
    }else{
        include './menu/menu.php';
    }

in this case when my user logs in I create the logged in Sesame, and when it is on the page I check if it is true to load the correct menu, in your case you would exchange it for the urls

Browser other questions tagged

You are not signed in. Login or sign up in order to post.