Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have managed to always get by with the Content Access module to perform what you are asking.</p> <p>You could also try it within the code for the page by wrapping it inside a section of code that limits who can see that code, such as;</p> <pre><code>&lt;?php global $user; if($user-&gt;roles[3] || $user-&gt;roles[4]){ //only for admins or moderators } if($user-&gt;roles[0] || $user-&gt;roles[1] || $user-&gt;roles[DRUPAL_ANONYMOUS_RID] || user_is_anonymous()){ //everyone else } ?&gt; </code></pre> <p>You could also target the allowable sections by user Id, although you would need to know the ID in question first, for example the admin would be <code>$user-&gt;uid[1]</code></p> <p>with regards to length of membership you can get the date the user was created by accessing the created value in the user table which should return a unix timestamp. <code>$usercreated=$user-&gt;created;</code></p> <p>To convert this to a more readable date you can use <code>PHP</code>'s <code>strftime()</code> function as such; <code>$usercreated=date('d M, Y',strftime($user-&gt;created));</code></p> <p>To work out the amount of days that a user has been registered for you can always try: <code>$days_since=abs(ceil(( strtotime("now") - $user-&gt;created )/86400));</code></p> <p>For a listing of all the available user hooks have a look at <a href="http://api.drupal.org/api/drupal/developer--globals.php/global/user/6" rel="nofollow">http://api.drupal.org/api/drupal/developer--globals.php/global/user/6</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload