this one has been bugging me for ages, and seemed crazy to have a 'view' link in the profile section when the full content was already being viewed. i could css display none on the tab, but instead felt it would be better to remove the link itself unless the display was set to teaser.
one line edit - is it worthy of a patch?
content_profile_theme.inc:
function content_profile_preprocess_content_profile_display_view(&$variables) {...
change
if ($element['#edit_link'] || $element['#style'] == 'teaser') {
to:
if ($element['#style'] == 'teaser') {
-----
and as a separate aside:
function theme_content_profile_display_tab_view($node) {
return l(t('View Profile'), 'node/'. $node->nid);
}
I think 'View Profile' makes more sense than just 'view'.
ideally, i'd like to see this as a local task, (i think the edit should be in the actual content for the node author), but already an issue, and that's all for now.
Comments
Comment #1
George2 commentedi think it's also best to mention here to check that the tabs array exists in the tpl.php file. technically as you check to see if the tabs array exists before assigning to teh template vars, the template should also check before adding the markup.
so content_profile-display-view.tpl.php wrapping a simple php if ($tabs) check:
EDIT: and just realised this wouldn't work, as there's a bug that theme.inc always adds the edit tab, whether the user has permission to edit or not. so let's add the user_access check to only add the tab if the user has the permission to edit the content type
c_p.theme.inc
Comment #2
poundy commentedThis is exactly what I have been looking for, but when I add the syntax nothing happens. I have checked all permissions, and still nothing. Maybe I am placing the code in the wrong area or something. could you let me know if I replace lines of code or add to the file, and if so where do I do this in the file. I am working with Zen Starterkit 6.x-1.0-beta3 template.php and of course c_p.theme.inc
Comment #3
jgraham commentedI've merged in something similar. This is more inline with standard drupal behavior of the "read more" link showing up rather than having tabs within page content.
The call to node_view needed adjustment as it was the "read more" link would not be rendered.
Comment #5
chuckienorton commentedDang... I'm having problems implementing this... any word here? I HATE seeing "VIEW" with the weird border and everything, when the full content is right there.
did anyone else get it to work?
Chuck
[edited] - got it to work! It was my fault (prob w/ ftp not really editing)... worked just like posted above. Thanks!!
Comment #6
osopolarAnother solution to remove the view link is to write your own preprocess_content_profile_display_view function and place the following code in your template.php file:
Copy the template file content_profile-display-view.tpl.php to your theme folder and change $tabs to $profile_tabs.
Comment #7
melchoir55 commentedAs I understand the solution in OP to work, this is a hack of the core module. Isn't this dangerous in the event of an update?
The solution given in 6 works great. I'm not sure why you need to change those variable in the tpl-php though...