I have a number of custom meta-tag settings configured for particular pages which I set up via admin/content/nodewords/meta-tags/custom

I am able to configure the meta tag values and they're saved to the database, and unlike in the 6.x-1.11 version, are also loaded in the form when I go to edit them.

However, they are not rendered on the specified pages - instead the default meta tag settings are used. I tracked this down to a small bug in nodewords_preprocess_page() which checks if the type is NODEWORDS_TYPE_NODE (it's not) OR if the user has access to view a node with the id of $options['id']. It fails the first check but passes the second, which means that the code is never able to continue on to the final conditional to load in the custom pages settings.

The type is NODEWORDS_TYPE_PAGE which means the $options['id'] is actually the id of the custom page configuration set, and not a node id. Really the conditional should be using an AND and if the user doesn't have access to the node. At least that's my understanding of it.

Attached patch fixes this.

CommentFileSizeAuthor
custom_meta_tags.patch723 bytesstella

Comments

daniel bornman’s picture

Just found the same issue after installing nodewords-6.x-1.x-dev and can confirm that patch fixes it.

In my case I have meta tags saved for a node so $options['type'] is equal to NODEWORDS_TYPE_NODE, meaning this line:
elseif ($options['type'] == NODEWORDS_TYPE_NODE || node_access('view', node_load($options['id']))) {
will always equate to TRUE regardless of the node_access() call and set $tags to an empty array instead of loading my tags.

psililisp’s picture

I didn't try the patch, but I can confirm changing line 543 in nodewords.module:
elseif ($options['type'] == NODEWORDS_TYPE_NODE || node_access('view', node_load($options['id']))) {
to:
elseif ($options['type'] == NODEWORDS_TYPE_NODE && !node_access('view', node_load($options['id']))) {
fixed my issue with meta tags not showing up for those set on a per-node basis. It also seemed to fix the issue described by stella for custom pages. Thanks stella!

Kylie Morgan’s picture

Version: 6.x-1.x-dev » 6.x-1.11
Priority: Normal » Major
Status: Needs review » Active

Same issue when creating custom meta-tags for views. Descriptions and keywords resetting to null upon save. No error, and nothing strange in the log:

Details
Type	nodewords
Date	Thursday, October 27, 2011 - 14:54
User	Kylie*********
Location	https://********.com/admin/content/nodewords/meta-tags/other/edit/1
Referrer	https://*********.com/admin/content/nodewords/meta-tags/other/edit/1
Message	User Kylie********* changed the meta tags for type 10 (1).
Severity	notice
Hostname	xx.xx.xxx.xxx
Operations	

NOTE: The URLs and the Title do NOT disappear upon saving custom page meta tags.

amir simantov’s picture

Fix did not fix it for me :(

I have folloed psililisp's (#2) instrcutions and still no meta description for node items. Meta description for custom pages works fine.

Might the fix fixed only meta tags and not the description as well?

Thanks for you help!

Amir

borfast’s picture

Version: 6.x-1.11 » 6.x-1.x-dev
Status: Active » Reviewed & tested by the community

I can also confirm that the change fixes the problem.

markusa’s picture

confirming this patch worked for me....I had downloaded the 1.x-dev oct 30 release and had to apply this patch for the custom page meta tags to appear in page source

damienmckenna’s picture

Status: Reviewed & tested by the community » Fixed

Thanks Stella for the patch and everyone for testing it, this has been committed.

borfast’s picture

Thanks for committing it!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.