Recent Topics

1 Jan 16, 2008 22:00    

I was wondering if this thread explains my issue. In my custom _item_feedback.inc.php located in my skins folder, I am entering the following:

[php]$Comment->dget('author','htmlattr')[/php]

It returns Justin or Isaac or whoever the Visitor's name is, but it does not return anything for comments that I have posted as an admin. I've created a div.admin in my css file for highlighting my comments and it would work great if this would return my name. Is this the same thing or a different bug that I am experiencing?

2 Jan 16, 2008 21:59

Different bug. The bug in the other thread was squashed before a public release happened. I'll split this into the appropriate forum.

3 Jan 16, 2008 22:17

To clarify, I am using 2.2.0-beta released on 11/29/07. Would it be advantageous to upgrade to 2.3?

4 Jan 16, 2008 23:16

Well ... you should upgrade to 230RC1 because you are running a "beta" release. That means it's not strong enough to be considered stable and only lived a short life. ALL beta users are sort of obligated to upgrade until the next "stable" comes out yah?

I could be wrong, but I doubt upgrading will fix your problem. Maybe, but maybe not.

I would remove the modification and make sure you're getting names from visitors and registered members in comments first. I mean second because I would upgrade first.

5 Jan 18, 2008 00:23

I removed the modification. Then I upgraded. "Comment from: whoever [Visitor]" displays properly, and "Comment from: doombob [Member]" displays properly in post comments. I go back and add [code]$Comment->dget('author','htmlattr')[/code] to "_item_comment.inc.php" and it returns the "whoever" for all comments, but displays nothing when the post author is doombob, the administrator. If I have $Comment->author(); anywhere, it displays the author just fine even if the comment author is me, but there's no way to use what this returns in an HTML attribute.

Maybe I'm going about this the wrong way. I read that "Modular templating of comments makes it easier to customize comment display without going through PHP code." I just need any way to tag my comments with a class attribute so that I can highlight them in my style sheet. If this code above returns my username, it's very easy to add a div around each comment with a <div class="returned username"> and add my user in the style sheet. It's just that right now all I'm seeing in the HTML is <div class=""> for my comments, but <div class="visitorname"> in the rest.

If this is a bug, great! I've never found a bug before. If this is intended behavior and I should be doing something else, I will try the next thing.

6 Jan 18, 2008 01:31

Okay I think I remembered something that has bearing on this topic. The field "author" for commenters only contains info if the commenter is not a registered member of the blog. For members of the blog it stores the bloggers ID and picks up info from that.

So to dget(author) will return NULL for registered bloggers.

Looking at some/sort/of/path/_comment.class.php the "function author(" bit tells me the 3rd and 4th parameter will allow you to wrap the name of a logged in blogger who commented with stuff.

inc/comments/model/ is the path to the file, so give it a looksie and perhaps you'll find a different way to apply the same treatment (params 3 and 4) to all commenters knowing that it will only apply to registered members.

7 Jan 18, 2008 22:25

Thanks for pointing me to the comments class file. What I ended up doing was going through all the functions in there to find a simple quick way to highlight registered member comments. This is now the code I am using in the _item_comment.inc.php in my skins directory:

if ($Comment->get_author_User())
{//If the comment author is a registered User
echo "<div class=\"registered\">";
}else{//else the comment author is a visitor
echo $params['comment_start'];
}


Instead of

echo $params['comment_start'];


get_author_User() returns NULL for non members. The div.registered is just a few lines in css. Just took a little searching, but this was a nice quick fix. Since I am the only registered user for now, it's no big deal. I will be looking for a more fine tuned solution for when I have admins and other registered users, but this works great right now and will for a while. EdB, you're awesome. Thanks for the help.

8 Jan 19, 2008 12:01

Works a treat along with EdB's alternating comments.

The code snippet for the first echo should read...

if ($Comment->get_author_User())
	{//If the comment author is a registered User
	echo '<div class="registered">';
	}else{//else the comment author is a visitor
	echo $params['comment_start'];
	}


Form is loading...