Home » Documentation » What is PeoplePods? » SDK Documentation » Object Definitions » $Obj » $Obj->set()

$Obj->set()

// $Obj->set($field,$value);
$person->set('nick','Chester');
$content->set('headline','Hello World!');
$group->set('groupname','Fish Lovers');
$comment->set('comment','Shut up!');
$file->set('file_name','img');

Set the value of $field to $value.

Changes to values are not permanent until the save() function has been called on the object. However, it is important to note that only "real" fields - fields that exist as part of the core object - will be saved. Meta fields are not saved to the database unless the addMeta() function is used.

HOWEVER, this allows you to temporarily set or change values that are later discarded. These values can be accessed using get() and write() just like normal fields.

// set a temporary field on a $person object

if ($person->get('id') == $POD->currentUser()->get('id')) {
  $person->set('isCurrentUser','1',false);
}
$person->output();

You may be wondering what the third parameter above is doing. This tells set NOT to cache the new value. This parameter should be set to false for any value that will be different every time, or for each different user.

  • Discuss This Document

No comments have been posted yet.

Download Download the latest version of PeoplePods!

0.667 Latest Version:
Release Notes

A free membership is required to download PeoplePods.

  Already Registered? Login

Recent Posts from Our Blog

Developer Preview Launch!

I am very excited to announce the launch of PeoplePods version 0.666, THE DEVELOPER PREVIEW! After tons of hacking, I have tweaked the last line of code, and I am finally ready for a wider audience...