Questions and Answers

How do I collect points?

  • +4
    Chosen as best answer
  • +1
    Posted answer
  • +1
    Posted question
  • +1
    Thumb up
  • -1
    Thumb down
8

by M in Coding about October 20, 2011 closed - report

Get gender and birthdate

Anyone know how to get a users gender and birthdate from the current session. I would rather retrieve this info from an object instead of querying the database. This is for a custom module.

Answer: 1  •  Score 0  •  Views: 1883

1 Answer
Browse by
  • 37

    by Anatolii about October 25, 2011 Best answer

    $viewer = Engine_Api::_()->user()->getViewer(); //Get user
    $fields = $viewer->fields()->getFieldsValuesByAlias(); //Get user's settings fields
    $birthdate = $fields['birthdate'];
    $gender = $fields['gender'];
Question was closed.