Messages with privacy option + more v1.1

Release Notes

Install: deactivate original mod/message folder. rename mod/messages to mod/messages_old, drop this plugin into your mod folder, and activate it.
 
Notes:

This is a modified version of the messages plugin from version 1.6.1.

To install: deactivate old messages plugin, rename/delete mod/messages, upload this version and activate.

New is a plugin option to enable privacy or not. If enabled, users can select if they would like to receive messages from all users or only friends.

Users should go to: Settings, Plugin configuration to enable/disable this privacy option.

If a non-friend tries to send to user who doesn't want messages from non-friends, he will get a message saying "This user only wishes to recieve messages from friends!"

Tested on version 1.5 and 1.6.1

Changelog:
Version 1.1

  • Moved deny message so it shows instead of message form when trying to send to non-friends (earlier you could write a long message and then get the deny message when trying to send it)
  • Fixed problem where when replying to allready recieved mail.
  • If using version 1.0 you really should update!

Version 1.0

  • Initial version

Donation:

If you like my plugin please consider a donation

  • Now I can use this plugin as before it would of irritated my members.

    Does it work with this plugin ..  Messages improved - Groups & Collections of friends support (1.0) ??

  • @Sim2K

    No, these are seperate plugins. I haven't looked into merge the two plugins into one.

  • I am happy to see someone working on this.  I think it is a good idea.  Keep up the good work.

  • Hi.  How can i set this up so that it defaults to "Yes" for the privacy setting?  Currently it defaults to "No" ie. allowing messaging from non-friends.  I want the opposite.  Is there an easy line change somewhere to accomplish this change of default?  Thanks.

  • @reinashar

    In /mod/messages/send.php change:

        if (get_plugin_setting('enableprivacy', 'messages') == 'yes') {

    to

        if (get_plugin_setting('enableprivacy', 'messages') == 'yes' || get_plugin_setting('enableprivacy', 'messages') == '') {

    That should do it - but please test before putting it in production.

  • @slyhne:

    actually that didn't do the trick.  I think you might have misunderstood what i'm trying to do.  what i'm looking to do is to change the default option in the settings for this plugin that appears in the "Configure Your Tools" section.

    For the setting labeled:

    Select "Yes" if you wish to receive messages from friends only:

    The default setting in the drop down menu for any newly created user is "No".  I want to change this to default to "Yes" for any new users only (not existing users).

  • @reinashar

    Let me get it right, whenever a user goes to "Settings" > "Configure your tools" you want the drop down box to show "Yes" as default?

    That would be changed in mod/messages/views/default/usersettings/messages/edit.php

    But what about those users who haven't been in there choosing and saving? In that case the setting is blank - that goes for all users until they have saved their settings. That's why I suggested you changed de default behavior.

     

  • @slyhne:

    actually it shouldn't be blank.  currently when using your plugin, newly registered users have the drop down selecting "No" as the default.  It's not blank.  It defaults to "No" without the need for the user to go into their settings and specifically set it to "No".  All i want is to switch this.  For any newly registered user, I want the default to be "Yes".  How can i do this exactly?  Thanks.

  • When I say blank I meen the actual usersetting, that IS blank until the user visits "Settings" > "Configure your tools" and press "Save". So no matter what the select dropdown box says initially the actual setting in the database is blank.

    To change the selector to show "Yes" as default you should change this file: /home/k4/www/mod/messages/views/default/usersettings/messages/edit.php and change the <option lines to this:
    <option value="yes" <?php if ($vars['entity']->friendsonly != 'no') echo " selected=\"yes\" "; ?>><?php echo elgg_echo('option:yes'); ?></option>
    <option value="no" <?php if ($vars['entity']->friendsonly == 'no') echo " selected=\"yes\" "; ?>><?php echo elgg_echo('option:no'); ?></option>

    I still believe you need to change line 38 in /mod/messages/send.php:

    if (get_plugin_usersetting('friendsonly', $send_to, 'messages') == 'yes') {

    to

    if (get_plugin_usersetting('friendsonly', $send_to, 'messages') != 'no') {

    I can't stress it enough, you need to test this before putting in production - because I haven't testet it.

  • so will this only change the displayed menu option without setting the appropriate value in the DB (for all newly registered users)?  If so, then that won't really solve my problem.  Any thoughts?

  • You need to read the whole message, I think you missed this part:

    I still believe you need to change line 38 in /mod/messages/send.php:

    if (get_plugin_usersetting('friendsonly', $send_to, 'messages') == 'yes') {

    to

    if (get_plugin_usersetting('friendsonly', $send_to, 'messages') != 'no') {

    I can't stress it enough, you need to test this before putting in production - because I haven't testet it.

Stats

  • Category: Communication
  • License: GNU General Public License (GPL) version 2
  • Updated: 2014-11-17
  • Downloads: 4929
  • Recommendations: 16

Other Projects

View slyhne's plugins