Created
September 24, 2012 16:23
-
-
Save objectivehtml/3776820 to your computer and use it in GitHub Desktop.
Get author_id using polymorphic parameters with Channel Data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function author_id() | |
| { | |
| $params = array( | |
| 'username', | |
| 'screen_name', | |
| 'email' | |
| ); | |
| $where = array(); | |
| foreach($params as $param) | |
| { | |
| if($value = $this->param($param)) | |
| { | |
| $where[$param] = $value; | |
| } | |
| } | |
| $member = $this->EE->channel_data->get_members(array( | |
| 'where' => $where | |
| ))->row_array(); | |
| return isset($member['member_id']) ? $member['member_id'] : NULL; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment