Hello elgg community,
I have a problem when enabling a plugin with following code in the start php:
<?php thewire_save_post("hello"); ?>
(Actually in my plugin there is more code but the problem is the same) This will give me an infinite loop posting hello on the wire, but I want to post "hello" only one time on the wire when enabling the plugin. How do I have to expand the code so my problem will be solved?
I'm new to elgg and need help.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Juho Jaakkola@juho.jaakkola
Juho Jaakkola - 0 likes
- Alper He@Alper
Alper He - 0 likes
- Jerome Bakker@jeabakker
Jerome Bakker - 0 likes
- Alper He@Alper
Alper He - 0 likes
- ihayredinov@ihayredinov
ihayredinov - 0 likes
- ihayredinov@ihayredinov
ihayredinov - 0 likes
You must log in to post replies.What is your goal? Why do you want to post to the wire when enabling a plugin?
Hello Juho, this will be only for test reasons.
If you wish to only do a task when a plugin is activated or deactivated, check out http://learn.elgg.org/en/2.0/guides/plugins/plugin-skeleton.html?highlight=activate#activate-php-and-deactivate-php
Hello Jerome,
Actually my problem is more complex. I'm sending a wall message to a component which processes the message. The processed message is then send back to an api (the plugin is already enabled). Then the processed message will be send with a client to the wall api, so that the processed message is released on the wall. When enabling the plugin which should release the post on the wall, I will get an infinite loop and the processed message is posted infinite times on the wall. So actually everytime when the api gets a processed message back, the plugin should post on the wall.
You are obviously doing something that you shouldn't be doing. Create a queue and process messages with a cron. Using plugin activation is really not the right or the most efficient place - plugin activation triggers a chain reaction of system and cache events.
And do you really async implementation here? Can't you explicitly post the message when you get a response from the API?