This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

customise forum.module help required...

Hi & Happy New Year.

I'm a drupal newbie and trying to tweak the forum on my site: http://guernseykayaking.com/forum
I've fiddled with the css to change the colours, but now i'd really like to have it so that in the last post column, it displays the title of the last post as well as just the date and user.

I've seen this on other drupal sites and searched extensively for a solution but have been unable to find anything!

workflow that clones a document in a non-editable state, then updates original with modified clone

The modules:
CCK
workflow
workflow_access
actions
node clone

The problem:
I have a workflow for a CCK node type that includes a "Live" state. When a node is "live," it cannot be edited (I've configured it thus with workflow_access). I want to permit my users to apply updates to these documents in the following steps:

  1. When the user wants to submit updates for a live document, a copy of the node is created. The user becomes the author of the new node as usual, but the node "remembers" the nid of the original in a hidden field.
  2. The user applies her updates to the document and submits it for review (which my current workflow does).
  3. When an admin makes the clone live--this is the tricky part--it automatically overwrites the original. The live node retains the nid, path, and taxonomy as the original, but the title and content fields are replaced by those of the submitted clone, and the revision and workflow history of the clone are appended to the original's.

Somehow, the copy needs to "remember" the parent's node id, and somehow, it needs to trigger the special update process when it goes live. Any advice on how to proceed? I'm an experienced PHP coder, but the Drupal API is foreign country. I want to develop this functionality the "right" way, so that it's not going to break everything the next time I n

Defining a page owner

I need to create a sidebar with various user information for the owner of each page.

For example, if I am viewing a poll, guestbook, blog entry or whatever owned by a specific person, the sidebar would contain information about that person with links to various relevant content.

This is turning out to be much harder than I expected and I wonder if I am missing something.

I am using the phptemplate engine. My first plan was to create a variable called "$page_owner" from $node->uid in _phptemplate_variables in templates.php.

However, I soon discovered that $node is often not available in this function. Apparently it is only provided if the URL is of the form /node/$uid, which it often is not. Eg blogs. Moreover, some objects like guestbooks have owners but are not created as nodes in the guestbook module. In other cases, comments on an object are not nodes, etc.

So my next plan was to create a global variable called $page_owner and define appropriately it in various modules.

However, it appears that no global variables I define in my modules are visible to template.php. The values are always blank no matter where I define them - eg. hook_menu defines a title field that the theme system can use, but no global variables set there can be accessed from template.php .

I have never seen this kind of behaviour in other PHP applications I have coded - it appears that Drupal is wiping out my global variables in the middle of the page creation process.

How to use "hook_cron" in a new module????

I am attempting to write a module to extend the functionality of pablobm's excellent LDAP authentication modules. He now has split them into 3 pieces, and they gather data, get group info and authenticate to a LDAP server. What I want to do is synchronize a few drupal roles to LDAP groups and do this daily or at scheduled times. This I thought would involve "hook_cron". I have the code working, dislaying what it does on the settings page, but now I want it to be called at timed intervals. I grabbed the cron chunk of code from aggregator.module, and changed it to look like this...

/**
 * Implementation of hook_cron().
 *
 * checks for differences between ldap and drupal user database.
 */
function ldapsync_cron() {

  watchdog('cron', "Hello cron hooked...", WATCHDOG_WARNING);
  sync_ldap_to_drupal();

//  $result = db_query('SELECT * FROM {aggregator_feed} WHERE checked + refresh < %d', time());
//  while ($feed = db_fetch_array($result)) {
//    aggregator_refresh($feed);
//  }
}

I am right in thinking I am supposed to put " function module-name_cron() { " to use the hook, right? Is there any special voodoo magic I need to do to enable it? Any GLOBAL include, etc? How does cron know which modules have a hook in it? I have tried disabling and enabling the module, I have done a forum search, to no avail. I am just expecting a watchdog entry to say that it ran. Cron is working for my site, as my search index is at 100%.
I will be putting all the code up here when I get it working, because it makes things like a web searchable directory (Office, e-mail,phone,etc) available for those who already have the info stored in an LDAP without requiring everyone to log in to drupal to create the account information, and keeps it up to date from the LDAP. Any help would be appreciated, Thanks!

Liveoutloud2day

How do you get a nid in hook_filter()?

Given that hook_filter() is defined as hook_filter($op, $delta = 0, $format = -1, $text = ''), how can you get the current node ID?

I want to create a replacement pattern based upon the name of attachments.

Am I missing a utility function somewhere or should I hack the core so that hook_filter gives me a node ID?

Cron alternative?

I am currently using DB cron (http://drupal.org/node/42922) for some automated housekeeping. The machine that runs cron.php is frequently down for maintenance, so the question is whether DB Cron can be configured to do cron.php's job instead.

Thanks in advance

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions