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?

CommentFileSizeAuthor
#5 349524-lnid.patch1.28 KBandypost
#4 349524-lnid.patch640 bytesandypost

Comments

wibe’s picture

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.

HoKe’s picture

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

jbrown’s picture

Title: Using lnid in Title » lnid not available in presave hook
Assigned: Unassigned » jbrown
Category: feature » bug
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.

andypost’s picture

Version: 6.x-1.2 » 6.x-1.x-dev
Status: Postponed » Needs review
StatusFileSize
new640 bytes

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.
andypost’s picture

StatusFileSize
new1.28 KB

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

arski’s picture

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

tommychris’s picture

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:

    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])
pepemty’s picture

Will this work with D6?

arski’s picture

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.

pepemty’s picture

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

arski’s picture

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.

pepemty’s picture

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!