unanticipated redirects when called from drupal_get_form

1.kenthomas - March 11, 2008 - 23:07
Project:Contact Forms
Version:5.x-1.9
Component:Code
Category:feature request
Priority:normal
Assigned:1.kenthomas
Status:closed
Description

If a site-wide contact form is rendered from a page other than "its own" via drupal_get_form (or another method), said form redirect to Contact Forms default page (/contact or such).

This is unanticipated behavior if drupal_get_form is being called, for instance, in a block outside the /contact heirarchy. CF should limit any redirects to occurring only for pages in /contact*

TKS

#1

1.kenthomas - March 11, 2008 - 23:09

#2

gpdinoz - March 12, 2008 - 03:42
Category:bug report» feature request

Hi 1.kenthomas

I am not suprised that you are having problems as Contact Forms is URL dependant and only modifies the output of the core contact module. This is more of a feature request than a bug report and I suspect a completely separate module to provide blocks for each contact category would work better than trying to get Contact Forms to work how you want it.

regards
Geoff

#3

1.kenthomas - March 12, 2008 - 20:57
Assigned to:Anonymous» 1.kenthomas

Geoff,

Self-assigning for now; will look at code and reply. Seems to me it should be simple to exclude the redirect if called from outside /contact* hierarchy, but haven't had time to glance at it.

#4

gpdinoz - March 13, 2008 - 04:50

Yes this morning I had a thought that you could just remove the redirect as it is only a "covering all bases" part of the module. However your idea is better

line 56 is where it is being redirected. you could add a if $path does not contain "contact" then don't redirect.
You could try this

    if (!db_num_rows($query) && strstr ( $path, 'contact' )) {
      drupal_goto(variable_get('contactform_redirect', 'contact'));
    }

OR you could add "&& strstr ( $path, 'contact' )" to the if then on line 50.

All the best with it
Geoff

#5

gpdinoz - September 28, 2008 - 06:50
Status:active» closed
 
 

Drupal is a registered trademark of Dries Buytaert.