Turn off Redirection on teaser view

VlooiVlerke - August 6, 2008 - 10:41
Project:CCK Redirection
Version:5.x-1.0
Component:User interface
Category:feature request
Priority:critical
Assigned:Unassigned
Status:active
Description

Hi Great Module

I have a search view, showing nodes in a teaser view. If one of the nodes in my search has a redirect url, it redirects. Thus making it imposable to see the other teaser listings. Can we turn off Redirect in teaser view, so that it only redirects when you visit the link node/# and not on view/search/teaser_list <-(this is just an illustrative link)

Thanks

#1

DamienMcKenna - September 4, 2008 - 18:13
Priority:normal» critical

Am also seeing this problem using the built-in search engine, any nodes that have a redirect URL will automatically run the redirect action if they show up in the search results.

#2

DamienMcKenna - September 5, 2008 - 04:41

This appears to be a core flaw with drupal_goto, which cck_redirection relies upon.

#3

DamienMcKenna - September 5, 2008 - 04:52

Should the cck_redirection_nodeapi() function check to see if the full node is being displayed or a teaser? Could the "Display Fields" settings be used to decide whether the URL is followed or not?

#4

DamienMcKenna - September 5, 2008 - 15:53

Looking at get_defined_vars() from within cck_redirection_nodeapi() I don't see a clear way of identifying whether the teaser or full view should be used? Any hints? tyvm.

#5

DamienMcKenna - September 6, 2008 - 02:51

drupal_goto() only exists if drupal_get_cron() is true. Maybe this should be expanded to be a special-case "please don't do run any drupal_goto calls" override that could be toggled by certain types of calls, e.g. search results, maybe a flag on views? Just trying to make sense of this.

#6

DamienMcKenna - September 6, 2008 - 03:08

How about this:

<?php
Index
: modules/search/search.module
===================================================================
---
modules/search/search.module    (revision 671)
+++
modules/search/search.module    (working copy)
@@ -
991,6 +991,9 @@
function
search_view() {
  
$type = arg(1);

// disable drupal_goto()
drupal_get_cron(TRUE);
+
  
// Search form submits with POST but redirects to GET. This way we can keep
   // the search query URL clean as a whistle:
   // search/type/keyword+keyword
?>

This stops drupal_goto() from affecting the search engine results view.

#7

DamienMcKenna - September 11, 2008 - 18:39

Scrap that, this patch breaks the search engine. Sad but true. Fixed patch will be forthcoming.

#8

DamienMcKenna - September 11, 2008 - 18:41

Fixed patch:

<?php
Index
: modules/search/search.module
===================================================================
---
modules/search/search.module    (revision 690)
+++
modules/search/search.module    (working copy)
@@ -
1174,6 +1174,10 @@
function
search_data($keys = NULL, $type = 'node') {

   if (isset(
$keys)) {
+
+   
// disable drupal_goto() while loading nodes
+    drupal_get_cron(TRUE);
+
     if (
module_hook($type, 'search')) {
      
$results = module_invoke($type, 'search', 'search', $keys);
       if (isset(
$results) && is_array($results) && count($results)) {
?>

#9

doc2@drupalfr.org - October 1, 2008 - 09:08

Just in case my case could help, IF you use the patch against max_allowed_packet error because of #218187: Views cache too large, you MAY face an error message such as Duplicate entry [node] for key 1 query: INSERT INTO search_index (word, sid, type, score) VALUES (values) dans .../drupal/includes/database.mysql.inc at line 172. with this patch.

I used it eventhough I don't use CCK redirection because I thought that the hook drupal_goto() being global could have affected other search processes or, on cron runs, index processes. I was probably wrong.

 
 

Drupal is a registered trademark of Dries Buytaert.