Display a date related notice or countdown 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 special message, based on a date set in the user profile. It only displays for users with ADMINISTER USERS permissions or when a user is looking at his/her own user profile page.

The example below is a warning to Members that there are (x) days left before their membership expires. The same snippet maybe used for many applications.

Dependencies: profile.module must be enabled and a DATE field must be set in the user profile.

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
  • Change the name of the profile date field you are using. (Tip: go to administer -->> settings -->> profile and in the second column it will give you the field name.)
  • Tested and works with Drupal 4.5 and 4.6
  • Change the div class names or the prefix text to suit.


Display a Skype "Call me" or "leave a voicemail" button depending on Users' online/offline status

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.

Note: There is also a Skype Support module.

Description

This php snippet adds a Skype: Call me! button to their user profile page if they are online or a Leave a voicemail! message if the user is offline.

If the user has not specified their skype username, it displays nothing.

Dependencies: profile.module must be installed and enabled.

An optional extra little piece of javascript checks to see if the user viewing the profile page has skype installed and displays a friendly link explaining what it is if they don't. Click through to skype.com for what the alternate message on the skype.com site looks like and says.

Usage

Send private message 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 inserts the SEND A PRIVATE MESSAGE link

Dependencies: privatemsg.module must be installed and enabled.

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);

Pages

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