engage icon indicating copy to clipboard operation
engage copied to clipboard

Editing a Comment Displays Home Page Content.

Open ikesaber opened this issue 8 months ago • 6 comments

When users try to edit comments on my site, the page to edit a comment displays home page content, particularly modules. Usually when this happens, I can create a menu item for the component and the issue is resolved by showing a different template style, but I don't see a way to create a menu item for Engage. Can you tell me how this problem should is solved?

Thank you.

ikesaber avatar Apr 28 '25 00:04 ikesaber

I cannot reproduce your issue.

Modules which are assigned to the home menu item only are not displayed on the edit page.

Modules which are assigned to “Any page” are, of course, displayed exactly as per their assignment.

Please note that this is on a clear Joomla! 5.3 installation. I know that there are third party plugins which will “intercept” URLs without an active menu item (i.e. URLs which do not ultimately resolve an Itemid URL parameter) and redirect them to your Home page, or add your Home menu item's Itemid to them. This is not something I can do anything about. I use Joomla's published method for creating a page URL without an Itemid.

If you can't figure it out you can always create a file components/com_engage/tmpl/comments/default.xml with these contents:

<?xml version="1.0" encoding="utf-8"?>
<metadata>
    <layout title="FAKE_VIEW">
        <message>
            <![CDATA[Engage Fake View]]>
        </message>
    </layout>
</metadata>

This lets you create a hidden menu item to Engage. I don't recommend this because visiting this menu item's URL without additional parameters just gives you Joomla's access denied error. But, I mean, if you really need it to make your site work that's better than nothing, right…?

nikosdion avatar Apr 28 '25 09:04 nikosdion

The modules are definitely set to only display on the home menu item, and not on the articles. The site is Joomla! 4.4.13 with Gantry 5 Helium 5.5.19, but I have not compared to a clear installation.

I created components/com_engage/tmpl/comments/default.xml with those contents using my file manager, and created a hidden menu item for engage with the Cassiopeia theme but the site is still showing Helium home page style and modules when I edit the comment.

ikesaber avatar Apr 28 '25 15:04 ikesaber

I believe that the problem has to do with your template. Maybe there's an option to show certain modules on pages without an Itemid?

nikosdion avatar Apr 28 '25 15:04 nikosdion

Also, for what it's worth, Engage is not doing anything weird. It is doing the exact same thing core Joomla components, such as com_content, do when it comes to front-end editing. Just try it in a clean installation, and you'll see.

The best thing you can probably do with a weird template like this is not use it, creating your own template based on Cassiopeia.

The second best thing you can do, if you insist on using this template, is to either disallow comment editing, or stop caring about the modules being displayed. In my opinion, disallowing comment editing is probably the better approach. It's a bad idea allowing people to edit comments anyway; it's a feature added for very specific use cases.

nikosdion avatar Apr 28 '25 16:04 nikosdion

Between redoing the template and disabling editing, I'll go with disabling editing for now, but I don't see that option in configuration.

ikesaber avatar Apr 28 '25 22:04 ikesaber

Make sure the user groups of your visitors do not have the Edit Own privilege (soft or hard deny).

nikosdion avatar Apr 30 '25 14:04 nikosdion

This is due to Joomla's internal behavior. As the comment edit page has no internal ID (you cannot bind it in a menu), then it uses a default one which happens to collide with Joomla's way of managing the home page. To avoid that, I put in my template's index.php:

<?php
$realid = $app->input->getString("id", "");
$menu = $app->getMenu()->getActive();
$is_on_module_without_pin = $menu == $app->getMenu()->getDefault() && $realid != "";
?>
<?php
// Add this condition on all the places where you do not want the module to be displayed on the "edit comment" page
 if (!$is_on_module_without_pin): ?>
    <div class="sidebar-right">
        <jdoc:include type="modules" name="sidebar-right" style="card" />
    </div>
<?php endif; ?>

This explains part of the problem and how to solve it: https://docs.joomla.org/How_to_control_module_display_when_linking_to_an_article_with_no_menu_item.

NicolasDerumigny avatar Jun 23 '25 14:06 NicolasDerumigny