I've been following the issue #822952: "Edit meta tags" permission for each content type which currently 'needs work'. As a temporary solution I've created a module to hide the meta tags form as follows:

For the user page:

function MY_MODULE_form_user_profile_form_alter(&$form, &$form_state)
{
    unset($form['nodewords']);
}

And for content types:

function MY_MODULE_form_alter(&$form, $form_state, $form_id)
{
    if (isset($form['type']) && $form['type']['#value'] == 'banner') {
       unset($form['nodewords']);
    }
}

The above hides the form successfully for the user edit pages but I can't get this to work on the 'content type' edit pages. Any idea what I'm doing wrong?

Thanks.

Comments

Dave Reid’s picture

You are aware that using the latest 6.x-1.x-dev code that a user has to have the 'administer meta tags' or 'edit meta tags' permission in order to even see the fieldsets right? That should take care of this - you can ignore the form otherwise.

sittard’s picture

Perhaps I should have been a bit clearer. I only added the user hook to illustrate the fact that the hook_form alter worked on the user pages and not on the node edit form.

Thanks for your help.

Dave Reid’s picture

Status: Active » Postponed (maintainer needs more info)

Make sure your module's weight is set to run after nodewords, which has a default weight of 0. That may be why you're not able to unset the nodewords fieldset, as it hasn't been added yet.

sittard’s picture

Good suggestion, changed the module weight to '10' and cleared all caches but still no effect. I can alter the appearance of other forms with my custom module but just not nodewords.

quicksketch’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

I know this question was never answered, but after months and months of no activity, I'm closing it. Generally support on how to write custom code isn't really a question suitable for module issue queues.