Forums

Joomla 'Submit Article' function

rhliberman 10 Sep, 2014
Hi,

Is there any way to extend this function to include other Joomla fields - i.e. Meta Keywords?

Thanks!
Robert
GreyHead 11 Sep, 2014
Hi Robert,

Once the article has been created the new article ID is available in the $form->data[''] array (add Debugger action to see exactly where) so you can use that to update the record with other values. I think there is an example in the forums or FAQs of changing a Category like this.

Bob
megana 28 May, 2015
What about for CFv5? I added a debugger on my form but it doesn't display any additional info about the Joomla article that was created, only the fields that were on the form when it was submitted.
GreyHead 29 May, 2015
Hi Megana,

No it doesn't :-(

You can get it with this PHP in a Custom Code action provided that the title is unique
<?php
$db = JFactory::getDBO();
$query = "
    SELECT `id`
        FROM `#__content`
        WHERE `title` = '{$form->data['title']}' ;
";
$db->setQuery($query);
$form->data['article_id'] = $db->loadResult();
?>
Note: edit $form->data['title'] to use the name of your title element.

This will return the article id in $form->data['article_id']

Bob
megana 29 May, 2015
Aha, thanks for the idea Bob! I bet I can add some extra parameters in case the title isn't unique. Order by publish date, limit 1, etc.
This topic is locked and no more replies can be posted.