• Resolved tolf

    (@tolf)


    Hi,

    OneSignal seems to be a great solution for me and I succeeded to send test notifications with my wordpress blog.

    But I don’t understand how to deal with your documentation https://documentation.onesignal.com/docs/wordpress to setup the plugin for my needs :

    I don’t want all visitors to see your subscription button and subscribe to my notifications :

    1) Is it correct I have to disable automatic initialization of OneSignal by enabling “Use my own SDK initialization script” in your plugin’s options ?

    2) Then, I suppose I have to initialize OneSignal by rewriting “onesignal_initialize_sdk-filter” for my needs following your example.

    3) I don’t understand your sentence “…you must them manually initialize OneSignal in JavaScript on all pages” because the following lines are PHP, not Javascript !?

    <?php
    add_filter('onesignal_initialize_sdk', 'onesignal_initialize_sdk_filter', 10, 1);
    function onesignal_initialize_sdk_filter($onesignal_settings) {
        // Returning true allow the SDK to initialize normally on the current page
        // Returning false prevents the SDK from initializing automatically on the current page
        return true;
    }

    4) In which file must I paste this code ? in my functions.php inside my child theme or somewhere else ?

    Thanks for your help, I’m lost.

The topic ‘how to provide subscriptions only for some users’ is closed to new replies.