Jun 15, 2009

  installing phpfreechat

get module from http://drupal.org/project/phpfreechat, download its script from sourceforge upload module to sites/all/modules/ and upload script into phpfreechat directory (sites/all/modules/phpfreechat/phpfreechat

since I put my drupal site on subdirectory, I gotta change the $base_url on settings.php:
uncomment $base_url = 'http://example.com/directory'; // NO trailing slash!

Labels:

Jun 9, 2009

  UR Theme Override

  • Copy user_relationships.tpl.php to the theme directory
  • Add this function to template.php

    function framework_preprocess_user_relationships(&$variables) {
    global $user;

    // readability
    $account = $variables['account'];
    $rtid = $variables['rtid'];

    $args = array('user' => $account->uid, 'approved' => TRUE);
    if (isset($rtid) && is_numeric($rtid)) {
    $relationship_type = user_relationships_type_load($rtid);
    $args['rtid'] = $rtid;
    }

    $query = _user_relationships_generate_query($args, array('include_user_info' => TRUE));

    // To Page or not to Page
    if ($variables['relationships_per_page'] = variable_get('user_relationships_relationships_per_page', 16)) {
    $results = pager_query($query['query'], $variables['relationships_per_page'], 0, $query['count'], $query['arguments']);
    }
    else {
    $results = db_query($query['query'], $query['arguments']);
    }

    $variables['relationships'] = array();
    while ($relationship = db_fetch_object($results)) {
    user_relationships_api_translate_user_info($relationship);
    $variables['relationships'][$relationship->rid] = $relationship;
    }

    if ($account->uid == $user->uid) {
    $msg = $relationship_type ? t("My %relationships") : t("All my relationships");
    }
    else {
    $msg = $relationship_type ? t("%username's %relationships") : t("All %username's relationships");
    }

    $variables['title'] = t($msg, array(
    '%username' => $account->name,
    '%relationships' => $relationship_type->plural_name ? $relationship_type->plural_name : $relationship_type->name
    ));
    }

  • Add this code snippet to user_relationships.tpl.php

    theme('facebook_status_item', _facebook_status_get_status_fast($this_user->uid)),

Labels:

Jun 8, 2009

  Drupal How to Alter Menu

Links:
http://drupal.org/node/199067
http://drupal.org/node/483324
http://drupal.org/node/199069

Example:
Altering menu tabs


/**
* @file
* Altering menu.
*/

/*
* implementation of hook_alter_menu().
*/

function altermenu_menu_alter(&$items) {
// Altering menu title on node display
// change title to anything you want
$items['node/%node/view']['title'] = 'Your title name';

// Change type to MENU_CALLBACK
$items['node/%node/edit']['type'] = MENU_CALLBACK;


// Fully unset these tabs and their paths, don't want them at all. This breaks the path as well:
unset($items['node/%node/view']);
unset($items['node/%node/edit']);
}

Labels:

Jun 5, 2009

  Facebook-style Statuses

http://drupal.org/node/421128#perms