See the Mailing lists or Drupal Issue queue. There are also various working groups on groups.drupal.org

nodeapi and links relations to content nodes

On a site I am working on I found the use of the links and nodeapi to be very useful and begun to use it a lot to allow different "attachments" to nodes, such as adding an image gallery to the bottom of a node, adding rating to nodes, attaching maps to nodes, etc.

But I encountered 2 usability problems -

1. The elements added in the different nodeapis appear at the bottom of the node in no order at all, except for the select done on the modules in module.inc line 54. This creates cases where book navigation can appear before before images related to the node.

help with php code needed: filtering node types from the tracker.module

Hiya Guys,

Am trying to work out a way to filter which node types appear using the tracker.module. For example in the FORUM there is a link called ACTIVE FORUM DISCUSSIONS, which, when you click on it gives you a list of every node type. As opposed to active forum discussions.

It's been noted as a feature request, but, I have managed to come up with a PHP Snippet that calls the tracker_page function in the tracker.module to display JUST a list of active forum topics.

I need help with the following (which works with 4.5.2) if anyone out there more familiar with php has a moment.

Here's the code (go to CREATE CONTENT -->> PAGE and paste the following into the page body and select the PHP filter before submitting):

** THIS ONLY WORKS WITH 4.5.X IT DOESN'T WORK WITH 4.6. ************



/**
 * Creates a RECENT POSTS tracker.module style list of forum topics and replies.
 * This works with drupal 4.5.x 
 * and does NOT work with 4.6. yet.
 *
 * To change the node type you want listed...simply change the $type value below
 * To change the length of list you want displayed..simply change the $listlength value below
 */

  $type="forum";
  $listlength="10";

  $header = array(
    array("data" => t("type"), "field" => "type"),
    array("data" => t("title"), "field" => "title"),
    array("data" => t("author"), "field" => "u.name"),
    array("data" => t("last post"), "field" => "last_activity", "sort" => "desc")
  );

  if ($id) {
    $sql = "SELECT n.nid, n.title, n.type, n.changed, n.uid, u.name, MAX(GREATEST(n.changed, c.timestamp)) AS last_activity FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {users} u ON n.uid = u.uid WHERE n.uid = '". check_query($id) ."' AND n.status = 1  AND n.type='$type' GROUP BY n.nid, n.title, n.type, n.changed, n.uid, u.name";
    $sql .= tablesort_sql($header);
    $sresult = pager_query($sql, $listlength, 1, "SELECT COUNT(nid) FROM {node} WHERE status = 1 AND uid = '". check_query($id) ."'");

  }
  else {
    $sql = "SELECT n.nid, n.title, n.type, n.changed, n.uid, u.name, MAX(GREATEST(n.changed, c.timestamp)) AS last_activity FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {users} u ON n.uid = u.uid WHERE n.status = 1 AND n.type='$type' GROUP BY n.nid, n.title, n.type, n.changed, n.uid, u.name";
    $sql .= tablesort_sql($header);
    $sresult = pager_query($sql, $listlength, 0, "SELECT COUNT(nid) FROM {node} WHERE status = 1 AND n.type='$type'");
  }

  while ($node = db_fetch_object($sresult)) {
    if (node_hook($node, 'tracker_comments')) {
      $cresult = node_invoke($node, 'tracker_comments');
    }
    elseif ($id) {
      $cresult = db_query("SELECT c.*, u.name FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.uid = %d AND c.nid = %d AND c.status = 0 ORDER BY c.cid DESC", $id, $node->nid);
    }
    else {
      $cresult = db_query("SELECT c.*, u.name FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.nid = %d AND c.status = 0 ORDER BY c.cid DESC", $node->nid);
    }

    $type = ucfirst(node_invoke($node->type, "node_name"));
    $title = l($node->title, "node/$node->nid") ." ". (node_is_new($node->nid, $node->changed) ? theme("mark") : "");
    $author = format_name($node);

    $comments = array();
    while ($comment = db_fetch_object($cresult)) {
      $comments[] = "<li>". t("%subject by %author", array("%subject" => l($comment->subject, "node/$node->nid", NULL, NULL, "comment-$comment->cid"), "%author" => format_name($comment))) ." ". (node_is_new($comment->nid, $comment->timestamp) ? theme("mark") : "") ."</li>\n";
    }

    if ($comments) {
      $comments = "<ul>". implode("\n", $comments) ."</ul>";
    }
    else {
      $comments = "";
    }

    $rows[] = array(array("data" => $type, "class" => "type"), array("data" => $title . $comments, "class" => "content"), array("data" => $author, "class" => "author"), array("data" => format_date($node->last_activity, "small"), "class" => "last_post"));
  }

  if ($pager = theme("pager", NULL, $listlength, 1, tablesort_pager())) {
   $rows[] = array(array("data" => $pager, "colspan" => 4));
  }

  $output  = "<div id=\"tracker\">";
  $output .= theme("table", $header, $rows);
  $output .= "</div>";

print $output;


the above, just lists the 10 most recent active forum topics. need help with:

1. getting it paging - at the moment it doesn't have the NEXT/PREVIOUS page links it should at the bottom and I'm not sure where to change that in the code.

2. working with 4.6. - the above snippet is taken from an old version of tracker.module which has changed significantly between 4.5. to 4.6. Need tips on how to restructure it to work with 4.6

Anyone ?

Am very new to php.

Dub

PHP 4.3.0 change in strip_tags breaks flexinode+HTML Filter

Since PHP 4.3.0, comments are also stripped by the strip_tags() function. That means that the HTML filter also strip the

alphabetical sorts have upper chars before lower chars

This is very unconvenient when having mixed german english strings. Cause german strings have first char uppercase they are all sorted before the english ones.

Is this by intention? Can I change this behaviour?

How to integrate XSLT in a module?

I need to convert/export data in my sql tables into xml format using an xsd schema. Could anyone please help me get started? or guide me to an example as I have not found one so far on this forum.
Thank you
Dav.

How to change left panel?

Hello,

I need to change the blog page left panel. For example, I want to delete Buddylists & Groups section for users that are not logged in. What code outputs the left panel?

Regards,

Eugene

Pages

Subscribe with RSS Subscribe to RSS - Deprecated - Drupal core