Tab not visible for User Content Type
myudkowsky - January 29, 2009 - 17:10
| Project: | Integrated Metatags |
| Version: | 5.x-1.0-beta7 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I've properly installed and enabled Integrated Metatags. The standard content types -- page, story, blog -- when edited all show a tab "Metatags." I can enable static and dynamic inherited tags, which work as expected.
However, a content type that I created called "wine_review" does not show the Metatags tab. As such, this content type -- the one that needs tags most of all -- cannot accept metatags.
There's on possible further symptom: the front page has no meta-tags. I can't figure out why that would be the case -- or how to enable them for the front page, assuming that's a separate issue.
My content types as listed are blog, book, story, page, wine_review.

#1
How did you create the node, through CCK or through Drupal's built-in hooks?
Is your front page a single node or a listing of nodes (using a node_view(); sort of call)? The D5 version doesn't support Metatags with node listings.
#2
I am not entirely certain what your question is. I'm deep enough into Drupal to cautiously modify node templates and even tweak a module, but not entirely certain of other portions.
I have CCK enabled. The wine_review content type was created through the standard interface, has some CCK in it, and it's rendered by a customized Zen theme via a customized template node-wine_review.tpl.php. In other words, all standard stuff that affects the body and not the headers AFAICT.
Before I originally submitted this issue I ran a test to create a completely new content type "foo" to see if it was all user content that couldn't see Metatags or just old user content types. I used the Content Type page's "Add" tab, gave the new content type a name, and hit save. During the creation of the new process could see the "Metatags" tab — but clicking on it led me to the global settings of of Metatags.
After I created the new content type "foo," which was a simple page with no name and no CCK fields selected, I attempted to edit it to enable metatags. The "Metatags" tab was not visible.
As for the front page, the sidebar is a View of recent wine_reviews and the center is mostly blog entries with a static page as the first entry. http://www.KosherWineReview.com if you want to see what I mean.
Does this answer your questions? If not let me know and I'll answer ASAP.
By the way, thanks for your quick response. I apologize for my slow response; I was out of the office when it arrived.
#3
Lets verify some things. First:
1) Just to make sure, CCK is enabled, yes? What version of CCK + Drupal are you using?
2) What is the URL when you edit the "foo" type? The Metatags tab should show up under admin/content/types//metatags.
3) What is your front page set to (look under Admin > Site configuration > Site information, and look for the "Default front page" option)? If it's not set to "node/", Metatags won't show up in Drupal 5.
Changing to a support request until we can figure out where the exact problem is with this.
#4
Answers:
1. CCK is enabled, version 5.x-1.10. I've also installed AHAH Forms 5.x-1.5-5 and enabled it and Dynamic Subforms (the latter just in case). Drupal version 5.14, MySQL database 5.0.75, PHP 5.2.6-3.
2. (a) I create a "foo" content from admin/content/types by clicking on "Add content type" tab, which brings me to admin/content/types/add.
If I click on the Metatags on *on that page*, admin/content/types/add, I end up at admin/content/types/%252Fmetatags. I admit that I can't suggest how the URL gets that mangled.
On admin/content/types/add, in the body of the page as I define the new content type, there is no mention of Metatags (e.g., enabling by default, which I expected to see).
If I create the "foo" content type, there is no Metatags tab when I edit that content type again. E.g., admin/content/types/foo-test has no Metatags tab.
I tried entering admin/content/types/foo-test/metatags by tying in the URL directly to the browser, but this just gives me (surprisingly) the same page as admin/content/types/foo-test. I'd expected either success or a 404.
(b) There is a page admin/content/int_meta to admin the Metatags module.
3. The front page is set to type "node." (Thanks for reminding me of where that's set.)
Note that it's set to "node" and not "node/" as per your question -- is that a possible problem? The help text for that setting says to use "node" and makes no mention of an ending slash, and some systems are sensitive about trailing slashes.
Please note that I'm using clean URLs and Pathauto 5.x-2.3, and I have two URL .htaccess rules that re-write a set of legacy pre-Drupal URLs to new Drupal URLs. They're both comfortably outside the scope admin/*.
Thanks for your response. Please let me know if you need further information. (I will be offline starting Friday, 1500 CST, until Sat evening 1800 CST.)
#5
I'm still really perplexed at why you're not getting the tab. The code is just checking that your path looks like "admin/content/types", and then it'll add the Metatags tab. You have the "administer integrated metatags" permission I believe, otherwise you'd not see the other forms.
The Metatags tab showing up on the add content type page was a bug, and has been fixed for the official release.
Finally, if your front page is set to "node", that's a listing page, not a full-page view of a node (e.g. node/1234). The feature to display Metatags on listing pages is, unfortunately, only available in Drupal 6.
#6
I'm using Drupal 5 because a different module wasn't ready for 6 when I created this site last month.
You said that "The Metatags tab showing up on the add content type page was a bug, and has been fixed for the official release." Integrated Metatags 5.x-1.0-beta7 is listed as "official" on the download page; is there some other release, or do you mean that it'll be fixed when Metatags reaches RC-1?
#7
Yes, the bug fix is on an internal build of the project, and will be part of my official release (BETA7 is essentially an RC).
I was unable to reproduce "Metatags on listings" in Drupal 5 because of how their templating system is setup. In D6, I am able to use a hook to get all of the Metatags in as needed. Porting this feature to D5 is not something I plan on doing, but I could certainly provide documentation (at some point) on how to do it if people would like that. As it is, there are a lot more people using the D6 version than the D5 version of this module, so there's very low incentive for me to really try to get this working.
At this point in trying to resolve your original issue, I wonder if the
node_get_types();function call in theint_meta_menu();function is working properly. If you have uid 1 access, you could try printing something like after that function has been called in the menu hook:<?phpglobal $user;
if ($user->uid == 1) {
print_r($type);
}
?>
Let me know what that prints out, and you can delete the code. Another thought is whether you changed the module weights for any of your modules?
#8
Well, I wasn't quite clear where to put that snippet of code, so I ended up putting it inside int_meta.module (instead of a theme's theme-setting-init.php) mainly because I was able to figure out how to trigger the code.
if (arg(0) == 'admin' && arg(1) == 'content' && arg(2) == 'types' && !is_null(arg(3))) {
$type = node_get_types('type', arg(3));
$url_type = str_replace('_', '-', $type->type);
// test code
global $user;
if ($user->uid == 1) {
print_r($type);
}
if (!module_exists('content')) {
The output on admin/content/types/page is
stdClass Object ( [type] => page [name] => Page [module] => node [description] => If you want to add a static page, like a contact page or an about page, use a page. [help] => [has_title] => 1 [title_label] => Title [has_body] => 1 [body_label] => Body [min_word_count] => 0 [custom] => 1 [modified] => 1 [locked] => 0 [orig_type] => page )There is no debug output on a user-generate content page, e.g. wine_review. Is it remotely possible this has something to do with using "wine_review" instead of "wine-review" as the name?
As for your question about module weights: I modified just one, auto_nodetitle, which is set to a weight of 5 in order to make certain it has the correct CCK fields. I modified this weight through the "system" by direct db manipulation (not through a module).
#9
And the answer is "yes." I changed the name of the content type from "wine_review" to "winereview" and I get:
stdClass Object ( [type] => winereview [name] => Wine Review [module] => node [description] => Wine review including reviewer comments and facts about the wine. [help] => [has_title] => 1 [title_label] => Title [has_body] => 1 [body_label] => Body [min_word_count] => 0 [custom] => 1 [modified] => 1 [locked] => 0 [orig_type] => )and the Metatags tab.
Your use of the str_replace() looks correct to me. Certainly I have *my* work-around but I wonder what the problem is.
A little testing:
$type = node_get_types('type', arg(3));
// should return a list of all types.
$typeList=node_get_types('types');
print_r($typeList) ;
in the module will print a list of all types, including wine_review, which I quote in part:
[wine_review] => stdClass Object ( [type] => wine_review [name] => Wine Review [module] => node [description] => Wine review including reviewer comments and facts about the wine. [help] => [has_title] => 1 [title_label] => Title [has_body] => 1 [body_label] => Body [min_word_count] => 0 [custom] => 1 [modified] => 1 [locked] => 0 [orig_type] => )So the problem is in node_get_types() when applied to a content type with a "_" in the machine-readable name.
#10
Excellent! So, it's a problem with the URL's type having a - in it, and Drupal expecting a _ instead. For some reason, in URLs the types have their _ converted to a -. Simple fix, and I'll post an update to this issue when I have the code for you to update with.
Thanks for your help!
#11
Thank you for all your thorough and explicit help and especially your quick response! I will test the patch if you like when it's available. I will be offline soon and remain offline for the next 26 hours.
If you ever publish the documentation to upgrade the D5 version to work with , please let me know. I expect that I'll move to D6 in the next month, but if that doesn't happen I'd like to give the task a look.
#12
This fix works:
$arg3 = str_replace('-', '_', arg(3));$type = node_get_types('type', $arg3);
and then the Metatags tab shows up on pages that have the form foo_bar.
What I do notice is that if I change the content type's name from "winereview" to "wine_review," the Metatags associated with the type disappears. Somehow I didn't expect that, because renaming a content type doesn't cause any other content associated with that type to disappear.