ARCHIVE: Recent weblog entries (titles) snippet

PLEASE NOTE! These snippets are user submitted. It is impossible to check them all, so please use at your own risk! For users who have setup drupal using an alternate database to the default (MYSQL), please note that the snippets may contain some database queries specific to MYSQL.

Description

This php snippet displays a list of the (x) most recent weblog titles and links to the full blogs

Dependencies: blog.module must be enabled.

Thanks to Thinkinkless and Incidental for help with improving this snippet!

Usage

  • For use in your user profile page override
  • Using a text editor like NOTEPAD.EXE or an equivalent, copy and paste the code into your user_profile.tpl.php file
  • To increase/decrease the number of weblog titles listed change the $nlimit value in the first line of the snippet to suit.
  • Change the div class names or the prefix text to suit.


<?php
$nlimit = 10;
$query= "SELECT n.created, n.title, n.nid, n.changed FROM {node} n WHERE n.uid = %d AND n.type = 'blog' AND n.status = 1 ORDER BY n.changed DESC";
$result = db_query_range(db_rewrite_sql($query), $account->uid, 0, $nlimit);

User Profile avatar/picture Snippet

PLEASE NOTE! These snippets are user submitted. It is impossible to check them all, so please use at your own risk! For users who have setup drupal using an alternate database to the default (MYSQL), please note that the snippets may contain some database queries specific to MYSQL.

Description

This php snippet checks to see if the user has a picture/avatar uploaded and displays it if they have.

Dependencies: No extra modules required but picture support must be enabled to allow users to upload their avatars/pictures:

A basic User Profile Page to help get you started

Please note: These snippets are user submitted. It is impossible to verify they all work as advertised, so please use at your own risk! Be advised that the snippets here may contain database queries specific to MySQL only.

Description
This php snippet displays is a basic user_profile.tpl.php file to help get you started.

Dependencies:
Requires the profile.module to be enabled and city, country custom single-line profile fields added.

Usage

  • Using a text editor copy and paste the code into user_profile.tpl.php file.
  • Change the custom profile field names to match the specific site. (Tip: go to administer -> settings -> profile and in the second column it will show the name of each field).
  • Change the div class names or the prefix text to suit.
<div class="custom_profiles">
<div class="fields"><?php print check_plain($account->name) ?></div>
<div class="fields">City: <?php print check_plain($account->profile_city) ?></div>
<div class="fields">Country: <?php print check_plain($account->profile_country) ?></div>
<div class="fields">Postcode: <?php print check_plain($account->profile_postcode) ?></div>
</div>

A starter template that reproduces a D5 profile

Client does not support authentication protocol requested by server...

You are installing a new install of Drupal and during setup receive the error

Client does not support authentication protocol requested by server; consider upgrading MySQL client.

You are probably using MySQL 4.1 or higher and need to reset the password to pre 4.1 style.

There's a quick way to fix this if you use recent versions of PhpMyAdmin and have the rights to edit MYSQL user information:

What do all those Unix commands mean?

You will notice references to Unix-like (*nix) commands in some documentation or forum posts and may feel intimidated by them. The authors of the docs, issues or forum postings do this to express clearly and concisely the steps needed to administer your system or fix the problems being discussed.

Having a better understanding of these *nix commands can help you understand what your hosting control panel or GUI FTP client does, and can help you be more productive. Hopefully this will help you become less intimidated by the command line.

Using Apache .htaccess files to stop proxies from caching pages

There are a number of situations that might result in visitors accessing a Drupal site via a caching web proxy. Even though such caches are typically a good thing for sites, sometimes these caching schemes can have undesirable side effects and you may find that instructing proxy servers not to cache pages is the only solution to some problems. (You can learn more about web caches and how they work.)

Some problems that caches may cause with Drupal sites include:

  • A change that a user made to a page may not be reflected immediately, forcing the user to wait some time to see content they contributed (such as a comment) appear on the site.
  • User identities become confused. A user may login under their username but when they access another page, the proxy server sends the cached page from another user's session, effectively switching the identities of the user.

Pages

Subscribe with RSS Subscribe to RSS - Drupal 4.5.x or older