Hi,

A feature request/suggestion to allow the watcher link to be placed in a block (optionally) instead of inserting into node content. This allows the site admin to place the link wherever they want within the theme's layout.

For one site I operate, I wanted to place the watch link at the top of a node, and also at the bottom of a node.

I have produced a patch for this (against 6.x-1.1), but it is only a partial implementation and needs work.

Issues with this patch are:

Doesn't work when watcher link is enabled for node teasers if there are multiple node teasers on a single page - The block will just display the link for the last processed node.

Doesn't work if there are multiple watcher links on a single page - Toggling one watcher link doesn't update the other watcher links.

So, presently, the patch will only work if Watcher is enabled for nodes in full view and if there is only one watcher link on a page.

(PS: This patch deliberately creates two watcher blocks)

Comments

eidolon night’s picture

I'd love to use this. I love watcher, but prefer the location of the links in the comment notify module (under the comment box). In advanced forum the watcher ajax widget looks goofy, and I would much rather have it at the bottom of the page below the comment box. Does this patch get rid of the link in the node body?

bengtan’s picture

> Does this patch get rid of the link in the node body?

This patch adds a setting which lets you enable or disable the watcher link in the node body ... so yes, it can get rid of the link.

But please note the warning above: If you have two watcher links (for the same node) appearing on a single page, toggling one does not update the other.

eidolon night’s picture

I'm having difficulty patching this with Tortoise SVN. Never had trouble with this kind of thing before. It doesn't seem to be recognized as a patch file. Any suggestions?

eidolon night’s picture

Nevermind, I figured it out. My file path did not include the 6.1...

solipsist’s picture

Status: Needs work » Closed (works as designed)

Next release of the D6 branch will place the link in the links array as it should. I see no reason to implement support for links in blocks, if you really need this feature you can use PHP code in a custom block to get the same result.

CarbonPig’s picture

I think this is a great feature/patch. There are many cases where you don't want this in the links area and would want it in a block.

If you disable it from showing on a content type, will php code in a custom block still work?

Does anyone have the php code written?

Thanks,

CarbonPig

CarbonPig’s picture

Category: feature » support

Bump - Can anyone help on the php to put the watcher link in a block?

j3frea’s picture

What I did was to add into my page.tpl.php theme file:

<?php if ($title): ?>
  <h1 class="title"><?php print $title; ?></h1>
  <?php global $watcherlink; print $watcherlink; ?><br />
<?php endif; ?>

Note the third line...

$watcherlink is set by this:

<?php
function _watcher_node_watch_link(&$node, $a3, $a4) {

  ...

  //EDIT: Note the commented out code to see what I've chnaged
  global $watcherlink;
  $watcherlink = theme('watcher_node_toggle_watching_link', $user->uid, $node->nid, $dest, $watching, $tstrings);
  //Add element to node
  /*$node->content['watcher'] = array(
    '#value' => theme('watcher_node_toggle_watching_link', $user->uid, $node->nid, $dest, $watching, $tstrings),
    '#weight' => 30,
  );*/
}
?>

I also add this to my theme's css file:

.watcher_node {
  float: right;
}

EDIT: Okay, I really hate ie... but the above CSS messes up in ie, nevertheless, without it the code still works although it may not be the best way of doing things (in fact, I'm pretty sure it's not)

Also, you could of course shove global $watcherlink; print $watcherlink; into a block and you'd have the effect that you're looking for (in my undrupalesque way of doing things).

bengtan’s picture

If anyone needs this in a form that 'just works' badly enough, I'd suggest they contact the module maintainer and offer to pay him to incorporate my patch from the original post.

Or as a last resort, they can commission me to write a small add-on module for watcher which creates this block.

The ideal solution would be for the module maintainer to integrate into watcher itself, though.

solipsist’s picture

The reason I haven't committed bengtan's patch is because I haven't seen enough of a demand for this feature. I've always intended Watcher to be clean and lightweight, why the module will be refactored for D7 as job queue and other exciting new features which Watcher implements itself make it into core.

The ideal solution is actually to implement it as a separate module since far from all users seem to need it. Bengtan, if you have the time to package your code above as a module and post it here I'll make sure to include it with Watcher.

bengtan’s picture

Version: 6.x-1.1 » 6.x-1.4
Category: support » feature
Status: Closed (works as designed) » Active
StatusFileSize
new1.22 KB

Hi,

Okay, I needed to scratch this itch so I created a separate add-on module for this. Please see the attached gzip tarball. It works for 6.x-1.4.

To the maintainers: Please consider adding this mini module into watcher.module. Feel free to change any part of it or any coding conventions it uses.

Thank you.

Ela’s picture

subscribing for updates :)

itserich’s picture

All of my site content is in panels, and I would like to try a lighter weight solution such as Watcher.

I downloaded Watcherblock from #11 in sites/all/modules and extracted it, like any other module, but it does not show up to be enabled. Also extracted directly into the Watcher folder and no block is created.

The custom block code at the end of #8 looks simple enough, but when I applied it the block does not appear. I did not make any changes other than trying to create a custom block so perhaps I missed something.

Any tips on getting Watcher into a block or as part of a panel would be appreciated. Thank you.

itserich’s picture

Check this out, works. Very easy and quick.

http://drupal.org/node/861602

nwom’s picture

Version: 6.x-1.4 » 7.x-1.x-dev
Issue summary: View changes
Status: Active » Needs work

Being able to add the watcher link as a block will also allow integrating the watcher link with panels, panels pages, mini panels, etc automatically. For sites that have overridden node forms via panels, the Watcher module can currently sadly not be used.

Any way we can incorporate the changes in that D6 Watcherblock module (#6) or the patch from #1 into D7?

nwom’s picture

Title: Place watcher link in blocks » Place watcher link in blocks (Automatic Panels support)
nwom’s picture

For those looking for a panels workaround, you can use the following patch: #1599588: Option to place Watcher Link in node-links, not node-body.