What am I doing wrong? (moodle 2)

What am I doing wrong? (moodle 2)

by Adam Landow -
Number of replies: 1
I'm trying to make a start on block development- so far I have made a folder - /block/unep_test containing a file, block_unep_test.php which contains the following text:

<?php

/**
* Test block by Adam.
*
* @package block_unep_test
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

class block_unep_test extends block_base{

//initialise the component
function init() {
$this->title = get_string('pluginname', 'block_unep_test');
$this->version = 2010081200;
}

function get_content () {

if ($this->content !== NULL) {
return $this->content;
}
$this->content->footer = 'This is the footer text';
$this->content->text = 'This is the content text';
return $this->content;
}

}

I've also put a file block_unep_test.php in the folder /blocks/lang/en/ containing:

<?php

$string['pluginname'] = 'Test block';

When I go to the Notifications section of the Moodle site I get the following message:

"Plugin "block/unep_test" is defective or outdated, can not continue, sorry."

What am I doing wrong?
Average of ratings: -
In reply to Adam Landow

Re: What am I doing wrong? (moodle 2)

by Adam Landow -
Found the problem- on inspection of the other blocks in a standard Moodle 2 install I noticed there was a version.php file containing, essentially

<?php

$plugin->version = 2010081200;

where the big number is year-month-day-iteration I think.

Dropping one of those version.php files into the block folder instead of the

$this->version = 2010081200;

line in the
block_unep_test.php file worked a treat!