Page 1 of 1

Attribute CGFeedback comments to logged in FEUser [SOLVED]

Posted: Mon Jun 24, 2013 2:03 pm
by tophers
I'm looking for a way to attribute a comment to the logged in Front End User - I have CGFeedback hooked up to CGBlog on an extranet site, so ALL users will be logged in. Rather than have then fill in more fields, I'd like to pull in the user's information, both for display on the site and for admin purposes (tracking of comments). Ideally I would capture 'firstname', 'lastname' (which could be combined into a 'Name' field, but sin't necessary) and 'email'. The client doesn't want the comments system to be anonymous, but we don't want to rely on them to provide the information.

I'm sure this has been answered somewhere, but my searches haven't turned up anything useful so far. I'm running the latest version of the CMS, CGBlog and CGFeedback - it's a new site under development.

Re: Attribute CGFeedback comments to logged in FEUser

Posted: Mon Jun 24, 2013 2:44 pm
by Jo Morg
I believe that the CustomContent module provides the means to extract that data from the logged in user.

Re: Attribute CGFeedback comments to logged in FEUser

Posted: Mon Jun 24, 2013 5:07 pm
by calguy1000
This is not difficult.

You can use the methods/plugins from FEU/CustomContent to popuplate the author and email fields of the CGFeedback comment form.

You could then make these fields read only, or hidden... but not disabled.

Re: Attribute CGFeedback comments to logged in FEUser

Posted: Mon Jun 24, 2013 5:47 pm
by tophers
That's what I was thinking - here's what I have working now:

Code: Select all

{capture assign='author_name'}{ccUser::property('firstname')} {ccUser::property('lastname')}{/capture}
{capture assign='author_email'}{ccUser::property('email')}{/capture}
In conjunction with this:

Code: Select all

  {* Assign FEU info to Comment *}
        <input type="hidden" name="{$actionid}author_name" value="{$author_name}"/>
        <input type="hidden" name="{$actionid}author_email"value="{$author_email}"/>
Does this seem like the best solution? Or have I overly complicated matters?

Re: Attribute CGFeedback comments to logged in FEUser

Posted: Mon Jun 24, 2013 6:26 pm
by calguy1000
that's what I would do, unless I could find a way to not use 'capture' (it's very slow).

{$author_email=ccuser::get_property('email')} would be better.

or

<input type="hidden" name="{$actionid}author_name" value="{ccuser::get_property('firstname')} {ccuser::get_property('lastname')}"/>
<input type="hidden" name="{$actionid}author_email" value="{ccuser::get_property('email')}"/>