Unable to edit the node meta tags unless the user has permission "administer nodes"

ocliff77 - September 26, 2009 - 22:16
Project:Nodewords
Version:6.x-1.3-beta5
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:fixed
Description

I enabled the Nodewords module and configured it in Home -> Administer -> Content management, as well as setting the permissions for the meta tags.

When I am logged in as with administrator permissions, or have the "administer nodes" permission set, I can set/edit the meta tags. If it's only the permissions to edit XYZ meta tag, then I never see the form for editing meta tags.

From the documentation/discussions, i think it should be possible to edit the meta tags for a non-admin user if they have permission for that specific meta tag.

#1

kiamlaluno - September 26, 2009 - 23:01
Status:active» postponed (maintainer needs more info)

From the documentation/discussions, i think it should be possible to edit the meta tags for a non-admin user if they have permission for that specific meta tag.

That is true for the meta tags associated to nodes, or user profiles; if you want to change the default meta tags value, or the meta tags associated with the error 403 page, the error 404 page, the front page, the tracker page, or other custom pages then you need an administration permission.

Did I understand what you are saying, or did I miss anything?

#2

ocliff77 - September 27, 2009 - 07:04

It is only when I log in as administrator, or as a user who has "administer nodes" permissions, that I can edit the metatags.

- If I log in as administrator, I have full access to the settings for metatags and the form is displayed when I create/edit content.

- If I log in as a user with "administer nodes" permission, then I have access to the metatags form when I create/edit content.

- If I log in as a user with permissions to "edit XYZ meta tag" (without "administer nodes" permission), then there is no form for metatags when I create/edit content.

I've tested this with a couple of configurations and a lot of permission settings. The only thing that changes the metatags behavior on my site is toggling the "administer nodes" permission. It's either all or nothing for now.

#3

kiamlaluno - September 27, 2009 - 08:28
Title:Unable to set/edit meta tags unless the user has "administer nodes" permissions.» Unable to set/edit meta tags unless the user has "administer nodes" permissions

To which meta tags are you referring?

#4

ocliff77 - September 27, 2009 - 14:40

Currently I'm trying to get the basic meta tags working, such as: keywords, description, copyright

I also tried giving the user permission to "administer nodewords" which then allows the user to edit the Nodewords settings.

I tried as well to give the user full permissions to everything except "administer nodes". The conclusion is that the only thing that makes a difference is toggling the "administer nodes" permission:

- When it's on, I can edit the meta tags for a node.
- When it's off, I can not edit the meta tags for a node.

#5

kiamlaluno - September 27, 2009 - 17:24
Status:postponed (maintainer needs more info)» active

- When it's on, I can edit the meta tags for a node.

Then you are referring to the node meta tags. That is all I wanted to know; thanks for the clarification.

#6

kiamlaluno - September 27, 2009 - 17:41
Title:Unable to set/edit meta tags unless the user has "administer nodes" permissions» Unable to edit the node meta tags unless the user has permission "administer nodes"
Version:6.x-1.2» 6.x-1.x-dev
Component:User interface» Code
Status:active» fixed

The code was supposed to allow a user with permission to administer nodes to edit the node meta tags.

The code has been changed, and committed in CVS.
Thanks for your report.

#7

STINGER_LP - September 30, 2009 - 23:41

So, I don't get it... The issue marked "fixed" but i don't see how it fixed? I have the same problem and i don't want to grant my newsmakers the "administer nodes" permission... but i want them to fill the meta tags.

Using In v1.0 this could be done without granting "administer nodes" permission, what know?

UPD: OK, i manually searched trough the CVS repository and here is a patch for this issue (posting here so others don't have to search):

<?php
-// $Id: nodewords.module,v 1.57.2.159 2009/09/27 14:39:12 kiam Exp $
+// $Id: nodewords.module,v 1.57.2.160 2009/09/27 16:51:00 kiam Exp $

/**
  * @file
@@ -583,14 +583,12 @@
       }
     }

-    if (!$options['page:administrative'] && ((!empty($options['page:permissions:additional']) && !user_access($options['page:permissions:additional'])) || (!empty($info['widget:permission']) && !user_access($info['widget:permission'])))) {
-      continue;
-    }
+    if ($options['page:administrative'] || ((!empty($options['page:permissions:additional']) && user_access($options['page:permissions:additional'])) || (!empty($info['widget:permission']) && !user_access($info['widget:permission'])))) {
+      if (function_exists($function = $info['tag:function:prefix'] . '_form')) {
+        $tag_options['parameters'] = !empty($info['tag:function:parameters']) ? $info['tag:function:parameters'] : array();

-    if (function_exists($function = $info['tag:function:prefix'] . '_form')) {
-      $tag_options['parameters'] = !empty($info['tag:function:parameters']) ? $info['tag:function:parameters'] : array();
-
-      $function($form, isset($tags[$name]) ? $tags[$name] : array(), $tag_options);
+        $function($form, isset($tags[$name]) ? $tags[$name] : array(), $tag_options);
+      }
     }
   }

Thanks for fixing it!

#8

kiamlaluno - October 6, 2009 - 19:54

I have marked #597420: Only admin can see fields for editing as duplicate of this report.

#9

wwwoliondorcom - October 7, 2009 - 11:21

Hi,

I also updated to the latest version and even logged as admin i cannot edit any metatag, what happens ?

When clicking any tab of the module configuration I see:
"No meta tags have been enabled for editing; enable them on the settings page."

When I go on the settings page there is nothing under "Tags to show on edit forms" and "Tags to output in HTML" ?!

What should I do ?

Thanks.

#10

abrar.ars - October 7, 2009 - 14:05

hi, i had the same problem. What i found is just a typing mistake in .module file that is

In nodewords_form_alter function()

<?php


if (variable_get('nodewords_edit_metatags' . $form['type']['#value'],TRUE)) 
// change to 
if (variable_get('nodewords_edit_metatags_' . $form['type']['#value'],TRUE))
// needs a underscore at the end of nodewords_edit_metatags

?>

And it worked for me.

No need to give administer nodewords permissions to users, just allow tags permission for example this
'edit description meta tag' for authenticated user and then that particular user would be able to see tag fields.

#11

wwwoliondorcom - October 7, 2009 - 19:51

Hi,

I made the change and added underscore but still have the same problem and nodes do not have any metatags.

Thanks for help.

#12

abrar.ars - October 7, 2009 - 20:34

hmm, im going to tell you the steps that i followed in order to show the metatags in particular nodes without giving administrator permissions to the user.

on admin/user/permissions in nodewords module give permissions for edit description meta tag and edit keywords meta tag since these are the most important tags.

on admin/content/node-type/your-content find nodewords settings and mark the checkbox saying 'Allow editing of meta tags'. This checkbox was not working for me then i made the above change and it worked.

so give it one more try

#13

wwwoliondorcom - October 7, 2009 - 22:12

Sorry, it seems that my problem was that I didn't enabled the new modules when updating, so I needed to check the box in front of :

Basic meta tags
Extra meta tags
Site verification

Because with the former Nodewords module there was only Nodewords to enable.

I will report in case of other problems.

Thank you again.

#14

kiamlaluno - October 8, 2009 - 21:22

#15

mdigiacomo - October 10, 2009 - 13:13

I have installed Nodewords 6.x-1.2

Enabled Nodewords, Basic meta tags, & Extra meta tags
Given myself permissions to administer nodewords

As per [abrar.ars - October 7, 2009 - 10:05] I have performed the edit to

if (variable_get('nodewords_edit_metatags_' . $form['type']['#value'],TRUE))
// needs a underscore at the end of nodewords_edit_metatags

Yes, I still have the same problem and none of the nodes have any metatags.

In addition, in Administer › Content management > Nodewords where it says:

Tags to show on edit forms
Select the meta tags you want to be able to edit on the edit page of nodes, terms and vocabularies.

...there is nothing written

Any thoughts? Thanks

#16

kiamlaluno - October 10, 2009 - 16:44

I have marked #600226: Node meta tags disappeared as duplicate of this report.

#17

kiamlaluno - October 10, 2009 - 16:46

I have marked #599540: Nodewords from all nodes has disappeared as duplicate of this report.

#18

AndreyN - October 11, 2009 - 07:30

I have this problem too.
Install Nodewords 6.x-1.2, 6.x-1.1.
Change nodewords_edit_metatags to nodewords_edit_metatags_
No effect. List of tags is empty for user #1.

#19

mortendk - October 12, 2009 - 20:55

subscribing having the same problem
kinda looks as it "just dosnt work" (iknow thats a sucky report)

so how come its set to fixed?

#20

mortendk - October 12, 2009 - 21:26

got the fix ;)
figured out that a good cleaning of the cache did wonders *doh*

#21

lost305 - October 13, 2009 - 13:53

So far I don't see why my original post was forwarded here so I'm going to state my problem.

All my past nodes before this update aren't showing their keywords or desciptions.
I've gone into the admin/content/nodewords settings and activated for the types of nodes I want.

When I VIEW SOURCE there's no meta tags of descriptions or keywords for the OLD nodes but there are descriptions and keywords for the NEW nodes.

Basically all my past nodes aren't showing the old meta tag data.

I'm just hoping it's a code problem that isn't looking at the meta tables in the database.

If not.. I really screwed the pooch on this one.

Please help. This is extremely important.

Thank you for your time.

#22

nonsie - October 13, 2009 - 18:10
Status:fixed» needs work

I believe there's a typo in the committed fix, instead of

if ($options['page:administrative'] || ((!empty($options['page:permissions:additional']) && user_access($options['page:permissions:additional'])) || (!empty($info['widget:permission']) && !user_access($info['widget:permission'])))) {

it should be
if ($options['page:administrative'] || ((!empty($options['page:permissions:additional']) && user_access($options['page:permissions:additional'])) || (!empty($info['widget:permission']) && user_access($info['widget:permission'])))) {

eg. if $info['widget:permission'] is set and user has $info['widget:permission'] permissions user should be able to see nodewords form fields.

#23

kiamlaluno - October 13, 2009 - 19:06
Status:needs work» fixed

I fixed the code as reported by nonsie, and I removed one useless couple of parentheses.

The committed code change the reported IF-statement in

<?php
    $bool
= (
     
$options['page:administrative'] ||
      (
        !empty(
$options['page:permissions:additional']) &&
       
user_access($options['page:permissions:additional'])
      ) ||
      (
        !empty(
$info['widget:permission']) &&
       
user_access($info['widget:permission'])
      )
    );

    if (
$bool) {
?>

If I would have written it this way, I would have noted before the code was wrong.

Thanks to nonsie for the help in resolving the issue.

#24

danoguru - October 14, 2009 - 09:25
Version:6.x-1.x-dev» 6.x-1.2
Status:fixed» active

I dont think this issue ist fixed!

I have upgraded nodewords from 1.1 to 1.2 and now I can not edit meta tags. Not as user1 or any other user. Also the previously inserted meta-tags are no longer inserted to head.

I noticed that there are some changes in the configuration page, but I have checked all preferences a few times and all seems to be set up correctly. (for each content type meta-tags are selected - but I can not edit nor view the old meta tags)

please let me know what the upgrade issue might be, or how can I downgrade to previous version.

thanx a lot in advance!

#25

kiamlaluno - October 14, 2009 - 09:30
Version:6.x-1.2» 6.x-1.x-dev
Status:active» fixed

@danoguru: See the referring version; an official release cannot be changed, if not creating another official release, which is created from the development snapshot.

#26

capellic - October 14, 2009 - 19:44

Clear your cache and be sure all the nodeword modules are still enabled.

#27

capellic - October 14, 2009 - 21:09

I don't see what this if statement (nodeworks.module:665) is meant to achieve anway. If the condition is true, continue? It's going to continue anyway.

I applied the code in #23 just to see what it would do and the meta fields disappear in the edit form even for roles that have "administer nodes" -- so I don't know what's going on here. I would upgrade to dev, but there's a rather ominous warning on the project page.

#28

danoguru - October 14, 2009 - 21:57

ok, I checked the modules and found out that i had to enable new module "Basic meta tags"... I dont understand why the module was not enabled automaticaly on module update!! Now all my meta-tags are back :)

#29

lost305 - October 15, 2009 - 14:17

I have all modules enabled.
I have all settings checked.
I'm able to write NEW meta tags.

But all my old meta tags aren't showing.
Only new ones posted after upgrade show.

[Edited by KiamLaLuno to remove all the header tags]

#30

Mark0s81 - October 16, 2009 - 11:08
Version:6.x-1.x-dev» 6.x-1.2

Hi,

I've the same problem.
I don't view fields to insert metatags.

#31

kiamlaluno - October 16, 2009 - 14:29
Version:6.x-1.2» 6.x-1.x-dev

See the referring version. An official release cannot be changed if not creating a new official release, whose code is created from the development snapshot.

#32

Mark0s81 - October 17, 2009 - 12:56

so how can we solve this problem?
Have we to wait a new stable version?

thanks ;)

#33

m@rtijn - October 20, 2009 - 09:51

Subscribing. Exactly the same problems. I need to give the user "administer nodes" rights in order for him to edit the meta tags.

#34

capellic - October 20, 2009 - 17:17

#31:

See the referring version. An official release cannot be changed if not creating a new official release, whose code is created from the development snapshot.

I'm pretty sure he is saying that the fix is in the DEV version. I had tried the DEV version, but ran into a nasty bug that seems to have been fixed (#604160: Call to undefined function drupal_get_install_files() in nodewords.module line 1084) as of yesterday and there is a new DEV version today. I'm going to give it another go.

#35

kiamlaluno - October 20, 2009 - 17:29

I'm pretty sure he is saying that the fix is in the DEV version.

Yes; that is what I meant. That is also the reason the referring version (field Version of the fieldset Edit issue settings) is set to 6.x-1.x.

#36

capellic - October 20, 2009 - 20:18

I just noticed an alpha version is available -- thanks for addressing these issues. Checking it out now. Works great!!!

#37

urwen - October 26, 2009 - 18:37

not working for me, even for dev version and all the "new" modules activated :-(

#38

urwen - October 26, 2009 - 18:44

i was using 6.x-1.0 version

#39

ailgm - November 5, 2009 - 20:07
Status:fixed» active

I am now experiencing this problem with 6.x-1.3-beta5, on forum topics but not a custom content type.

I have 3 nodeword modules enabled: Nodewords, Basic & Extra

I've checked and the option "Allow editing of meta tags" is properly set on each content type.

I've also cleared the cache.

Is anyone else experiencing this? Any suggestions?

#40

slybud - November 9, 2009 - 14:38

Ok seems that this issue is a very long one.
I personnally experienced several issues upgrading to the 6.x-1.1 version (all my settings were lost due to the change of the module structure with its submodules). Resolved this one by de-activating the module, running update.php, re-activating the module and the needed submodules, and run update.php again.
Many people are complaining about that in this issue, although it's not the same original issue.

I'm using 6.x1-2 on my site, didn't test dev version and 1.3-betax

For the original issue, I've found in the module code that one can not edit meta tags fields like "description" or "keywords" if one does not have the "administer nodes" permission, even if :
* nodewords settings are properly configured, modules activated for the desired meta-tags
* the relative checkbox has been checked in the content type edit page
* the user has been given the right "edit xxx tags" in the permissions settings

This is by design (at least in the code), in the form_later function invoked for the node editing forms, line 77 in nodewords.module :


$form['nodewords'] = nodewords_form(
        'node',
        $tags,
        array(
           'page:permissions:additional' => 'administer nodes',
        )
      );

Later on in the code, there is an escaping point ("continue;") from the main iteration in the nodewords_form() function which doesn't make the generation of the form nodewords elements, if you don't have "administer nodes" permission (line 665) :

if (!$options['page:administrative'] && ((!empty($options['page:permissions:additional']) && !user_access($options['page:permissions:additional'])) || (!empty($info['widget:permission']) && !user_access($info['widget:permission'])))) {
      continue;
    }

I've written a small patch (maybe the smallest drupal patch :)) which works fine for me, and is attached to this post.
Once again, I don't know if it's a real issue or if it's by design, so I'm not sure of my status change.

This can be improved within the module's roadmap, which I'm not very aware of.

Best regards

AttachmentSize
1-edit_meta_tags_even_if_no_administer_node_permission.patch 446 bytes

#41

slybud - November 9, 2009 - 14:38
Status:active» needs review

#42

kiamlaluno - November 9, 2009 - 14:43
Status:needs review» fixed

The code has been already changed in the development snapshot.

<?php
    $bool
= (
      (
        !empty(
$options['page:permissions:additional']) &&
       
user_access($options['page:permissions:additional'])
      ) ||
      (
        !empty(
$info['widget:permission']) &&
       
user_access($info['widget:permission'])
      )
    );

    if (
$bool) {
      if (
function_exists($function = $info['tag:function:prefix'] . '_form')) {
       
$tag_options['parameters'] = !empty($info['tag:function:parameters']) ? $info['tag:function:parameters'] : array();

       
$function($form, isset($tags[$name]) ? $tags[$name] : array(), $tag_options);
      }
    }
  }
?>

#43

slybud - November 9, 2009 - 14:55

ok thanks for the update , will it be changed in the next 6.x-1.3 stable release ?

#44

kiamlaluno - November 9, 2009 - 15:00

will it be changed in the next 6.x-1.3 stable release ?

It is already included in the last official releases.

#45

ailgm - November 9, 2009 - 15:54

As I said, I'm using 6.x-1.3beta5, so the latest release which has the change KiamLaLuno refers to.

slybud - Thanks, I tried your patch and the disable/update/enable/update/check process, but still no luck, so I'm still stuck with experiencing the problem.

#46

kiamlaluno - November 9, 2009 - 18:12
Status:fixed» active

I am restoring the status as set by ailgm.

#47

pmlodzik - November 13, 2009 - 13:10
Version:6.x-1.x-dev» 6.x-1.3-beta5

We also experienced this problem. We received a notification of a security update for this module and installed the recommended version, 6.x-1.2 (2009-Sep-23), which broke meta tags for everyone except administrators. We also tried 6.x-1.3-beta5 (2009-Oct-30) on a test server and experienced the same problem. Permissions and configuration settings were set correctly.

#48

ilo - November 26, 2009 - 01:17

Just to confirm..

I've used latest CVS version for 6.x-1.x-dev, and performed the following steps:
- Login as an user with permissions: "administer content types" and "administer meta tags".
- Go to edit "Page" content type, and mark the checkbox "Allow editing of meta tags". (This step is optional, I've verified later).
- Go to Administer nodewords, "Meta tags to show on edit forms" (at admin/settings/metatags) and enable: "Keywords", "Copyright", and "Description" checkboxes.
- Logout this user.
- Login as an user with permissions to 'create page content', 'edit meta tag DESCRIPTION', and 'edit meta tag COPYRIGHT'.
- Go to add page content: node/add/page and found: Description and Copyright fields are there, keywords field is not there.

Works perfect I'd say. I've also verified this works in 6.x-1.3-Beta5. I'd mark as fixed once for all, but would like to hear KiamLaLuno's opinion first.

I've attached the test file to keep a check on this in the future..

AttachmentSize
nodewords.test 2.61 KB

#49

kiamlaluno - November 26, 2009 - 03:18
Status:active» fixed

Thanks for your confirmation, ilo. I am changing the status of this report to fixed.

The test file you attached will be part of the next commit I will do in the next 24 - 36 hours.
Maybe I will add some more test to the test file you provided (thanks again for your help, ilo). I was thinking to add some tests for some functions that are important for the module to work.

#50

ilo - November 26, 2009 - 10:25

Thanks to you for all the good job.

 
 

Drupal is a registered trademark of Dries Buytaert.