Wednesday 08 September 2004 5:38:34 am
Hi Paul, I've plugged away and discovered that for both fetching and storing all objects go through the the constructor method of ezcontentobject.php As a result I tried adding a fix in the constructor: Original code
function eZContentObject( $row )
{
$this->eZPersistentObject( $row );
$this->CurrentLanguage = eZContentObject::defaultLanguage();
}
Hacked code
function eZContentObject( $row, $MyLang )
{
$this->eZPersistentObject( $row );
if ($MyLang==''){
$this->CurrentLanguage = eZContentObject::defaultLanguage();
}
else{
$this->CurrentLanguage = $MyLang;
}
}
And in the create method: Original code
function &create( $name, $contentclassID, $userID, $sectionID = 1, $version = 1 )
{
$row = array(
"name" => $name,
"current_version" => $version,
"contentclass_id" => $contentclassID,
"permission_id" => 1,
"parent_id" => 0,
"main_node_id" => 0,
"owner_id" => $userID,
"section_id" => $sectionID,
'remote_id' => md5( (string)mt_rand() . (string)mktime() ) );
return new eZContentObject( $row );
}
Hacked code
function &create( $name, $contentclassID, $userID, $sectionID = 1, $version = 1 )
{
$row = array(
"name" => $name,
"current_version" => $version,
"contentclass_id" => $contentclassID,
"permission_id" => 1,
"parent_id" => 0,
"main_node_id" => 0,
"owner_id" => $userID,
"section_id" => $sectionID,
'remote_id' => md5( (string)mt_rand() . (string)mktime() ) );
/*addition to make user edit work*/
if ($contentclassID==4){
return new eZContentObject( $row, "eng-GB" );
}
/*end of addition*/
else {
return new eZContentObject( $row );
}
}
When I ran this I managed to create a user which was unaccesible in all languages for editing! I'm gonna try also editing the fetch method as well... Let me know if you have any ideas/suggestions (e.g. This won't work Joe! ;)) cheers Joe
|