1. FCPeggy
  2. Sherlock Holmes
  3. Commercial Templates
  4. Wednesday, 16 May 2018
  5.  Subscribe via email
Hi,
Somewhere in a php file there is possible a line for my contact form that is refusing to change. It is stuck on an old article reference.
What php file and location is the contact redirect? I'm trying to tell the template to go to a specific article after completing the contact form.
I've even deleted the redirect completely, cleared my cache, logged out, shut down my browser, tried another browser and it's still giving me a 404 - article not found error because it's stuck on the very first article I referenced and long since deleted for a thank you for contacting us article.

I'd like to change the php(?) code line to the exact article the thank you page id is. It used to be article 2 and now I've created an article id 11 to replace it.
Your help would be most appreciated. If you need to access my actual website, I will need your IP address to unlock access.
Cheers,
Peggy
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Peggy

It is unlikely that this is a template related issue. May I ask which template are you using?

Ciarán
  1. more than a month ago
  2. Commercial Templates
  3. # 1
Accepted Answer Pending Moderation
0
Votes
Undo
Hello!

I'm using Madison with Joomla! 3.8.7 Stable
Database mysql
PHP Version 5.6.36

I found a reference on the internet that suggested checking the for a php code line to see if it points to an article id. Sorry I lost that reference. When you fill in the contact form redirect link information - where does that link get stored in the coding? I'm thinking that is where things are stuck. Somehow my website will not change the article id from 2 to the new article 11. I even included the item (Menu) number as well to stop it from picking up the bottom module on the index/home page (which is what started this whole chain of events).

I don't know if this makes any sense at all.
Thank you again for your help.
  1. more than a month ago
  2. Commercial Templates
  3. # 2
Accepted Answer Pending Moderation
0
Votes
Undo
Still searching - here is the reference published in 2010 (old Joomla)

"How to redirect to a custom page made in Joomla, after successful submission of Joomla Contact form?
First of all, prepare a Joomla article that will be the "Thank you" page. We will redirect user to that page. Remember front-end link of that page.
Now, the hacking part. The file that you will be editing is /components/com_contact/controller.php. Lines 193-195 (in Joomla 1.5.15) should look like:

$msg = JText::_( 'Thank you for your e-mail');
$link = JRoute::_('index.php?option=com_contact&view=contact&id='.$contact->slug.'&catid='.$contact->catslug, false);
$this->setRedirect($link, $msg);

If you only want to change the text displayed when the contact form is submitted you edit the "Thank you for your e-mail" text below making sure to keep the single quote marks ' before and after.
If you want to make redirection to your "Thank you" page and disable information message, change this code to:

$link = JRoute::_('http://www.yoursite.com/thank-you-page-link');
$this->setRedirect($link);
" End of article referred to.

With Joomla 3.8 you don't hack this, it's the redirect line in the contact form.
But....somewhere in the background it's stuck so I'm wondering if you may have any knowledge of Joomla 3.8 where that line is? Joomla php file? - I've looked at my live site Joomla "contact.php" file and it looks like this:

<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

/**
* Controller for single contact view
*
* @since 1.5.19
*/
class ContactControllerContact extends JControllerForm
{
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6.4
*/
public function getModel($name = '', $prefix = '', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, array('ignore_request' => false));
}

/**
* Method to submit the contact form and send an email.
*
* @return boolean True on success sending the email. False on failure.
*
* @since 1.5.19
*/
public function submit()
{
// Check for request forgeries.
$this->checkToken();

$app = JFactory::getApplication();
$model = $this->getModel('contact');
$params = JComponentHelper::getParams('com_contact');
$stub = $this->input->getString('id');
$id = (int) $stub;

// Get the data from POST
$data = $this->input->post->get('jform', array(), 'array');
$contact = $model->getItem($id);

$params->merge($contact->params);

// Check for a valid session cookie
if ($params->get('validate_session', 0))
{
if (JFactory::getSession()->getState() !== 'active')
{
JError::raiseWarning(403, JText::_('JLIB_ENVIRONMENT_SESSION_INVALID'));

// Save the data in the session.
$app->setUserState('com_contact.contact.data', $data);

// Redirect back to the contact form.
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id=' . $stub, false));

return false;
}
}

// Contact plugins
JPluginHelper::importPlugin('contact');
$dispatcher = JEventDispatcher::getInstance();

// Validate the posted data.
$form = $model->getForm();

if (!$form)
{
JError::raiseError(500, $model->getError());

return false;
}

if (!$model->validate($form, $data))
{
$errors = $model->getErrors();

foreach ($errors as $error)
{
$errorMessage = $error;

if ($error instanceof Exception)
{
$errorMessage = $error->getMessage();
}

$app->enqueueMessage($errorMessage, 'error');
}

$app->setUserState('com_contact.contact.data', $data);

$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id=' . $stub, false));

return false;
}

// Validation succeeded, continue with custom handlers
$results = $dispatcher->trigger('onValidateContact', array(&$contact, &$data));

foreach ($results as $result)
{
if ($result instanceof Exception)
{
return false;
}
}

// Passed Validation: Process the contact plugins to integrate with other applications
$dispatcher->trigger('onSubmitContact', array(&$contact, &$data));

// Send the email
$sent = false;

if (!$params->get('custom_reply'))
{
$sent = $this->_sendEmail($data, $contact, $params->get('show_email_copy', 0));
}

// Set the success message if it was a success
if (!($sent instanceof Exception))
{
$msg = JText::_('COM_CONTACT_EMAIL_THANKS');
}
else
{
$msg = '';
}

// Flush the data from the session
$app->setUserState('com_contact.contact.data', null);

// Redirect if it is set in the parameters, otherwise redirect back to where we came from
if ($contact->params->get('redirect'))
{
$this->setRedirect($contact->params->get('redirect'), $msg);
}
else
{
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id=' . $stub, false), $msg);
}

return true;
}

I don't see it anywhere referring to this line:
(new redirect) https://www.(sitenamewithheld)/index.php?option=com_content&view=article&id=11&Itemid=112
or
(old redirect) https://www.(sitenamewithheld)/index.php?option=com_content&view=article&id=2

Does this help?
  1. more than a month ago
  2. Commercial Templates
  3. # 3
Accepted Answer Pending Moderation
0
Votes
Undo
I'm back - I have verified that the redirect page link is correct under Global configurations and the contact form itself.
After spending most of the day researching, changing things back and forth, retesting now at 56 test emails (but who's counting...) I have restored my original Thank You redirect page that won't let go of the bottom module (not supposed to show). This article has been assigned to a hidden menu item hoping that would stop it from taking commands/orders/options..from the index/home menu page. It still shows that bottom module.

Enough for today, tomorrow I'm going to create a new single contact and see if a new contact will work.
For anyone reading this saga - it appears to be a Joomla / Me issue with Joomla...I don't know enough about Joomla's code to even know where to begin to sort this out. It keeps hanging on to that bottom module even when the article has gone from uncategorized/no menu attachment to being categorized and attached to a hidden menu item.

Troubleshooting areas I looked at:
Global and article permissions
Article attachment to menu items
Article categories
Module menu selections/assignments to ensure the module is not linking to the hidden menu item
Got more specific with url included article ID and menu item ID
Created a new Thank You page with new ID - system would not accept it even though it saved the correct URL

Tomorrow I'll test a new contact and start this circus all over again.
Uggghhh. Joomla.
  1. more than a month ago
  2. Commercial Templates
  3. # 4
Accepted Answer Pending Moderation
0
Votes
Undo
HI again,
I've now posted this issue on the Joomla support forum, but I thought if it gets resolved I could continue here until a solution is found incase any of Joomla51 clients fall into the same scenario. Presently there are 207 views on the Joomla forum with no answers yet.
References
  1. https://forum.joomla.org/viewtopic.php?f=706&t=962094
  1. more than a month ago
  2. Commercial Templates
  3. # 5
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Peggy

Thank you for the detailed progress of your issue. Hopefully you will find a resolution shortly. A couple of things to consider. Firstly check the ../templates/j51_madison/html/ folder and ensure there is no com_content folder. If there is try renaming it to something like com_content111. Secondly have you considered trying the Modules Anywhere extension (https://extensions.joomla.org/extension/modules-anywhere/). This extension will give you a lot more control of how and where you modules are displayed.

Ciarán
  1. more than a month ago
  2. Commercial Templates
  3. # 6
Accepted Answer Pending Moderation
0
Votes
Undo
Hi, there is no com_content folder. Also no suggestions on how to fix in the official Joomla forum. So far over 700 views on my post - so I can't be alone with this.

Lessons learned when wanting to use hidden contact pages:

Before creating anything to do with contacts, create a Hidden Menu Item - Contact so you can link your contact pages to this.
Menu items control the placement behaviour of modules.
If you don't do this, whatever your index/home page menu item has attached to it will be the default instructions given to your hidden contact page.

Even when I created a Hidden Menu item to attach my contact page to it was too late. Joomla was stuck on that original page using the index/home page instructions.

I now have a Main Menu item Contact with that contact page attached to it so it behaves properly only displaying what I want it to display.
  1. more than a month ago
  2. Commercial Templates
  3. # 7
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!

Join Our Newsletter

* indicates required
We respect your privacy and do not tolerate spam and will never sell, rent, lease or give away your information (name, email, number, etc.) to any third party. Nor will we send you unsolicited email.
Joomla51 - Mullaghmore, Co. Sligo, Ireland
Joomla51.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by
Open Source Matters
the trademark holder in the United States and other countries.

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.

Ok