Hi all,

I'd like to thank the developpers for this great module which I recently discover, and I'd like you to help me importing the original feed item URL as a CCK Redirection field because I'm willing to use this CCK module to redirect the nodes to the external source after a delay.

I'm not a developper but I noticed that my target CCK field is just a text type, and it's said here: http://drupal.org/node/718414#comment-2619740 that text fields could be handled in content.inc, so I guess there's a simple way to make it available in the target's list.

Please let me know how to solve this problem.

module page: http://drupal.org/project/cck_redirection

--
Amine

Comments

alex_b’s picture

Version: 6.x-1.0-alpha15 » 6.x-1.x-dev
Category: support » feature

The field does not show up as a mapping target because it will need a mapper, just like the text field or the numeric field are being mapped with mappers/content.inc. Look at http://drupal.org/node/622700#mappingapi for documentation on how to write a mapper.

This is a feature request.

akadimi’s picture

As I said I'm not a good programmer but I tried my best and made a file called redirection.inc with the code below but it didn't work, could you please tell me what is wrong with it (my CCK field type is "Redirection")?

<?php
/**
* Implementation of hook_feeds_node_processor_targets_alter().
*/
function redirection_feeds_node_processor_targets_alter(&$targets, $content_type) {
  if ($content_type == 'Redirection') {
    $targets['Redirection'] = array(
      'name' => t('My Target Field'),
      'description' => t('Shows up in legend on mapping form.'),
      'callback' => 'redirection_set_target',
    );
  }  
}

/**
* Mapping callback.
*/
function redirection_set_target($node, $target, $value) {
  if (!is_array($value)) {
    $node->$target = $value;
  }
}
akadimi’s picture

Hi,

I managed to get it work by adding 'cck_redirection' to the types in content.inc

...
if (in_array($field['type'], array('text', 'number_integer', 'number_decimal', 'number_float', 'cck_redirection'))) {
...
klonos’s picture

is this related to #617486: Create link to original source, view of items on feed nodes with the added bonus of auto-redirection ...or am I missing something here?

caschbre’s picture

It's somewhat related, but not quite the same. Here's an example...

1) Import a feed to display the title, post date, teaser in a view on your site. If the user clicks on the title, the user should be taken to the feed item source URL and not the node. This can be done with the current feeds build by overriding the title link in views.

2) Now take that same view and create a view feed for it, possibly mixing in other feed items. This way users of your site can subscribe to that one feed. The problem really is in the views feed in that it will not take the title link and use that, rather it provides a link in the feed back to the feed item node. In this particular case, the cck_redirection is useful to move the user over to the original feed item source.

Does that make sense? I know I was using the word 'feed' in different contexts.

BTW... I did what post #3 mentioned and was able to map the inbound item URL to the cck_redirection field. This had the desired effect.

kenorb’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.