Greetings all you cool people.
I need some advice with extensions. I've been playing around a bit with Discord + Flarum and trying to send a message Discord channel when someone makes a new post.
The good news is that it works fine. But I'd like to add a little bit of more info there, ie. username who posted, and build up the URL for the message that posted. I've been hitting my head against the wall with this for several hours.
The latest way I tried was like this:
use Flarum\Event\PostWasPosted;
use Illuminate\Contracts\Events\Dispatcher;
return function (Dispatcher $events)
{
$events->listen(PostWasPosted::class, function (PostWasPosted $event) {
// Find out how to access user name and other post information!
// $poster = "Testing";
$poster = $event->$actor->$username;
And I just can't get the bloody thing to work.
So please give me a clear working example how to access this data:
- Name of the poster
- The information necessary to build up the URL for the post
Thanks :-)