MetaTag fields Description and Keywords not being saved...

I upgrade to the latest version available here , did not help.

This use to work and stopped working recently. The only thing I did was upgrade to the latest views module so I could run the votingapi module (their was a compatibility with the older Views module). Also the latest views module seems to require some other module upgrades see: http://drupal.org/project/cck

Could it also be the case for this great module ?

I will upgrade my cck module and see if that helps. If it does I will update this bug entry.

Thanks,
Chris

Comments

chrisd’s picture

Still same problem after upgrade all CCK modules....

Also disabled "Mea Tags" in modules and re-enabled it and ran update.php....did not fix anything.

Thanks,
Chris

chrisd’s picture

... another piece of data...

This problem happens with "Page" type nodes not just the CCK type nodes.

chrisd’s picture

Priority: Critical » Normal

More data:

When I add the follow code, it does not "exit" when I modify and save a node...this is probably why the values of these 2 fields do not get updated,

function nodewords_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
 if ($op !== 'load' && $op !== 'view' && $op !== 'alter')  exit($op.'<br>');

This problem is also happening with the "log message field" so it's probably not the fault of this module...

If I find the gulty module I will update this bug entry...

chrisd’s picture

Priority: Normal » Critical

It appears that the log message field not saving might be normal (just saved when you create a revision ?). So this is probalby a compatibily issue between "Meta Tags" and another none core module.

I have a Drupal 5.1 with Meta Tags saving fine on the same server. It's only got the addtional modules "GSiteMap" + "Meta Tags".

The one that does not work has the modules:
CCK (with options: CCK Field Permissions, Date , Image, Link)
Views
Search 404
Voting API + Fivestar

--- addtional data ------
On that Drupal that works (using Bluemarine) adding the following to the "function nodewords_nodeapi" function does halt the code:

case 'insert':
case 'update':
exit('here');

That same code does not get "hit" with the Drupal not saving meta tags (Garland).

Thanks,
Chris

Robrecht Jacques’s picture

Thanks for trying to figure this out.

I'll try with your list of module to see if I can find what is going on. The reason why it probably doesn't work is because some module adds a #submit-handler somewhere to the node-form which appears to disable calling the normal #submit-handler from node.module (which calls nodewords_nodeapi()).
So my bet is one of the CCK modules as the other module are not likely to change the node-edit-form.

Can you give me the exact versions? You can find those on the module administration page (if you use downloaded releases).

Thanks.

chrisd’s picture

---------CCK Modules--------
Content 5.x-1.5 (Fieldgroup 5.x-1.5, Number 5.x-1.5, Option Widgets 5.x-1.5, Text 5.x-1.5)

Date 5.x-1.5 (Date API 5.x-1.5)
CCK Field Permissions 5.x-1.10
Image 5.x-1.1
Link 5.x-1.5
-----------Views ------
Views 5.x-1.6-beta5
Views UI 5.x-1.6-beta5

-----Other--------
Meta tags 5.x-1.2
Google Sitemap 5.x-1.x-dev
Search 404 5.x-1.1

----Other Disabled for now -----
Fivestar 5.x-1.5
Voting API 5.x-1.x-dev

Here is a fuzzy chain of events (might help?):

All was working good for months.
About 10 days ago wanted to add the FiveStar Module.
So installed Voting API & FiveStar. This gave me an error about some ???_view_???? function undefined. So I upgrade the views module ( I was running Views 1.4-2rc1 ?). So this would point to the Views module but it would make more sense that it is a CCK type module ...?

Last night, I noticed that my meta tags were not saving anymore (and determined that my changes from the last few days had not been saved). So upgrade all more CCK module...

Thanks,
Chris

chrisd’s picture

Thanks for that information, was able to go a little further.

If I do a "dump" of module_implements('nodeapi') from node.tpl.php on my main page (a block showing popular nodes), I get (correct? results including nodewords):
content
fieldgroup
cck_field_perms
gsitemap
menu
path
statistics
taxonomy
upload
nodewords

Now the same "dump", when I click "edit" page I get:

content
fieldgroup
cck_field_perms
gsitemap
menu
path
statistics
taxonomy
upload

Not sure what this means but it looks like the results of module_implements() could explain why nodewords_nodeapi is not being called.

Very very weird ?

chrisd’s picture

To recap:
Adding to my node template:

<?php if (user_access('administer nodes')) {
   	$x = module_implements('nodeapi');
    print '<pre>'; print_r($x); print '</pre>';
	print module_hook('nodewords', 'nodeapi').'<br>';	
	}
?>

Outpputs on teaser:
Array
(
[0] => content
[1] => fieldgroup
[2] => cck_field_perms
[3] => fivestar
[4] => gsitemap
[5] => menu
[6] => path
[7] => statistics
[8] => taxonomy
[9] => upload
[10] => nodewords
)
1

Output on full node view:
Array
(
[0] => content
[1] => fieldgroup
[2] => cck_field_perms
[3] => fivestar
[4] => gsitemap
[5] => menu
[6] => path
[7] => statistics
[8] => taxonomy
[9] => upload
)
1

---- now if i write my own:

function xxx_module_implements($hook) { 
    $xxx_implementations[$hook] = array(); 
    $list = module_list(FALSE, TRUE, $sort); 
    foreach ($list as $module) { 
      if (module_hook($module, $hook)) { 
        $xxx_implementations[$hook][] = $module; 
      } 
    } 
  return (array)$xxx_implementations[$hook]; 
}   

and change the function call in the node template: $x = xxx_module_implements('nodeapi');
I do get the correct answer with both teaser and full view:
Array
(
[0] => content
[1] => fieldgroup
[2] => cck_field_perms
[3] => fivestar ( i just re-enable this module)
[4] => gsitemap
[5] => menu
[6] => path
[7] => statistics
[8] => taxonomy
[9] => upload
[10] => nodewords
)
1

This getting deep...
The module_implements() function has a comment that seems to describe this issue:
// The explicit cast forces a copy to be made. This is needed because
// $implementations[$hook] is only a reference to an element of
// $implementations and if there are nested foreaches (due to nested node
// API calls, for example), they would both manipulate the same array's
// references, which causes some modules' hooks not to be called.
// See also http://www.zend.com/zend/art/ref-count.php.

??? I'm starting to getting lost here.... ???

Thanks,
Chris

chrisd’s picture

Now if I add to the function: module_implements()

    foreach ($list as $module) {
	 if (user_access('administer nodes') && $hook == 'nodeapi' && $module == 'nodewords') print $module. '|'. $hook . '|'. module_hook($module, $hook) . '<br>'; // add the previous line		
      if (module_hook($module, $hook)) {  

I get on teaser view:
nodewords|nodeapi|1
and on full node view:
nodewords|nodeapi|

Now i'll look into the next level module_hook()....

chrisd’s picture

So it looks like the when called within module.inc when viewing a full node function_exists() reutrn Empty? (ie: Not True), nodewords|nodeapi||, but when called on a view with teasers it returns nodewords|nodeapi|1|

Here's the code change in module.inc:

function module_hook($module, $hook) {
	 if (user_access('administer nodes') && $hook == 'nodeapi' && $module == 'nodewords') print $module. '|'. $hook . '|'. function_exists($module .'_'. $hook) . '|<br>';		
  return function_exists($module .'_'. $hook);
}

But when module_hook is called in the node template it always shows the correct result: 1

So it looks like depending on when and where the function function_exists() is called the result are different for the Meta Tags module...

chrisd’s picture

I found the solution: Decrease the weight of the nodewords module in the system table from 10-> 0.

Thanks Robrecht for the pointer it helped a lot to get on the right tracks.

I will let this ticket open to a formal resolution can be implemented. Their might be a range for modules that "edit node" have to be in ? I'm not sure if this is a standard or should be one.

Cheers,
Chris

Robrecht Jacques’s picture

OK, this is very strange indeed!

I have enabled all your modules (same version too) and I don't get this behaviour if I create a page with a meta description and keywords. They are properly saved and shown.

Do you see this behaviour with any content type, or only ones with some cck fields? Can you post the definition of a cck content type if this is the case? (eg what is on admin/content/types/<your-content-type>/display).

The reason for changing the weight in the system table is so nodewords runs last (or more specifically, after section module and other modules that can change the theme). The weight is any integer between -10 and 10 and I am really surprised that the nodewords_nodeapi() function is not called anymore if this weight is 10.

I'll try to investigate this a bit more.

chrisd’s picture

This was happening with all node types, not just the CCK ones.

Don't know if this could be the cause but on the Views 5.x-1.1-beta-1 change log it this:

- 77859: update module weight to 10 in update.php -- RUN UPDATE.PHP!!

And CCK 5.1.1 had:

- 99713 Fixed field weights not playing correctly with 'non-cck' fields on node display

This could be because i've upgrade these modules a few times since Drupal 5.0.

apaderno’s picture

Status: Active » Closed (won't fix)

As the Drupal 5 version is not supported anymore, I am changing the status of this report.