Forums

Can't delete article created with DB save action

FloB 16 Mar, 2013
Hello!

Working with:
Joomla! 2.5.8
CF 4.0 RC3.5.2

I've created a form that created an article with some informations asked in the form.
I can't use the action Sumit article (because it's too simple) so I use a simple DB save.
The article is created ok.
But I can't delete it in the backend, even with the admin count. I need to go in the db with PhpMyAdmin, where I can delete it.
The articles created with the joomla submit article can be delete in the backend.

I set the following data in the form:
title
alias
introtext
catid
state
access
created_by
created
publish_up
metakey
language

I can't see any difference between the article created with my form and those created with joomla in the rights of the articles.
I've got difference in the following data:
images -> set to {"image_intro":"","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""} with joomla and null with my form
urls -> set to {"urla":null,"urlatext":"","targeta":"","urlb":null,"urlbtext":"","targetb":"","urlc":null,"urlctext":"","targetc":""} with joomla and null with my form
attribs -> set to {"show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","link_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_item_navigation":"","show_icons":"","show_print_icon":"","show_email_icon":"","show_vote":"","show_hits":"","show_noauth":"","urls_position":"","alternative_readmore":"","article_layout":"","show_publishing_options":"","show_article_options":"","show_urls_images_backend":"","show_urls_images_frontend":""} with joomla and null with my form
metadata -> set to {"robots":"","author":"","rights":"","xreference":""} with joomla and null with my form

Have you ever seen that?
What could I do?
Thanks

Flo
GreyHead 16 Mar, 2013
Hi FloB,

Sorry, I've no idea. Is the problem perhaps the article ownership?

I would probably use the Submit Article action and add any extra settings to the $from->data array before the action.

Bob
FloB 16 Mar, 2013
Hello Bob!
The article is created by the admin and it's with the same log that I try to delete it.
As Super administrator I sould be able to do all I want no?
I've tried to replace the db save action by the submit article action, but it change nothing : the article is saved but I still can't delete it...
It's not so terrible, because I can delete it with PhPMyAdmin, but it's a bit odd.
I'm not going to spend my time with it, but if you have another idea, let me know🙂
Thanks
Flo
GreyHead 16 Mar, 2013
Hi FloB,

My only other suggestion would be to turn on the site Debug and see if there is any error from the MySQL query when you try to delete. That might give you a clue?

Bob
FloB 16 Mar, 2013
Hi!
Already tried : I turned the Error Reporting on Development but nothing happened when I tried to delete the article -> the article unchecked with no error message...
More precision : I can trashed the article (status = -2) but can't empty the trash (if it wasn't obvious in the previous messages).
Strange...
Any idea?
GreyHead 17 Mar, 2013
Hi FloB,

Sorry no bright ideas here :-(

Bob
FloB 29 Mar, 2013
Hello!
I think I have found the problem.
When I created the articles I didn't set the assets id neither the params in the #_assets table.
That's why it's bug when I try to delete the articles.
Did the Submit Article action take care of this #_assets table?
How can I set in the Submit Article action a different category depending on the results of the form?
Thanks
Flo
GreyHead 29 Mar, 2013
Hi Flo,

I don't know anything about the #__assets table :-(

I have used code like this to set up custom article details (this is from the FAQs edit form):
<?php
$article =& $form->data['Article'];
// Search for the {readmore} tag and split the text up accordingly.
if (isset($article['articletext'])) {
  $pattern = '#<hr\s+id=("|\')system-readmore("|\')\s*\/*>#i';
  $tagPos = preg_match($pattern, $article['articletext']);
  if ( $tagPos == 0 ) {
    $article['introtext'] = $article['articletext'];
    $article['fulltext'] = ''; 
  } else {
    list ($article['introtext'], $article['fulltext']) = preg_split($pattern, $article['articletext'], 2);
  }
}
$user =& JFactory::getUser();
$article['sectionid'] = 3;
$article['alias'] = 
  JFilterOutput::stringURLSafe($article['title']);
if ( empty($article['id']) ) {
  // this is a new FAQ
  $article['created'] = date("Y-m-d H:i:s");
  $article['created_by'] = $user->id;
  if ( $user->name == 'Administrator' ) {
    $article['created_by_alias'] = 'Max';
  }
} else {
  // this is an edited FAQ
  $article['modified'] = date("Y-m-d H:i:s");
  $article['modified_by'] = $user->id;
}
?>
I'm sure you can use the same idea to set the Category ID.

Bob
FloB 29 Mar, 2013
Hello Bob!

For the #_assets table, it seems that it sets the rights on the objects categories, components, articles...).
And the articles created by db save or submit article action are not correctly set up in this table.
When you create an article via the backend or the frontend using the joomla utilities, it creates an entry in the #_assets table, where you can find the level of the object, a unique name (set to "com_content.article.id of the article") and some rules (core.delete, core.edit...).
When you create an article via the db save or the submit article action, the level is uncorrect, the name is set to "#_content.id of the article" and no rules.
If you edit via the joomla utilities your article then joomla sets a new assets_id and create a new record in the assets table (but the record create with th db save or submit article is not delete, so you have to delete it manually). Then you can delete your article via the backend.
Am I the first with this problem?

Thanks
Flo
GreyHead 29 Mar, 2013
Hi Flo,

Yes, you are exploring here . . .

Bob
FloB 29 Mar, 2013
Hello bis!

About the custom code you posted before, I understand and I coded something like that to set the catid.
But what I want to know is how you link this code to the submit article action?

Flo
GreyHead 31 Mar, 2013
Hi Flo,

I've looked at it again and my code is used with ChronoConnectivity, not with the Submit Article action; I think that you'll need to use a DB Save action(s) (or a modified Submit Article action) to do what you need here :-(

Bob
This topic is locked and no more replies can be posted.