How does one go about deleting translated nodes?

I mean, deleting the source node does not seem to delete the translations of this node. Do I have to go hunting for the other nodes, too?

I understand that in some case you might NOT want to delete all the other translated nodes, but shouldn't there be an option during deletion time...?

Thanks.

CommentFileSizeAuthor
#2 patch.txt2.03 KBstratosgear

Comments

jose reyero’s picture

Component: User interface » Synchronization

This may be a good option to add to the synchronization module (i18nsync)

stratosgear’s picture

Status: Active » Needs review
StatusFileSize
new2.03 KB

OK Jose,

Here is a version I whipped up. Tests and works fine on my installation, but you should definetely take a look because I'm not that experienced with Drupal yet.

What I've done:

* The node delete confirmation page also offers a list of checkboxes with all the available translations.
* You just have to check the additional nodes to be deleted and click Delete.
* The checked checkboxes are iterated through in i18nsync_node_delete_submit and node_delete is called on each checked node.

The only problem, is that I just can't reorder the form items and the checkboxes appear bellow the Delete, Cancel buttons. Just don't know how to "pull" them higher up.

Thanks

PS: It's really difficult to produce a clean patch on i18nsync.module as it has a lot of trailing spaces, that Eclipse just keeps removing. I hand removed them so you can see what I did.

tomsm’s picture

This is a great feature that should be added.

stratosgear’s picture

Have you tried the patch?

I would be interested to know of any potential problems.

tomsm’s picture

No, I did not. Sorry, I am not very familiar with applying patches.

jose reyero’s picture

Status: Needs review » Needs work

The patch looks good though it needs some more work.

It is missing some permission checking and filtering on node titles (check_plain). Anyway we may not need all node titles, maybe a single 'delete translations' check box would do and could simplify the patch.

I like the idea, looks like a good starting point.

jose reyero’s picture

Status: Needs work » Closed (won't fix)

Cleaning old issues (> 1 year without follow up)

mortician’s picture

Status: Closed (won't fix) » Needs work

Any update on this?

marinex’s picture

Here is my part of the patch:

      if ($tnid != 0) {
        //drupal_set_message("Tnid: " . $tnid);

        $nodes = array();
        $translatedNodes = db_query('SELECT n.nid, n.tnid, n.title, l.name FROM {node} as n, {languages} as l where n.language = l.language and tnid = %d', $tnid);
        while($n = db_fetch_object($translatedNodes)){
          if($n->nid != $nid && node_access('delete', $n))
          $nodes[$n->nid] = "[".$n->name."] ". check_plain($n->title);
        }
        $form['i18nsync_delete_nodes'] = array (
    	  '#type'            => 'checkboxes',
          '#title'		=> t("Also, delete translated nodes"),
    	  '#options'         => $nodes,
          '#weight'          => 0,
    	  '#default_value'   => array(0,),
        );
      }

I add node_access check control and check_plain control and finaly I edit weight of form items to be upper.

jose reyero’s picture

Status: Needs work » Closed (won't fix)

It is just too late for new features for 6.x