Can anyone help identify what might be wrong with this plugin. It works great on my WAMP local machine, but not on the production server.
WAMP is on Windows 11. The production server is an AlmaLinux CWP VPS running Apache with Nginx reverse proxy.
Everything else seems to work, so my assumption is that there is an issue with case sensitivity, so that some case mismatch that windows ignores is not being ignored on the production server, but there is no errors being logged.
The class inject JavaScript into a contact form using com_contacts. The class triggers on onContentAfterDisplay. It works perfectly on the developments server, but as far as I can tell, the class is not triggered at all on the production server. No errors, and just putting the first action as exit(); does not help. Caching is off and I have tried deleting the auto_psr multiple times.
The provider.php file:
<?php
/**
* @package Joomla.Plugin
* @subpackage contact.contactMoveFields
*
* @copyright (C) 2023 Open Source Matters, Inc.
* @license GNU General Public License version 2 or later;
*/
\defined('_JEXEC') or die;
use Joomla\CMS\Extension\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Blazingimages\Plugin\Content\ContactMoveFields\Extension\ContactMoveFields;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new ContactMoveFields(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('content', 'contactMoveFields')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};
The ContactMoveFields.php file:
<?php
namespace BlazingImages\Plugin\Content\ContactMoveFields\Extension;
defined('_JEXEC') or die;
use Joomla\CMS\Document\HtmlDocument;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\CMSPlugin;
class ContactMoveFields extends CMSPlugin
{
public function onContentAfterDisplay($contact, &$values)
{
/*
* Ensure that only com_contact.contact pages are affected
*/
echo "Contact = " . $contact; exit();
if ($contact != 'com_contact.contact')
{
…
The contactMoveFields.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="content" version="5.0" method="upgrade">
<creationDate>1/16/2025</creationDate>
<author>Blazing Images</author>
<authorEmail>webm...@blazingimages.com</authorEmail>
<authorUrl>http://blazingimages.com</authorUrl>
<copyright>Copyright Blazing Images Website Design, LLC.</copyright>
<license>GNU General Public License version 2 or later. See LICENSE.txt</license>
<name>Contact Move Fields</name>
<version>1.0.0</version>
<description>Plugin to move custom contact MAIL form fields into the main contact for so that things like phone and fax number can appear above the message rather than in a group below.</description>
<namespace path="src">Blazingimages\Plugin\Content\ContactMoveFields</namespace>
<files>
<folder plugin="contactMoveFields">services</folder>
<folder>src</folder>
<folder>language</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB.plg_contact_contactMoveFields.ini</language>
<language tag="en-GB">language/en-GB.plg_contact_contactMoveFields.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="fieldMoves"
type="textarea"
label="Fields to move"
default="phone,email"
description="Give the name of the field you want to move and the name of the field you want the moved field to follow as a comma separated pair (e.g. phone,email would say to take the custom contact field 'phone' and place it after the standard contact form field 'email'). Place only one pair per line and put them in the order you want them to appear (e.g. phone,email [newline] fax,email will put the field order as email then phone then fax)"
/>
</fieldset>
</fields>
</config>
</extension>
Here is the directory structure.
Never mind. I am sure it was an issue of being case sensitive somewhere, but I refactored the whole thing using subscribed events and it is working fine.
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
joomla-dev-gene...@googlegroups.com.
To view this discussion, visit
https://groups.google.com/d/msgid/joomla-dev-general/SA1PR22MB4181E8D3BCFADF1008C9FA49CBE32%40SA1PR22MB4181.namprd22.prod.outlook.com.