Anonymous and named comments on my site show up with the author name and "not verified" next to them. I want to get rid of the "not verified" text.
I know this question has been asked a few times in the forums. Every instance has either been unanswered or suggests looking at a different node that has supposedly addressed this problem. Every instance of the answer has been for older builds of Drupal. I have looked at each of the suggested solutions but I still could not solve this problem. Either the answers discuss files I cannot find (it is no clear where some files reside in some references) or perhaps do not exist in Drupal 6.
The RealName module had no effect on the "not verified" notation showing up in my comments. This seemed a possible solution to me once I found it but I do not know why it has no effect on my comments.
I have been working on this problems for hours at a time, over two different days.
I am not a programmer but I am not afraid to change code if someone can provide a solution.
Can anyone provide a clear legible way to fix this? The best solution for me would be to know the name of the file to change or create, the directory where it is or should be located, and the code that needs to be changed or created.
I thank in advance anyone that can answer this question for me or is willing to try to help.
Dave
Comments
Fixed
I am obsessive so I could not leave this alone and wait for an answer. I had already pulled half my hair out, so why stop while I still had some left to lose : )
I found the file and the fix for this in Drupal 6.
The file is "theme.inc" and is found in the directory "includes"
This is a top level directory in the Drupal build.
As was mentioned elsewhere, this following part of the code needs to have the $output line that includes the 'not verified' text commented out. This was line 1582 of my file.
original:
else if ($object->name) {
// Sometimes modules display content composed by people who are
// not registered members of the site (e.g. mailing list or news
// aggregator modules). This clause enables modules to display
// the true author of the content.
if (!empty($object->homepage)) {
$output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
}
else {
$output = check_plain($object->name);
}
$output .= ' ('. t('not verified') .')';
}
else {
$output = variable_get('anonymous', t('Anonymous'));
}
and commenting out the proper line $output line:
else if ($object->name) {
// Sometimes modules display content composed by people who are
// not registered members of the site (e.g. mailing list or news
// aggregator modules). This clause enables modules to display
// the true author of the content.
if (!empty($object->homepage)) {
$output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
}
else {
$output = check_plain($object->name);
}
// $output .= ' ('. t('not verified') .')';
}
else {
$output = variable_get('anonymous', t('Anonymous'));
}
I made this change, uploaded it to my server, and all my 'not verified' text disappeared.
This is of course a fix that will need to be redone whenever Drupal is updated.
you mean theme_username? Is
you mean theme_username?
Is a themeable function, just copy it to your template.php file, rename it function MYTHEME_username and make your mods there, no need to hack core.
Responsive Drupal Themes | Drupal 8 Design Initiative | Certified to Rock
over my head.....
I don't understand what theme_username is or what you mean by a themeable function. That is probably some of the problem behind why I could not follow the description of how to fix this when I looked at other posted solutions.
Unfortunately my Drupal knowledge is not that deep and I am not a developer or a programmer. I have only recently built a Drupal site and had to teach myself how to use it. Thankfully there is a lot of great info here and in other places.
Could you point me to a good starting place to try to begin to understand themeable functions?
Perhaps it would be best for me to just read through the themeing guide http://drupal.org/theme-guide ....and then the Drupal 6 Guide http://drupal.org/theme-guide/6
Any guidance you could offer would be helpful. I don't mind trying to learn and I also wouldn't mind being pointed in the right direction.
Thank you.
...
http://drupal.org/node/173880 is a pretty good start, using the Devel module (enable the Theme Developer componant) is very very useful.
A book like Pro Drupal Development is great also.
In essence though, the little guide I posted above (my first reply to this post) is how you do it.
Functions that start with "theme_" are themeable functions and can be overridden in the following manner.
Copy the entire function to your template.php file and make your mods there - the code you modified in theme.inc is part of the theme_user function (see code block below).
Make sure you change "theme" to your-themes-name. Below I have used the pseudo theme name MYTHEME, and lets pretend I have pasted this into my template.php file.
/**
* Format a username.
*
* @param $object
* The user object to format, usually returned from user_load().
* @return
* A string containing an HTML link to the user's page if the passed object
* suggests that this is a site user. Otherwise, only the username is returned.
*/
function MYTHEME_username($object) {
if ($object->uid && $object->name) {
// Shorten the name when it is too long or it will break many tables.
if (drupal_strlen($object->name) > 20) {
$name = drupal_substr($object->name, 0, 15) .'...';
}
else {
$name = $object->name;
}
if (user_access('access user profiles')) {
$output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.'))));
}
else {
$output = check_plain($name);
}
}
else if ($object->name) {
// Sometimes modules display content composed by people who are
// not registered members of the site (e.g. mailing list or news
// aggregator modules). This clause enables modules to display
// the true author of the content.
if (!empty($object->homepage)) {
$output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
}
else {
$output = check_plain($object->name);
}
$output .= ' ('. t('not verified') .')';
}
else {
$output = variable_get('anonymous', t('Anonymous'));
}
return $output;
}
Need help with IE?
Learn basic XHTML and CSS first.
Get Firebug.
Responsive Drupal Themes | Drupal 8 Design Initiative | Certified to Rock
thank you
The overriding themed output document looks very intriguing. I think it will do two things. One, it will answer some questions that have come up as I have worked with the setup and themeing of my site. Two, it will only leave me with other new questions. These are both good things.
Thank you for pointing this out to me.
I also appreciate your thoughtfully well explained instructions for fixing my stated problem. I will work through this and mend my ways - transforming myself from a crude hack to practicing a little coding correctness. Before I was glad to have simply found a way to fix this, now I not only know a better way but also have a better solution!
It works for me
Thank you for your piece of code, I`ve just copied it, clear the cache and its working now! Of course, after changing the theme name :)
This had worked for me in 6.9
But in 6.10 I just did the upgrade... I went back to do this little bit of code tweek and now I get this error on the top of every page on my site: http://mybeautybars.com
[quote]
warning: Cannot modify header information - headers already sent by (output started at /home/content/d/a/n/danaarmstrong/html/includes/theme.inc:1) in /home/content/d/a/n/danaarmstrong/html/includes/common.inc on line 141.
[/quote]
Any suggestions on how to fix this? Anyone? Bueller?
I'm not a code geek, and I do try to comb the forums first for answers and well 6.10 is too new for there to be any answers to this problem yet.
Thanks.
Tried it - a no go
I tried to edit the template.php as outlined in this thread and it didn't change. The change to the theme.inc does work however.
...
Then something is going wrong, this is a theme function and being able to override them is at the very heart of Drupal theming.
Responsive Drupal Themes | Drupal 8 Design Initiative | Certified to Rock
The Acquia Marina theme
The Acquia Marina theme provides extra theme settings which allows people to hide the "not verified" without having to touch code. You could take a look at Acquia Marina's template.php to see how they did it.
Yes! I found the function
Yes! I found the function (see below) and that solved the problem :)
/*** Username override
* Hides or shows username '(not verified)' text
*/
function YOURTHEMENAME_username($object) {
if ((!$object->uid) && $object->name) {
$output = (!empty($object->homepage)) ? l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow'))) : check_plain($object->name);
$output .= (theme_get_setting('user_notverified_display') == 1) ? t(' (not verified)') : '';
}
else {
$output = theme_username($object);
}
return $output;
}
Curefans.com - The Cure International Forum
Thanks!
This worked for me.
It didn't work for me either.
It didn't work for me either. Maybe the reason is that I have a couple of functions before?
function deco_theme(&$existing, $type, $theme, $path) {
$hooks['comment_form'] = array('arguments' => array('form' => NULL));
return $hooks;
}
function deco_comment_form($form) {
$output = '';
unset($form['_author']);
unset($form['_homepage']);
unset($form['homepage']);
unset($form['comment_filter']['comment']['#title']);
unset($form['preview']);
$output .= drupal_render($form);
return $output;
}
Curefans.com - The Cure International Forum
thanks a lot for the trick,
thanks a lot for the trick, I've been looking a lot of time for an easy way to theme my outputs, but none of the solutions I've found until now was as clear as this one!