Project:Type-local nids
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:jbrown
Status:needs review

Issue Summary

I currently use http://drupal.org/project/auto_nodetitle for the titles of my content types. And when I tried to use [lnid] nothing happens.
I tried the weight reduction (and increasing) for the module but it didn't help. It doesn't update the title even if I repost the content.
The only workaround that I found is to create Compute field and assign the [lnid] value to it, and then to use that field in the auto nodetitles. And even then this is not working in the first post, but I have to repost in order to update the correct title.

Is there a possibility to add that functionality - using [lnid] with auto nodetitle?

Comments

#1

I believe you could do this as follows: 1) Create a CCK field to hold the lnid (see #313476: Problem with CCK computed field). Then, 2) in Automatic Nodetitles, look for the replacement pattern of the field you just created and used at will.

#2

Hi,
can you please explain how to create a cck field to hold the lnid?

should I use the computed Type of data or something else to store it?
what whould be then writen in computed code text area?
thx in advance

#3

Title:Using lnid in Title» lnid not available in presave hook
Category:feature request» bug report
Assigned to:Anonymous» jbrown
Status:active» postponed

auto_nodetitle uses the presave hook so it can generate the title before the node is saved - the lnid is not available at this time

type_local_nids uses insert / update as it needs the nid for the key in its {node_lnid}

the lnid could be generated in presave to fix this

I am available for hire if anyone wants this fixed.

#4

Version:6.x-1.2» 6.x-1.x-dev
Status:postponed» needs review

This should be fixed because it generated notice

notice: Undefined property: stdClass::$lnid in /var/local/mods/type_local_nids/type_local_nids-DRUPAL-6--1/type_local_nids.module on line 127.
AttachmentSize
349524-lnid.patch 640 bytes

#5

Improved version, no need to increment counter while node is not saved

PS: a lot of trailing spaces on new lines should be fixed also. But not in this issue

AttachmentSize
349524-lnid.patch 1.28 KB

#6

thanks for the patch! works for me, and very helpful for exactly the same issue :)

#7

Version:6.x-1.x-dev» 7.x-1.x-dev

I created a wrokaround to use the token [node:lnid] in node title, for newly created nodes also!

The workaround is:

Use this code in autotitle form:

<?php
   
if ('[node:is-new]' == 'false')
      print(
'The node\'s lnid: #[node:lnid]');
    else
    print(
'No title yet');
?>

Install the Rules module, and configure is:

Event: After saving the new content
Conditions: Not required
Actions:
- Fetch entity by id (Node entity, [node:nid]) => creates an [entity-fetched] token
- Save entity ([entity-fetched])

#8

Will this work with D6?

#9

Version:7.x-1.x-dev» 6.x-1.x-dev

well, the original bug and the patch were both in D6, so I dunno why the version was changed, unless the module developer doesn't want to commit any further 6.x fixes.

#10

Thank you Martin.
Surely I'm doing something wrong, since my nodes title are "No title yet".
Any ideas?

Warm regards from sunny México!
: )
Pepe

#11

are you using the patch from #5? http://drupal.org/node/349524#comment-3238592

I think you're trying to use the patch from #7 and that's for D7, so it won't be of any use to you on D6.

#12

You're right!

Anyway, I settled my mind with another approach:

First I hide titles of the specific content types: http://drupal.org/node/426482

Then I let automatic nodetitles to name these nodes according to my taste (not my clients); then all these nodes are enlisted via Views and instead of calling for titles I enlist aliases, which are fashioned with type local nids according to my clients instructions, and are linked to their node.

I really appreciate your prompt reply : )

Warmest regards from sunny México!
: )
Pepe

EDIT:
Yet, I tried the right patch and it works like a charm. : ) So I changed mi mind, again, for this solution. Thanks!