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
Comment #1
dave reidDo 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.
Comment #2
bryancasler commentedI 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
Comment #3
dave reidWell 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?
Comment #4
bryancasler commentedI 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.
Comment #6
TimelessDomain commentedi 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.
Comment #7
dave reidI'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.
Comment #8
dave reid