Embed Privatemsg pages

This page explains how to embed certain pages of Privatemsg into your website. Be sure only to use code suitable for your respective version of Drupal.

You should know some things about Drupal administration (for example, how to create new blocks) and some PHP knowledge if you want to further customize the given examples.

Warning: While these examples say that you can put this in a custom block through the User Interface, it is heavily suggested to create a custom module instead to embed PHP code into your site. Also, these examples are untested and might not work properly.

Privatemsg for Drupal 6

Display list of latest 5 messages in a block

Create a new block with the PHP Filter and put the following code into it:
<?php
global $user;

// Generate the query to load the messages.
// Replace 'inbox' with 'sent' to display sent messages or 'list' to display all messages.
$query = _privatemsg_assemble_query('list', $user, 'inbox');

// Load 5 messages/threads. Replace 5 if you want to display a different amount of messages.
$result = db_query_range($query['query'], 0, 5);
$list = array();
while ($thread = db_fetch_array($result)) {
// Generate a link with the subject as title that points to the view message page.
$list[] = l($thread['subject'], 'messages/view/'. $thread['thread_id']);
}
// Display list as a themed item_list.

Using Deploy with Views Bulk Operations

The View Bulk Operations module allows operations to be executed against a group of nodes as selected by a View. This is a powerful tool for granularly performing actions against nodes. Deploy functionality is supported by Views Bulk Operations just like it is on the content list form. As an example, Deploy contains a default view at admin/build/deploy/choose_nodes which will be enabled if you have the Views Bulk Operations module installed. Note that by default this View is only viewable by users with 'administer deployment' permissions. This view allows you to filter nodes by content type, front page flag, author and/or post date. You can then easily select nodes to add to a deployment plan or deploy immediately. The view serves as a good sample of how you can use Views Bulk Operations to build a view for integration with Deploy functionality.

If you wish to create your own view from scratch, here's how. (Note these instructions assume some familiarity with Views.)

  1. Create a new node view per whatever needs you have as normal.
  2. Add a new Page display to this node.
  3. Set the Page Style to Bulk Operations.
  4. Click the 'gear' to adjust the settings for this style.

Feeds

Feeds is a pluggable import and aggregation module. It supports node, term and user import; granular mapping from RSS feeds, Atom feeds or CSV files and provides an API for adding other formats or targets.

Its documentation is placed in the aggregation section of the handbook: Feeds documentation

Feeds glossary

This glossary is intended to provide a basic list of terms commonly used in Drupal related to feeds along with a brief definition of each. The following list of terms and definitions is sorted alphabetically and can also be searched with your browser's search function.
Terms in italic are terms defined in this glossary. For developers, references to classes are included.

Common terms used with feeds

CSV

"Comma-separated values", a simple file format used to move tabular data between programs and databases. See also Comma-separated values on Wikipedia. The needed/correct line-ending-char(s) of a Feeds-imported CSV-file depends on the type of the operating system of the www-server:

  • If you are using a Linux-Server, use only "LF" at the line-end of the CSV-file.
  • If you are using a Windows-Server, use "CR+LF" at the line-end of the CSV-file.
  • If you are using a Mac-Server, use only "CR" at the line-end of the CSV-file.

The changing of the line-end of the CSV-file before importing is important, if the source of the CSV-file (e.g. your computer or the database of the CSV-file) has a different operating system!
For the meaning of "LF" and "CR" look at http://en.wikipedia.org/wiki/Newline#Representations.

The site builder's guide to Feeds

Introduction

Feeds is designed to address import and aggregation use cases. It provides a UI for creating and managing multiple configurations for importing and aggregating simultaneously.

A single configuration for importing is called an Importer. As many importers as desired can be created. Each importer contains a Fetcher for downloading a feed, a Parser for parsing and a Processor for "doing stuff" with it - usually storing the feed.

Default configurations

Don't forget to enable the "Feeds Admin UI" module!

When you install Feeds and go to Administer > Site building > Feed importers (D7: admin/structure/feeds), you will find 4 default importer configurations (5 if Data module is installed):

  • Feed: aggregation importer. Aggregates RSS/Atom feeds to nodes. Provides a node type Feed and a node type Feed item. Create one or more "Feed" nodes to add RSS/Atom feeds to your site. On cron, these feeds will continuously produce "Feed item" nodes.

Feeds

Overview

Feeds is a pluggable system for importing or aggregating content into Drupal. Out of the box, it supports

  • import or aggregation from RSS feeds, Atom feeds, OPML files or CSV files
  • import from an XML, or HTML document using Feeds extensible parsers (or Feeds XPath Parser for Drupal 6)
  • generation of users, nodes, terms or simple database records
  • granular mapping (e. g. map the "author" column of a CSV file to a CCK field or map the title of an RSS feed item to a term name)
  • multiple simultaneous configurations organized in "Importers"
  • overridable default configuration for the most common use cases
  • "Feeds as nodes" paradigm as well as "Standalone" import forms
  • aggregation (periodic import) on cron
  • PubSubHubbub subscriptions
  • views-style exportables (using CTools)
  • a views-style plugin API (using CTools) providing a powerful API for rapidly adjusting Feeds to specific use cases on site builds: add other import sources or targets in a straightforward way

Pages

Subscribe with RSS Subscribe to RSS - Site administrators