ARCHIVE: Handling URL profile fields

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 custom User Profile URL fields. If the user has not specified any link, it displays nothing.

Dependencies: profile.module

Usage

  • Using a text editor like NOTEPAD.EXE or an equivalent, copy and paste the code into your user_profile.tpl.php file
  • Change the Custom profile URL field name. In the example that is currently $urlfieldname='profile_weburl' (Tip: go to administer -->> settings -->> profile and in the second column it will give you the name of the URL field.)
  • If you are using this snippet more than once in the same user_profile.tpl.php file add a number to the end of the $urlfieldname each time you copy the snippet. e.g. $fieldname1, $fieldname2, $fieldname3 etc.
  • Change the div class names or the link prefix text to suit.

<?php
 $urlfieldname
='profile_weburl' ;
?>
<?php
 
if($account->$urlfieldname):
?>

Recent weblog entries (titles & teasers) 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 & teasers with "read more" links to the full blogs.

Dependencies: blog.module must be enabled.

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;
 
$result1 = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 AND n.uid = %d ORDER BY n.created ASC"), $account->uid, 0, $nlimit);
  while (
$node = db_fetch_object($result1)) {
   
$output2 .= node_view(node_load(array('nid' => $node->nid)), 1);
  }
  print
$output2;
?>

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:

Pages

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