By geert on
Hello,
For my site, I created a custom content type as a node. I now need to find a way to remove the name of the creator when this node is displayed. Can someone point me in the right direction?
Thx
Geert
Hello,
For my site, I created a custom content type as a node. I now need to find a way to remove the name of the creator when this node is displayed. Can someone point me in the right direction?
Thx
Geert
Comments
Removing Author
Geert,
In D7 Logged in as admin
Removing author role based
Excellent!
How could I do this role based?
One way I see is to make a view for the roles that are allowed to see it. I can than display that info as a field in the view. But I would also like them to see the author if they click on the content and go to the actual node. Next to that, I would need a view for those that can not see it. I prefer not to maintain 2 views.
Is this possible via config without creating 2 views?
Geert
Two other line of attacks?
The first thing that comes to mind is that you could do this at the theme level or via a custom module.
At the theme level you can look at the preprocess variable (template.php) where you could load the $user object (
<?php global $user; ?>), check for the role then change the$submittedvariable as you see fit.Conversely another route would be to make a custom module that hooks into hook_view() or a downstream hook such as hook_node_view_alter(). I suspect you could alter the node object (when being viewed) dependent on the user role so as to control whether authorship is displayed.
The advantage with the second method is it will still work if you swap themes.
So, I would need to wride a
So, I would need to wride a noauthor.module that implements a noauthor.view. In this part, I should write code that takes teh user object and looks for a role. If that role is not presetn, I remove the author field.
I could use some more help with the code.
cheers
CCK & Rules
You could also disable post information display (core admin), on node save populate a CCK field with token [node:author-uid] (the Rules module allows you to do that) and restrict the CCK field to selected roles (via Content Permissions, part of CCK). Any view will automatically honor those restrictions. Having already the required modules and no programming skill, that's what I ended up doing for a similar need.