Comment Plugin - error in displaying user name

23 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: June 10, 2014   (RSS)

By meg - June 2, 2014

I'm using this code from your example to display the user account name for a comment: 

<?php echo htmlspecialchars(coalesce(@$comment[$GLOBALS['WSM_ACCOUNTS_TABLE'].'.username'],$comment['createdBy.username'])); ?>

But I'm receiving a "Notice: Undefined variable:" error. Any suggestions on how to get this working?

By claire - June 9, 2014

Hi Meg

Can you give us more information, like the full error text?

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By meg - June 9, 2014

Notice: Undefined variable: comment in article.php on line 242

By meg - June 9, 2014

Also, on the same website, with the membership plugin, I'm getting an error in the update profile page: Current password isn't correct! even though it is the correct password. 

By claire - June 9, 2014

Thanks. Could you email me a copy of the file in question? I'll try to reproduce the error here and I'll do some more troubleshooting.

My address is claire@interactivetools.com.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By claire - June 9, 2014

Hi Meg, thanks for the email. Love the site design by the way :)

This line looks anomalous:

<?php echo htmlspecialchars(coalesce(@$comment[$GLOBALS['WSM_ACCOUNTS_TABLE'].'.username'],$comment['createdBy.username'])); ?>

because the $comment variable isn't being set. But it's inside a loop that uses $record, not $comment. Unless $comment is some kind of global variable, I suspect you just need to change it to $record for this to work.

If this isn't right, then I think I'll have to see the whole thing and do some direct troubleshooting.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By meg - June 9, 2014

Thanks! Yes, it's fixed. I believe I originally grabbed that line from an example, not knowing if $comment was required or not.

Any ideas on the user profile glitch? It's strange because I haven't experienced it with other membership sites I've done. 

By meg - June 9, 2014

Oh - and one more question about the comments plugin. 

I have it connected to a multi-listing details page (aka a detailed article page). When I comment on one article, the comment shows up on all articles. I need the comments to be unique to each article. How do I do that?

Thank you again for all your help! This is my first time using this plugin.

By claire - June 9, 2014

I'm not sure, from what you've described so far. I'd have to see the site itself to figure it out. The first thing that comes to mind is that it's an issue with the password not being sent to the form.

I did try to replicate the bug here and everything worked fine, so I'd guess it's something to do with your system. Is there anything else you can tell me that might help?

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/