Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push Notification to role #27

Open
IWantToImprovemySkills opened this issue Mar 29, 2018 · 2 comments
Open

Push Notification to role #27

IWantToImprovemySkills opened this issue Mar 29, 2018 · 2 comments
Labels

Comments

@IWantToImprovemySkills
Copy link

Hi, i was wondering if there is any chance to send a notification to a specific role of authenticated users to your own drupalgap app. I recently started to use drupalgap and i have little knowledge about programming in drupal. Thanks in advance for your help and I apologize for my poor english.

@signalpoint
Copy link
Owner

signalpoint commented Mar 30, 2018

@IWantToImprovemySkills Your English is fine, thank you. This would require custom programming, and these are the steps I would take:

  • get list of users who have the role(s)
  • look up token(s) for those user(s), if any
  • send out push notification to those token(s), if any

@IWantToImprovemySkills
Copy link
Author

Thank you, I managed to achieve this through the rule module in drupal :)
I'd like to ask a final question: is there any possibility to modify the push in a way it becomes a link to the content? I studied the example on the drupalgap push notification repository but i didn't figured out yet how this work (or if is still working):
///////////////drupal
/**

  • Implements hook_form_alter().
    /
    function example_form_alter(&$form, $form_state, $form_id) {
    switch ($form_id) {
    case 'push_notifications_mass_push_form':
    $form['message']['nid'] = array(
    '#type' => 'textfield',
    '#title' => t('Node ID'),
    '#description' => t('Enter a the id of a node to display to the recipients.'),
    '#size' => 6
    );
    break;
    }
    }
    ///////////////drupalgap
    /
    *
  • Implements hook_push_notifications_receive().
    */
    function sal_push_notifications_receive(data) {
    if (data.additionalData && data.additionalData.nid) {
    drupalgap_goto('node/' + data.additionalData.nid);
    }
    }

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

No branches or pull requests

2 participants