Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function actionSaveJob()
- {
- // get 'post to field' mappings from plugin settings
- $pluginSettings = craft()->plugins->getPlugin('JobPostPlugin')->getSettings();
- $titlePostVar = $pluginSettings->titlePostVar;
- $bodyPostVar = $pluginSettings->bodyPostVar;
- $summaryPostVar = $pluginSettings->summaryPostVar;
- // retrieve post data
- $title = craft()->request->getPost($titlePostVar);
- $body = craft()->request->getPost($bodyPostVar);
- $summary = craft()->request->getPost($summaryPostVar);
- // create a new entry
- $entry = new EntryModel();
- $entry->sectionId = 2;
- $entry->typeId = 2;
- $entry->authorId = 1;
- $entry->enabled = true;
- // set entry content
- $entry->getContent()->setAttributes(array(
- 'title' => $title,
- 'body' => $body,
- 'summary' => $summary,
- ));
- $success = craft()->entries->saveEntry($entry);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement