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

$Obj->addFlag()

$Obj->addFlag($flag,$person,$value=true);

Causes $person to add a flag named $flag to $Obj, with an optional value of $value. If no value is specified, it defaults to true.

To be clear, $person is the person object who is adding the flag. This is important to remember when adding flags to other person objects. The VAST majority of the time, the second parameter should be $POD->currentUser()

Some examples:


// flag a document as 'awesome'

$content->addFlag('awesome',$POD->currentUser());

// set a rating of 5 on a document
$content->addFlag('rating',$POD->currentUser(),5);

// set a 'block' flag on a person
$person->addFlag('block',$POD->currentUser());

Once a flag has been added, it can be referenced in your stack parameters:


// load all content with the awesome flag
$awesome = $POD->getContents(array(
  'flag.name'=>'awesome'
));

// load all content with a rating of 5
$top_rated = $POD->getContents(array(
  'flag.name'=>'rating',
  'flag.value'=>'5'
));

// load all people with the block flag
$blocked = $POD->getPeople(array(
  'flag.name'=>'block'
));

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

Several flag names are reserved by PeoplePods for use in pre-defined stacks: friend, favorite, watching, and vote. You can use any other flag name to define your own functionality.

  • Discuss This Document

No comments have been posted yet.

Download Download the latest version of PeoplePods!

0.7 Latest Version:
Release Notes

A free membership is required to download PeoplePods.

  Already Registered? Login

Recent Posts from Our Blog

Version 0.7 Now Available

Last night, I uploaded a new release of PeoplePods: version 0.7. The most exciting new features in this version are: new dynamic image resizing options, a faster comment polling system, new ways...

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