Remove Joomla 4 generator Topic is solved
Moderators: pe7er, General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
-
- Joomla! Explorer
- Posts: 384
- Joined: Mon Mar 14, 2011 5:08 pm
Remove Joomla 4 generator
Hello
Thank you for the tremendous work done in the Joomla 4 release. Is it possible to remove the generator tag in Joomla 4. Where is it located? It is not where it was in Joomla 3. Is it possible to delete it?
Thank you for the tremendous work done in the Joomla 4 release. Is it possible to remove the generator tag in Joomla 4. Where is it located? It is not where it was in Joomla 3. Is it possible to delete it?
Last edited by toivo on Sat Nov 19, 2022 12:53 am, edited 1 time in total.
Reason: mod note: unlocked on request
Reason: mod note: unlocked on request
- pe7er
- Joomla! Master
- Posts: 24985
- Joined: Thu Aug 18, 2005 8:55 pm
- Location: Nijmegen, Netherlands
- Contact:
Re: Remove Joomla 4 generator
You could try adding a few lines to your template's index.php [edit: this J3 method seems to not work anymore in J4] :
Note that this can be overwritten when you update your template.
So you could code a system plugin to add the code,
or use a 3rd party system plugin to do it.
Code: Select all
use Joomla\CMS\Factory;
Factory::getDocument()->setGenerator('');
So you could code a system plugin to add the code,
or use a 3rd party system plugin to do it.
Kind Regards,
Peter Martin, Global Moderator
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com
Peter Martin, Global Moderator
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com
-
- I've been banned!
- Posts: 13639
- Joined: Sun Jul 05, 2009 3:30 am
- Location: Canberra, Australia
Re: Remove Joomla 4 generator
There was a plugin written several years ago by Michael Richey called ByeByeGenerator for J! 3.x. This plugin doesn't work in J! 4 and it probably doesn't work for J! 3.9 or J! 3.10 but, with a couple of small changes, it could probably be made to work.
If you replace line 52 of the file byebyegenerator.php with thisit will probably work. I haven't tried it.
If you replace line 52 of the file byebyegenerator.php with this
Code: Select all
if($app->isClient('administrator')) return true;
-
- Joomla! Explorer
- Posts: 384
- Joined: Mon Mar 14, 2011 5:08 pm
Re: Remove Joomla 4 generator
Unfortunately, but it doesn't work for me, I added the Cassiopeia template in the index.php file on the stable version of Joomla 4. As far as I remember, this is a code for Joomla 3.
Code: Select all
use Joomla\CMS\Factory;
Factory::getDocument()->setGenerator('');
-
- Joomla! Explorer
- Posts: 384
- Joined: Mon Mar 14, 2011 5:08 pm
Re: Remove Joomla 4 generator
I changed 52 in the indicated line byebyegenerator.php file, but unfortunately I get an error
0 Call to undefined method Joomla\CMS\Application\AdministratorApplication::isAdmin()
Code: Select all
if($app->isClient('administrator')) return true;
0 Call to undefined method Joomla\CMS\Application\AdministratorApplication::isAdmin()
- Webdongle
- Joomla! Master
- Posts: 44093
- Joined: Sat Apr 05, 2008 9:58 pm
Re: Remove Joomla 4 generator
Why bother? There are many other ways a hacker can identify the site as Joomla. Besides which the 'script kiddies' just blindly attack any site they can find rather than look for the generator tag first. Your time might be better spent making the site as bullet proof as possible instead of trying to hide it is Joomla.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
-
- Joomla! Explorer
- Posts: 384
- Joined: Mon Mar 14, 2011 5:08 pm
Re: Remove Joomla 4 generator
In joomla 3.x, the generator was located in the file
libraries/src/Document/Renderer/Html/HeadRenderer.php
In Joomla 4, there is no longer a generator in this file. Where has he been transferred? I can't find this in Joomal 4.
libraries/src/Document/Renderer/Html/HeadRenderer.php
In Joomla 4, there is no longer a generator in this file. Where has he been transferred? I can't find this in Joomal 4.
-
- I've been banned!
- Posts: 13639
- Joined: Sun Jul 05, 2009 3:30 am
- Location: Canberra, Australia
Re: Remove Joomla 4 generator
Sorry, sylwekb, there are two places "isAdmin()" in the file byebyegenerator.php that need to be replaced. The one at line 52 of the file byebyegenerator.php should be replaced withand the second one is at line 76 which should be replaced with Again I haven't tried it but these two changes should make it work. I hope it helps.
The method $app->isAdmin() is deprecated in J! 3.x since J! 3.7 and it generates an error in J! 4.x if you try to use it there. It's explained in https://docs.joomla.org/Potential_backw ... pplication
Code: Select all
if($app->isClient('administrator')) return true;
Code: Select all
if (JFactory::getApplication()->isClient('administrator')) return true
The method $app->isAdmin() is deprecated in J! 3.x since J! 3.7 and it generates an error in J! 4.x if you try to use it there. It's explained in https://docs.joomla.org/Potential_backw ... pplication
- brian
- Joomla! Master
- Posts: 12787
- Joined: Fri Aug 12, 2005 7:19 am
- Location: Leeds, UK
- Contact:
Re: Remove Joomla 4 generator
This is super simple. Just add one line of code to your template
if its inside a php block already
otherwisse
if its inside a php block already
Code: Select all
$this->setGenerator('');
Code: Select all
<?php $this->setGenerator(''); ?>
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/
-
- I've been banned!
- Posts: 13639
- Joined: Sun Jul 05, 2009 3:30 am
- Location: Canberra, Australia
Re: Remove Joomla 4 generator
Thanks, @brian. Will this be need to be re-done after updating J!
- brian
- Joomla! Master
- Posts: 12787
- Joined: Fri Aug 12, 2005 7:19 am
- Location: Leeds, UK
- Contact:
Re: Remove Joomla 4 generator
if you are adding this to cassiopeia and that gets updated then yes.
personally i would work on a copy of cassiopeia and then you are safe.
personally i would work on a copy of cassiopeia and then you are safe.
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/
-
- I've been banned!
- Posts: 13639
- Joined: Sun Jul 05, 2009 3:30 am
- Location: Canberra, Australia
Re: Remove Joomla 4 generator
Thanks, @brian.
This gives the OP a couple of options. You can modify the template's index.php file—best if you make a copy of the template first—or use a system plugin. I don't have any personal preference either way.
This gives the OP a couple of options. You can modify the template's index.php file—best if you make a copy of the template first—or use a system plugin. I don't have any personal preference either way.
-
- Joomla! Explorer
- Posts: 384
- Joined: Mon Mar 14, 2011 5:08 pm
Re: Remove Joomla 4 generator
Sozzled still error another frontend mistake this time
0 Class 'JResponse' not found
0 Class 'JResponse' not found
-
- I've been banned!
- Posts: 13639
- Joined: Sun Jul 05, 2009 3:30 am
- Location: Canberra, Australia
Re: Remove Joomla 4 generator
@sylwekb: As I wrote a couple of times before, it shouldn't be too difficult to work your way through the deprecated J! 3 classes and methods and rewrite them; I just looked at obvious booby traps—for example isAdmin()—but I didn't examine every line of code in the file byebyegenerator.php. I didn't test it myself; it's not high on my list of priorities.
Right now I just want to build a very basic website with J! 4.0—a few articles, a menu, and a login/logout) and I don't really care too much about the "icing on the cake" (e.g. concealing the fact that the website is built in J! 4).
You're right: JResponse is deprecated. A lot of software written before J! 4.0 was first conceived (in 2017) will break; a lot of software written before J! 3.9 already breaks when people update from versions older than J! 3.9. For some of us, who have the patience to debug someone else's software, many of these defects can be fixed. I don't have a strong motivation to fix other people's broken software; I have enough fun trying to fix my own software when it breaks, thank you very much.
I believe that it's possible to develop a system plugin that works like ByeByeGenerator worked. It all depends on one's motivation; it doesn't require skill: it's a "management problem". If you want something done and you don't have the skill to do it, you can always pay someone else to do the job for you.
For example, we had a broken air-conditioning unit in our main bedroom; it's been that way for the past 10 months (and Canberra's climate goes from extreme cold to extreme heat) but we survived summer by buying a ceiling fan (for $400) ... and paying an electrician ($600) to install it. I can't fix broken air-conditioning systems; I don't have the know-how and I don't have the right tools. Yesterday we paid an A/C company to repair the broken system and it works beautifully now. $550 is all it cost. Like I say, it's a "management problem": just about anything can be solved if you know the right people to do something for you and you pay them for their service.
The solution is—nine times out of ten—a matter of what motivation one has to seek it.
Right now I just want to build a very basic website with J! 4.0—a few articles, a menu, and a login/logout) and I don't really care too much about the "icing on the cake" (e.g. concealing the fact that the website is built in J! 4).
You're right: JResponse is deprecated. A lot of software written before J! 4.0 was first conceived (in 2017) will break; a lot of software written before J! 3.9 already breaks when people update from versions older than J! 3.9. For some of us, who have the patience to debug someone else's software, many of these defects can be fixed. I don't have a strong motivation to fix other people's broken software; I have enough fun trying to fix my own software when it breaks, thank you very much.
I believe that it's possible to develop a system plugin that works like ByeByeGenerator worked. It all depends on one's motivation; it doesn't require skill: it's a "management problem". If you want something done and you don't have the skill to do it, you can always pay someone else to do the job for you.
For example, we had a broken air-conditioning unit in our main bedroom; it's been that way for the past 10 months (and Canberra's climate goes from extreme cold to extreme heat) but we survived summer by buying a ceiling fan (for $400) ... and paying an electrician ($600) to install it. I can't fix broken air-conditioning systems; I don't have the know-how and I don't have the right tools. Yesterday we paid an A/C company to repair the broken system and it works beautifully now. $550 is all it cost. Like I say, it's a "management problem": just about anything can be solved if you know the right people to do something for you and you pay them for their service.
The solution is—nine times out of ten—a matter of what motivation one has to seek it.
-
- Joomla! Hero
- Posts: 2906
- Joined: Fri Jul 05, 2013 10:35 am
- Location: Parts Unknown
Re: Remove Joomla 4 generator
Made a simple plugin for J4, in case anyone needs. Download here https://github.com/SharkyKZ/plg_system_ ... r/releases.
-
- I've been banned!
- Posts: 13639
- Joined: Sun Jul 05, 2009 3:30 am
- Location: Canberra, Australia
Re: Remove Joomla 4 generator
Thanks @SharkyKZ. I'll have a look at what you wrote in a few days.
-
- I've been banned!
- Posts: 13639
- Joined: Sun Jul 05, 2009 3:30 am
- Location: Canberra, Australia
Re: Remove Joomla 4 generator
I asked the moderators to unlock this topic so that I could thank @SharkyKZ for his idea. I’m sorry it took me so long.
The plugin developed by @SharkyKZ works wonderfully well.
The plugin developed by @SharkyKZ works wonderfully well.
- stutteringp0et
- Joomla! Ace
- Posts: 1389
- Joined: Sat Oct 28, 2006 11:16 pm
- Location: Texas
- Contact:
Re: Remove Joomla 4 generator
ByeByeGenerator author here.
I ran into the same issue as you gents, and I have a solution that doesn't require a plugin and doesn't modify any core files (or template files) which may be overwritten in an update.
I'm trying to eliminate many of my own extensions, so I don't believe ByeByeGenerator is going to survive the upcoming purge of my own work.
Still, it's an important feature to secure your site - reduce fingerprinting.
Anyway, you can do it with a template override.
I copied:
/layouts/joomla/system/message.php
into
/templates/mytemplate/html/layouts/joomla/system/message.php
I deleted everything after the "use Joomla\..." lines, and inserted the following:
What this does is set the generator to an empty value (causing Joomla to omit it), and then includes the original file used to create this override.
Voila - no more generator, no core modifications, upgrade-safe.
Enjoy!
I ran into the same issue as you gents, and I have a solution that doesn't require a plugin and doesn't modify any core files (or template files) which may be overwritten in an update.
I'm trying to eliminate many of my own extensions, so I don't believe ByeByeGenerator is going to survive the upcoming purge of my own work.
Still, it's an important feature to secure your site - reduce fingerprinting.
Anyway, you can do it with a template override.
I copied:
/layouts/joomla/system/message.php
into
/templates/mytemplate/html/layouts/joomla/system/message.php
I deleted everything after the "use Joomla\..." lines, and inserted the following:
Code: Select all
Factory::getDocument()->setGenerator('');
include JPATH_ROOT.'/layouts/joomla/system/message.php';
Voila - no more generator, no core modifications, upgrade-safe.
Enjoy!
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.
Honk if this signature offends you.
-
- Joomla! Fledgling
- Posts: 3
- Joined: Fri May 19, 2017 1:30 pm
Re: Remove Joomla 4 generator
SharkyKZ wrote: ↑Thu Sep 02, 2021 7:29 amMade a simple plugin for J4, in case anyone needs. Download here https://github.com/SharkyKZ/plg_system_ ... r/releases.
Works fine for me removal not modifying is what I was looking for