1 reijin Mar 08, 2006 04:56
3 personman Mar 08, 2006 20:30
Here's what I have on my site. I think it does what you're asking for. First you need to know something about the _feedback.php file. There a small version of it in each skin. The small version sets a couple of options, then calls the full version of the file, which is in the /skins/ folder. You can replace the small version with a copy of the big version if you want to make a skin display comments differently than the others. In that case, copy the file down to your skin folder and make the this change to it. If you want the change to affect all blogs (at least all of them whose _feedback.php calls the main _feedback.php file), then make this change to /skins/_feedback.php. Ok, here's the change. Find this part:
case 'comment': // Display a comment:
echo T_('Comment from:') ?>
<?php $Comment->author('' , '#' , '' , '#' , 'htmlbody' , 'true' ) ?>
<?php break;
and change it to this:
case 'comment': // Display a comment:
echo T_('Comment from:') ?>
<?php $Comment->author_url('', '<a href="', '">', false); $Comment->author('', '</a>', ' ', '</a>'); ?>
<?php break;
That should make the name into a link if ther's a url, and it will remove the Visitor and Member words.
4 reijin Mar 08, 2006 22:04
Excellent. That's exactly what I was looking for. Thanks a ton. You have my gratitude.
5 marcdk Mar 08, 2006 22:52
Thanx! Great! =D
And I wonder if we could the buttons with this symbol on it display next to the url when we are logged in as admin:
http://www.b2evolution.net/admin/img/noicon.gif
This would make deleting and fighting spam much easier.
And is there a way to differ between [visitor] and [member] by a css-class? Some if - else check would be ok. So I could display members with <strong>-Tags or something like that.
6 personman Mar 08, 2006 23:04
I don't know about putting a direct link to ban the comment. That would be nice. I might give it a try later on.
If you want a member and visitor class, try this:
case 'comment': // Display a comment:
echo T_('Comment from:') ?>
<?php $Comment->author_url('', '<a href="', '">', false); $Comment->author('<span class="member">', '</span></a>', '<span class="visitor">', '</span></a>'); ?>
<?php break;
I might have that backwards, I don't have time to dig around and check it. But give it a try and see if it works.
7 marcdk Mar 08, 2006 23:48
I just love you, personman! You're da man!
8 marcdk Mar 12, 2006 17:13
There is one problem witrh the code:
the <A> Tag is ALWAYS being closed. Even if there is no starting <a>-Tag. How can we fix this because it results in unvalid code!
9 marcdk Mar 12, 2006 17:27
Can't we just check if this method gives a value back:
$Comment->author_url('', '<a href="', '">', false)
Something like this:
if($Comment->author_url('', '<a href="', '">', false)!=""){
echo "</a>;"
}
But it does not work. =(
10 edb Mar 12, 2006 17:57
Try this instead, though I haven't so don't be surprised if it doesn't work.
if($Comment->author_url != "") {
do whatever it is that makes comments link authors to their URL
} else {
do comments the regular boring old fashioned way
}
11 marcdk Mar 12, 2006 18:06
Does not work.
But this checks if it is false but still echos the url:
if(($Comment->author_url('', '', '',false)!=false)){
echo "</a>";
}
I don't get it. How do I prevent this from printing out the url? =/
12 yabba Mar 12, 2006 18:25
Another "off the top of my head" (ie untested) solution :-
$Comment->author( '<span class="visitor">', '</span>', '<span class="member">', '</span>','htmlbody',true ) ;
¥
13 marcdk Mar 12, 2006 19:48
and how should we close the A-Tag then?
14 yabba Mar 12, 2006 23:10
The <a> tag is closed within the function that it calls ?
/**
* Template function: display author of comment
*
* {@internal Comment::author(-) }}
*
* @param string String to display before author name if not a user
* @param string String to display after author name if not a user
* @param string String to display before author name if he's a user
* @param string String to display after author name if he's a user
* @param string Output format, see {@link format_to_output()}
* @param boolean true for link, false if you want NO html link
*/
function author( $before = '', $after = '#', $before_user = '', $after_user = '#',
$format = 'htmlbody', $makelink = false )
¥
15 marcdk Mar 13, 2006 15:45
No. Personman used it with the "false" attribute so that no link is generated there. This way, we are able to put the author name in the hyperlink.
But there has to be a cleaner way to do this. Why am I not able to use the == or != operator with object-methods?
16 yabba Mar 13, 2006 16:44
Ok, maybe it's me tripping, but I'm assuming you want something along the lines of :-
If author has url
<a href="url"><span class="member/visitor">author name</span></a>
If author has no url
<span class="member/visitor">author name</span>
In which case that's what $Comment->author() already does but it defaults to "and don't link to author_url"
I don't have 9.1 installed but I use the same call on my 1.6 blog and it works fine.
¥
17 marcdk Mar 14, 2006 12:34
Ok, so would you please tell me what I should put as code instead?
18 yabba Mar 14, 2006 12:46
This is all I have in my skin for comment author & url :-
$Comment->author( '<span class="visitor">', '</span>', '<span class="member">', '</span>','htmlbody',true ) ;
It's the "true" bit at the end that adds the link to the authors url if there is one (the default is no link);
¥
19 marcdk Mar 14, 2006 13:15
Wow, it works! =D
20 yabba Mar 14, 2006 13:17
No problem ;)
¥
Exactly my problem. And I don't want the "[Visitor]" behin the name
Please help. =/
I tried something like this to check if the url is set but it does not work:
Why?