Drupal 6: How to determine if User is Logged In or not

In Drupal, data for the current user is stored in the global variable $user. To determine if the user is logged in, use the following code:

Drupal 6: Custom Online Members Block

With the help of some PHP codes, showing a block that contains a list of your site's online members can be achieved (with a left floating picture beside each member name). The code was adopted from the Drupal 6 core, User Module. We all know that there is already a bundled block for this with Block name Who's-Online. But if you really want to do more about it, like adding a user picture, then you can do so with Blocks (I'm pretty sure you can do this with Views as well). And don't forget to enable PHP-Filter module. This can be found at admin/build/modules/list under Core-Optional modules. Then select PHP Code option among the list of Input Formats available when creating the new block.

Drupal 6: Random content using Views

Retrieving database content in Drupal 6 has never been easier with Views Module. But, what if you wanted to get the results in random order? Well this is so simple.
  • open your Views for editing. Create one if you haven't done so.
  • in the Sort Criteria section, click the Add button then select Global:Random.

With the rest of this particular Views configurations all set, go hit the Preview button. Seeing the results in Random, hit Preview once again.

And there you have it.

Bookmark and Share