Renaming a block

Renaming a block

by Mr. Marc -
Number of replies: 4
how could i rename the messages block to Instant messages?

I tried and now im getting a double instant messages around the block name.

Moodle 1.9.4 (Build: 20090128)
Cant upgrade in the middle of the school year.

Any help would be appreciated!!!

Attachment 4-22-2010_8-42-32_PM.png
Average of ratings: -
In reply to Mr. Marc

Re: Renaming a block

by Teresa Gibbison -
Hi Mr Marc
You should be able to edit this via the Language editing (via the Edit words or phrases - messages.php file in Administration ► Language ► Language editing) however remember this will change the word 'Messages' to "Instant messages" throughout the entire site.

I don't think this will be an issue for you but if so, you could always hack the code behind the block to hard code the title. I'm no expert but if you change the moodle/blocks/messages.php file as follows it should work.

class block_messages extends block_base {
function init() {
$this->title = get_string('messages','message');

to:
class block_messages extends block_base {
function init() {
$this->title = 'Instant messages';


Please note: I only dabble in code so you should definitely try this on a test site before your production site!!

I hope this helps, if only the language editing via the Admin interface!
Cheers
Teresa
In reply to Teresa Gibbison

Re: Renaming a block

by Mr. Marc -
Thank you Teresa,
I did what you explained in the last with the code and that is when I got the double around the wording and havent been able to see why?


Marc
In reply to Mr. Marc

Re: Renaming a block

by Teresa Gibbison -
Hi there

I have just had a play on my development site and I don't get the square brackets. Make sure the title line has no string reference, so looks like this:
 $this->title = 'Instant message';
I'm sure that the square brackets represents a string that is not defined (so if you had $this->title = get_string('Instant messages','Instant message' Moodle would put the square brackets around because those strings are not defined in the language pack);

I hope this helps
Cheers
Teresa