Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

addComment Hook #1669

Closed
ghost opened this issue Nov 29, 2011 · 5 comments
Closed

addComment Hook #1669

ghost opened this issue Nov 29, 2011 · 5 comments
Assignees
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Nov 29, 2011

Hi Leo,

I'm trying to track when users add comments to News, Articles, etc and act on it automatically.

Do you think it could be possible to modify the Comments.php to add a callback?

If not, do you see any other way for me to "catch" that event so I can act on it?

Thanks,

Erwan

--- Originally created by eripoll on March 5th, 2010, at 06:33pm (ID 1669)

@ghost ghost assigned leofeyer Nov 29, 2011
@leofeyer
Copy link
Member

If you need a new hook, please post a code sample and let us know exactly where to put it.

--- Originally created on March 6th, 2010, at 09:30am

@ghost
Copy link
Author

ghost commented Nov 29, 2011

Hello Leo,

This is what I had in mind :

in system/modules/comments/Comments.php

            [..]
            $insert = $this->Database->prepare("INSERT INTO tl_comments %s")->set($arrSet)->execute();

            // HOOK: add comment callback

            if (isset($GLOBALS['TL_HOOKS']['addComment']) && is_array($GLOBALS['TL_HOOKS']['addComment']))
            {
                foreach ($GLOBALS['TL_HOOKS']['addComment'] as $callback)
                {
                    $this->import($callback[0]);
                    $this->$callback[0]->$callback[1]($insert->insertId,$arrSet);
                }
            }

            // Notification
            $objEmail = new Email();
            [..]

Let me know what you think of it...
Many thanks in adance !

Erwan

--- Originally created by eripoll on March 8th, 2010, at 11:14am

@leofeyer
Copy link
Member

Implemented in e1e4513.

--- Originally created on April 10th, 2010, at 05:19pm

@ghost
Copy link
Author

ghost commented Nov 29, 2011

Many Thanks Leo

![](You rock)

--- Originally created by eripoll on April 11th, 2010, at 03:34pm

@leofeyer
Copy link
Member

--- Originally completed on April 10th, 2010, at 05:19pm

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant