Remove the "More information about this error" link

Remove the "More information about this error" link

by Dustin Elliott -
Number of replies: 11
Is it possible to remove the "More information about this error" link found on error pages like the one below?

If I can't remove the link I would at least like to be able to change the URL that it points to so people are not taken outside of my site.

errorpage.bmp
Average of ratings: -
In reply to Dustin Elliott

Re: Remove the "More information about this error" link

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Look for an admin setting called something like docsulr, to change or hide these links.

Alternatively, you can probably hide the link by adding an appropriate display: none; rule to the stylesheet in your theme.
In reply to Dustin Elliott

Re: Remove the "More information about this error" link

by Alberto JV -
To modify the URL, you can also go to Site Administration -> Appearance -> Moodle Docs and change the Moodle Docs document root (docroot). It is important to keep the same path format in your site.

Another option to remove the link would be to edit the print_error() function in lib/weblib.php (1.9) or lib/outputlib.php (2.0)
In reply to Alberto JV

Re: Remove the "More information about this error" link

by Dustin Elliott -
Thanks guys!

I found the best solution for me was to modify the weblib.php file as Alberto suggested.

I removed the following code from lib/weblib.php and that removed the "More information about this error" link.

$message = clean_text('<p class="errormessage">'.$message.'</p>'.
'<p class="errorcode">'.
'<a href="'.$errordocroot.'/en/error/'.$modulelink.'/'.$errorcode.'">'.
get_string('moreinformation').'</a></p>');



In reply to Alberto JV

Re: Remove the "More information about this error" link

by Sarah Jane -

Hi AlbertoJV

I hope you can help please. I wish to remove the above message I have tried to follow your instructions but assume I am in a different version as I can't locate the code anywhere, in the files you mention.- can you advise where I can access the correct code in moodle 2.0.8+ please?

Regards  sarah x

In reply to Sarah Jane

Re: Remove the "More information about this error" link

by George V -

FILE:
/lib/outputrenderers.php

FIND:

$message = '<p class="errormessage">' . $message . '</p>'.
'<p class="errorcode"><a href="' . $moreinfourl . '">' .
get_string('moreinformation') . '</a></p>';
$output .= $this->box($message, 'errorbox');

REMOVE the red bit!

Use notepad or notepad++ to do it, MS-word will mess it up!

Average of ratings: Useful (1)
In reply to George V

Re: Remove the "More information about this error" link

by Rex Lorenzo -

A better way to do that without hacking Moodle core code is to define the following in your theme:

.errorcode {display:none}

Average of ratings: Useful (3)
In reply to Rex Lorenzo

Re: Remove the "More information about this error" link

by Shahab Mohd -
Thanks Rex. I think it is the best method.
In reply to Shahab Mohd

Re: Remove the "More information about this error" link

by Philip Varghese -

Which part of the theme should I put this code in?

Will this method stop all error messages or a specific error message?

Thanks

In reply to Philip Varghese

Re: Remove the "More information about this error" link

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Add Rex's suggestion to your theme customcss (the other alternatives suggested that involve hacking core will cause problems on any upgrade).

Don't forget to purge all caches

It will affect any item (error message) with the class suggested by Rex. If you find any others, then add that class selector (use firebug or browser developer tools to find the relevant class) in the same way.

In reply to Richard Oelmann

Re: Remove the "More information about this error" link

by Philip Varghese -

Thanks Richard.

I like this method as it's upgrade friendly.