contao / comments-bundle

[READ-ONLY] Contao Comments Bundle
GNU Lesser General Public License v3.0
2 stars 4 forks source link

[RTM] Associate comments with members #7

Closed m-vo closed 5 years ago

m-vo commented 6 years ago

This PR adds a field member to tl_comments which receives the logged in member's id when a comment is stored (or null if the users is a guest).

see #5

I did not add anything to the templates for BC reasons (and: old comments would have the member id 0 set and need some manual migration) nor did I add it explicitly to the template's vars. So this is kind of a hidden feature but would at least allow something like the following in a custom version of the com_default template:

$member = \MemberModel::findById($this->arrData['member']);
if($member) { echo $member->...; }

This allows for several things like displaying user avatars or additional info in comments, listing comments in a user dashboard and so on.


Remarks:

leofeyer commented 6 years ago

As discussed in Mumble on October 18th, member is ok as column name.

m-vo commented 6 years ago

As discussed on mumble the member now gets displayed in the backend if available:

screenshot_20181027_212117

(We could also add the information in the tl_comment label callback, but it's is already a lot in there and a duplicate author/member could be confusing.)

@leofeyer Anything else to add/modify?

leofeyer commented 6 years ago

Is there really a use-case in which a comment needs to be re-assigned from one member to another? I don't think the field needs to be in the back end form.

m-vo commented 6 years ago

Probably not, but there could be the use-case to assign comments that have been made without the member field present (<4.7) or that were issued without login to a member later on.

leofeyer commented 5 years ago

Merged in contao/contao@e8002e0767d2d7ecc4f71ee2e323d5705dc0b8e4.