I am able to create Joomla articles programatically. Thanks to the below post. Create a Joomla! Article Programatically
The article is created successfully but now I want to capture the article id or the article url of the newly created Joomla article.
The idea is that once a registered user creates an article, the user will receive an email with the complete URL of the article that he/she has created.
-If the article ID can be fetched out, I can use index.php?option=com_content&view=article&id=XXX OR - If the complete SEF URL can be fetched out then it will be great
snippet of the code is as follows
else {
$table = JTable::getInstance('Content', 'JTable', array());
$data = array(
'catid' => $category,
'title' => $msgbody,
'fulltext' => $button,
'publish_down' => $sixdate,
'state' => 1,
'metakey' => $meta,
'metadesc' => $msgbody,
'ips' => $ip,
);
if (!$table->bind($data))
{
$this->setError($table->getError());
return false;
}
if (!$table->check())
{
$this->setError($table->getError());
return false;
}
if (!$table->store())
{
$this->setError($table->getError());
return false;
}
$mailer = JFactory::getMailer();
$config = JFactory::getConfig();
$sender = array(
$config->getValue( 'config.mailfrom' ),
$config->getValue( 'config.fromname' ) );
$mailer->setSender($sender);
$user = JFactory::getUser();
$urecipient = $user->email;
$mailer->addRecipient($urecipient);