contents

mostra solo

contenenti anche

Notes  

Drupal: show content only to anonymous / authenticated users

tags: Drupal   php snippets  
drupal tags: users   contents  

Is very easy to show some contents to anonymous AND some other to authenticated users in Drupal. You'll only need to adapt the following few lines of php to output your content:

<?php
global $user;
if (!
$user->uid) { ?>

    <div>anonymous content here</div>
<?php } else { ?>
    <div>authenticated content here</div>
<?php } ?>

Yep, that easy.

Notes  

Show different content to anonymous and authenticated users

tags: Drupal   php snippets  
drupal tags: users   contents  

<?php
/**
* The following simple snippet
* displays different information to anonymous/logged in users within a page.
*
* This works with drupal 4.5 and drupal 4.6
*/
global $user;
if (
$user->uid) {
    return
"This message is only visible for logged-in users.";
}
if (!
$user->uid) {
    return
"This message is only visible for not-logged-in users.";
}
?>

Add to calendar

Archives

February 2012
SunMonTueWedThuFriSat
1234
567891011
12131415161718
19202122232425
26272829
PureDivs Drupal Themes Conversions
PureDivs Conversione Temi Drupal