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

$Obj->addMeta()

// $Obj->addMeta($field,$value);
$person->addMeta('about_me','I live in Austin');
$content->addMeta('endDate','2012-12-31');
$group->addMeta('motto','Stay Classy');

Add a meta field to the object named $field with the value $value. This new field will be saved to the database immediately.

After the field has been added, it can be accessed using the normal write() and get() functions, but if you want to change it's value, you must use addMeta().

An optional third parameter can be set to strip $value of any HTML:

$person->addMeta('tagline','I am putting bold tags!',true); // value will be stripped of html

Meta fields cannot contain blank strings or null values. Setting a meta field to a blank value will result in it being removed.

There is ONE reserved meta field name: adminUser. This field has a special meaning, and thus, you should not mess with it. Seriously!

Once you've added a meta field, you can refer to it in your stack parameters by using the m.name and m.value fields:

$content->addMeta('transaction_status','active');

// get all content that has a meta field named
// transaction_status that is set to 'active'
$active_transactions = $POD->getContents(array(
  'm.name'=>'transaction_status',
  'm.value'=>'active'
));

You can also just look for the existence of a meta field:

// get content that has a sidebar field.
$content_with_sidebars = $POD->getContents(array(
  'm.name'=>'sidebar'
));

At this point, you can only refer to one meta field at a time in your stack parameters. In some future version of PeoplePods, this may change.

Read more about Meta Fields.

  • 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...