I like this webpush module, but I have trouble making special rules if after creating new node page content on rules action to send notification via webpush.
<?php
/**
* Implements rules_action_info().
*/
function webpush_rules_action_info() {
return array(
'webpush_notification' => array(
'group' => t('Webpush notification'),
'label' => t('Webpush send notification'),
'parameter' => array(
'title' => array(
'type' => 'textfield',
'label' => t('Webpush Title'),
),
'body' => array(
'type' => 'textfield',
'label' => t('Webpush Body'),
),
'link' => array(
'type' => 'textfield',
'label' => t('Webpush Link'),
),
),
),
);
}
?>
Thank you in advance
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | webpush rules.jpg | 509.96 KB | ParanoidIsBack |
Comments
Comment #2
efpapado commentedGreat idea, please provide a patch.
Comment #3
ParanoidIsBack commentedComment #4
gisleBefore adding tags read the issue tag guideline: https://www.drupal.org/node/1023102 Do NOT use tags for adding random keywords or duplicating any other fields.
Comment #5
ParanoidIsBack commentedSorry for that and thank you for the information.
below this fixes the code in webpush.rules.inc:
in experiments that are marked red, this is made through content type and execution by rules of action but is declared to have failed: D there is no notification wherever sent
Comment #6
efpapado commentedYour flow is wrong: Creating a webpush_notification entity does not trigger sending of this notification.
If you use the function provided by the module, it will create the entity and also send the notification.
Comment #9
ParanoidIsBack commented(as in the picture marked in green it was successfully sent)
but how to write code or create a trigger on webpush.rules.inc to make this "rule action" send a notification?
Thank you for enlightening
Comment #10
esolitosYou could take a look at what is done in
webpush_admin_send_form_submit().We would probably need to duplicate the code for that, or even better extract the fuctionality from the form submit and make it available as API.