Following up on my other post here #1194704: What is the proper token format for D7 branch? I wanted to share what is and isn't working in the D7 branch.

The following fields work correctly

CURRENT DATE
Custom format [current-date:custom:?]
Long format [current-date:long]
Medium format [current-date:medium]
Raw timestamp [current-date:raw]
Short format [current-date:short]
Time-since [current-date:since]

CURRENT PAGE
Page argument [current-page:arg:?]
Page number [current-page:page-number]
Title [current-page:title]
URL [current-page:url]

SITE INFORMATION
Current date [site:current-date]
Current group [site:current-group]
Email [site:mail]
Logged in user [site:current-user]
Login page [site:login-url]
Name [site:name]
Slogan [site:slogan]
URL [site:url]
URL (brief) [site:url-brief]

CURRENT USER
Created [current-user:created]
Edit URL [current-user:edit-url]
Email [current-user:mail]
IP address [current-user:ip-address]
Last login [current-user:last-login]
Name [current-user:name]
Picture [current-user:picture]
URL [current-user:url]
User ID [current-user:uid]

My site was migrated from D6->D7, so my custom user fields were created using the profile module. Those custom user fields that appear under the CURRENT USER category, do not work. They end up being output as Array or the token itself (ie [current-user:last-name]).

Lastly this token crashed the entire page Main profile profile [current-user:profile-main]. I get the following error message. Fatal error: Call to a member function label() on a non-object in C:\xampp\htdocs\drupal7\sites\all\modules\entity\entity.module on line 843

Comments

dave reid’s picture

Status: Active » Postponed (maintainer needs more info)

Do you have other modules like Profile2 enabled? I just tested this with core profile module tokens and they worked correctly for me. I'm guessing that other module is also trying to provide profile tokens, causing an array merge when both modules provide the same token.

bryancasler’s picture

I do have the profile 2 module enabled, but I have not added any fields with it. I did however add the "Main Profile" profile type, but other than that I haven't done anything with the module. http://awesomescreenshot.com/058fafw84

dave reid’s picture

Well your problem with [current-user:profile-main] token needs to be an issue filed with profile2.module, since that is the code responsible for that token.

Maybe try disabling profile2 for a bit to check if your native profile field tokens will work or not?

bryancasler’s picture

I made a mistake in my original post, I said that the CURRENT USER tokens were working, they in fact were not.
http://awesomescreenshot.com/04bfb4l45

I just uninstalled the profile 2 module and did some re-testing of the fields. I got the same results as before, except the token that was throwing the fatal error no longer exist.
http://awesomescreenshot.com/05cfb4r0f

I'm also getting one of these notices for every token used.

Notice: Array to string conversion in token_replace() (line 97 of C:\xampp\htdocs\sandboxsiteD6toD7take2\includes\token.inc).
TimelessDomain’s picture

i got this error Notice: Array to string conversion in token_replace() (line 97 of C:\xampp\htdocs\sandboxsiteD6toD7take2\includes\token.inc). after creating menu items with Token Menu w/ the current User ID token (note i applied the patch here #691078: Field tokens ).
- just thought it would be worth mentioning here since a search of that error does not appear anywhere else.

dave reid’s picture

I'm unable to duplicate the issues with just a fresh install of core + Token + Token filter. It's likely another module responsible for causing this.

dave reid’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)