Forums | Mahara Community

Developers /
Error when save data

Noraini's profile picture
Posts: 13

13 October 2017, 21:24

Hi everyone,

I'm having this error after add new field in Profile Section. I want to add field 'Age' and save it into database:


[WAR] 8c (lib/errors.php:536) [InvalidArgumentException]: Classname ArtefactTypeAge not a valid artefact type
Call stack (most recent first):
  • exception(object(InvalidArgumentException)) at Unknown:0


Really appreciate if somebody could help me. Thank you.


Cecilia Vela's profile picture
Posts: 110

01 November 2017, 12:10

Hi Noraini,

To be able to have a new profile item in the system, you need to define an artefact for it. Here you can find more details about artefacts.

But in this case, we have a patch that can be really useful:
This patch is basically an example of how to define a new profile field that only adds/modifies files in /local/ directory. This directory is where we should add the customisations for a particular site, this way we don't have to worry about merge conflicts when upgrading to a new version of Mahara. One of the files in this patch, artefact_intenal.php, defines functions to handle the new fields values, you can find more details about what these functions do in /local/lib-dist.php.

You can cherry pick this patch in your site and change the bits you need according to your needs.

I hope this example helps you,

Noraini's profile picture
Posts: 13

01 November 2017, 13:47

Thanks Cecilia for the response.

My problem solved when i add function in artefact/internal/lib.php :

class ArtefactTypeAge extends ArtefactTypeProfileField {}

But when i save, value age only update in table artefact but not update in table usr. I'm trying to figure out what the reason but still could not found the solution.

Really appreciate if someone can help me.


Thank you.


3 results