Fork me on GitHub

Intercom Email notifications mandatory  Bottom

Go to page 1 - 2 [+1]:

  • Hi, I use to have pnmessages and now i upgraded to intercom. Intercom gives users the option of having email notifications and by default it is set to "no". What I would like to know, is if there is a way to set the default to "yes" so everyone will get notification of their new message via email. With pnmessages, i believe "yes" was the default I hope there is a way to accomplish this with intercom.



    edited by: mikebcoffee, datetimebrief
  • I'm trying to drive more traffic to my website and it is easier to do when people receive email notifications.
  • I asked the same some months ago but I couldn't find the thread anymore.
    It seems to me that you should change in pnuserapi.php line 97

    Code

    $user['__ATTRIBUTES__']['ic_note'] = 1;
  • I switched value from 0 to 1. Still doesn't work. Default is still set to no. Thanks anyway.
  • Not exactly what you are looking for but a start: Click.

    --
    Cheers, Sascha

    Philivision, Inc. - User of Zikula since 2002...
  • The hack I suggested works only with new users. Every time a new user is created the option will be set to "yes". Then the user will decide to keep it "yes" or "not".
    Of course all the old users have that option set to "no" by default and the script suggested by Roadranner will help you to change all the old settings to yes.
  • So this is the code, but I am wandering where do you place this code?

    Code

    <?php
     $conn = mysql_pconnect("server","username","password");
     mysql_select_db("database", $conn);
     $SQL = "SELECT pn_uid,pn_uname FROM zk_users";
     $result = mysql_query($SQL) or die(mysql_error());

     echo "Setting email notofications on for all users ...<br />";
     flush();

     while($row = mysql_fetch_array($result)) {
      $dato = date("Y-m-d H:i:s");
      $SQL = "INSERT INTO zk_objectdata_attributes (oba_attribute_name,oba_object_id,oba_object_type,oba_value,oba_obj_status,oba_cr_date,oba_cr_uid,oba_lu_date,oba_lu_uid) VALUES('ic_note','" . $row[pn_uid] . "','users','1','A','" . $dato . "','" . $row[pn_uid] . "','" . $dato . "','" . $row[pn_uid] . "')";
      mysql_query($SQL);
      $SQL = "INSERT INTO zk_objectdata_attributes (oba_attribute_name,oba_object_id,oba_object_type,oba_value,oba_obj_status,oba_cr_date,oba_cr_uid,oba_lu_date,oba_lu_uid) VALUES('ic_ar','" . $row[pn_uid] . "','users','0','A','" . $dato . "','" . $row[pn_uid] . "','" . $dato . "','" . $row[pn_uid] . "')";
      mysql_query($SQL);
      echo "Settings for user <strong>" . $row[pn_uname] . "</strong> done.<br />";
      flush();
     }

     echo "DONE!!";
    ?>
  • Does anyone know where to place the above code in Intercom?
  • Not in InterCom. It looks like a simple PHP-code. Just copy it into a PHP file and open it.


    BUT: I didn't check the code. So I cannot recommend this approach. Use at your own risk.
  • This is just an extra separate PHP script that sets all user attributes that are neccesarry for the notification.
    but this will only affect existing users and has to be done periodically to affect the settings of all users.


    Flo

    --
    ifs-net.de -- zksoft.de
  • Ok so I'm assuming I just create a new PHP file and add this code? But what do I name the file?
  • Whatever you want, doesn't matter. As long as it ends in .php

    --
    Home Page | Find on Facebook | Follow on Twitter
  • Ok. This script must not work with Zikula 1.2.3. I named the file 'pnscript.php' and uploaded it to the modules/intercom directory. Existing users are still set to no.



    edited by: mikebcoffee, datetimebrief
  • It's not something that will auto run, you have to call it directly, just like the site's index.php. It doesn't matter where you put it, or what you call it.. All it does is make a change to your data records. Upload it to the root of your site, and instead of domain.com/index.php load domain.com/pnscript.php

    --
    Home Page | Find on Facebook | Follow on Twitter
  • Ok I see. I called the script directly and got this error.
    Warning: mysql_pconnect() [function.mysql-pconnect]: Unknown MySQL server host 'server' (1) in /pnscript.php on line 2

    Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /pnscript.php on line 3

    Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/tmp/mysqld.sock' (2) in pnscript.php on line 5

    Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /pnscript.php on line 5
    Can't connect to local MySQL server through socket '/tmp/mysqld.sock' (2)

Go to page 1 - 2 [+1]:

This list is based on users active over the last 60 minutes.