• Resolved huongcba

    (@huongcba)


    Hi, I made this code visible only to logged in users and get the values ​​key1, key2.
    <script>
    function _webpushrScriptReady(){
    webpushr(‘attributes’,{“key1” : “value”, “key2” : “value” });
    }
    </script>
    Is there anyway I can get the logged-in user information? For example: first name, last name, role, email, etc.
    Thank you!

Viewing 1 replies (of 1 total)
  • Plugin Author webpushr

    (@webpushr)

    Hi there,

    Thank you for using Webpushr. Are you trying to assign user information such as e-mail, which is stored in your database, as a Custom Attribute to your push subscriber? If so, this will require some custom development on your end.

    For example: you could try the following:

    <?php $current_user = wp_get_current_user(); ?>
    <script>
    function _webpushrScriptReady(){
    webpushr(‘attributes’,{“user_email” : “<?php echo $current_user->user_email;?>”,”user_name” : “<?php echo $current_user->display_name;?>”,”user_id” : “<?php echo $current_user->ID;?>”, });
    }
    </script>

    Hope this helps!

Viewing 1 replies (of 1 total)

The topic ‘Get the logged-in user information’ is closed to new replies.