ELGG 1.8
Hello.
I have a problem.
I need to run the console task, which is importing loads of objects into elgg's entities.
Here are some code strings:
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php");
elgg_set_context('main');
$entityGuid = create_entity('object', 'objects_subtype', 1, get_default_access(), 1, 1);
var_dump($entityGuid);
Result is: bool(false) and there are no errors.
Help!
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- yandrushenko@yandrushenko
yandrushenko - 0 likes
- Brett@brett.profitt
Brett - 0 likes
- $ent->subtype is set twice. This doesn't matter, but I don't think it's what you meant. Note that you can't go $ent->type = 'type'; The type is controlled by the class. ElggObject is type 'object'.
- You need to disable access control with elgg_set_ignore_access(true);
- yandrushenko@yandrushenko
yandrushenko - 0 likes
You must log in to post replies.$ent = new ElggObject();
$ent->subtype = 'object';
$ent->subtype = 'object_subtype';
$ent->title = 'title';
$ent->description = 'description';
$ent->access_id = ACCESS_PUBLIC;
$ent->owner_guid = 1;
$ent->container_guid = 1;
$ent->site_guid = 1;
$ent->save();
This works. But I've got a message: "Unable to save new object's base entity information!"
It seems that I have to be logged in, but how can I log in through console?
Two things:
Thanks, Brett!