Possible, but not a good idea (Features)

by mkjjj, Thursday, September 27, 2012, 08:55 (2553 days ago) @ novacultura

Hi Auge,

thanks for the mod. It works! The only problem is that users can't deactivate this feature (if they want to keep the email contact feature). I would prefer the same functionality like Admins and Mods have. I've changed the user_edit.inc.tpl from

{if $mod||$admin}
<tr>
<td class="c"><strong>{#edit_user_notification#}</strong></td>
<td class="d"><input id="new_posting_notification" type="checkbox" name="new_posting_notification" value="1"{if $new_posting_notification=="1"} checked="checked"{/if} /><label for="new_posting_notification">{#admin_mod_notif_posting#}</label><br />
<input id="new_user_notification" type="checkbox" name="new_user_notification" value="1"{if $new_user_notification=="1"} checked="checked"{/if} /><label for="new_user_notification">{#admin_mod_notif_register#}</label></td>
</tr>
{/if}

to

<tr>
<td class="c"><strong>{#edit_user_notification#}</strong></td>
<td class="d"><input id="new_posting_notification" type="checkbox" name="new_posting_notification" value="1"{if $new_posting_notification=="1"} checked="checked"{/if} /><label for="new_posting_notification">{#admin_mod_notif_posting#}</label><br />
{if $mod||$admin}<input id="new_user_notification" type="checkbox" name="new_user_notification" value="1"{if $new_user_notification=="1"} checked="checked"{/if} /><label for="new_user_notification">{#admin_mod_notif_register#}</label>{/if}</td>
</tr>

And in the user_inc.php:

   if($_SESSION[$settings['session_prefix'].'user_type']==1||$_SESSION[$settings['session_prefix'].'user_type']==2)
        {
         $smarty->assign('new_posting_notification', $row['new_posting_notification']);
         $smarty->assign('new_user_notification', $row['new_user_notification']);
        }

to

$smarty->assign('new_posting_notification', $row['new_posting_notification']);
         $smarty->assign('new_user_notification', $row['new_user_notification']);

and

     if(isset($_POST['user_view'])) $user_view = intval($_POST['user_view']); else $user_view=0;
       if($user_view!=0&&$user_view!=1&&$user_view!=2) $user_view = 0;
       if($_SESSION[$settings['session_prefix'].'user_type']==1||$_SESSION[$settings['session_prefix'].'user_type']==2)
        {
         if(isset($_POST['new_posting_notification']) && $_SESSION[$settings['session_prefix'].'user_type']>0) $new_posting_notification = intval($_POST['new_posting_notification']);
         else $new_posting_notification = 0;
         if($new_posting_notification!=0&&$new_posting_notification!=1) $new_posting_notification=0;
         if(isset($_POST['new_user_notification']) && $_SESSION[$settings['session_prefix'].'user_type']>0) $new_user_notification = intval($_POST['new_user_notification']);
         else $new_user_notification = 0;
         if($new_user_notification!=0&&$new_user_notification!=1) $new_user_notification=0;
        }
       else

to

    if(true)
        {
         if(isset($_POST['new_posting_notification'])) $new_posting_notification = intval($_POST['new_posting_notification']);
         else $new_posting_notification = 0;
         if($new_posting_notification!=0&&$new_posting_notification!=1) $new_posting_notification=0;
         if(isset($_POST['new_user_notification'])) $new_user_notification = intval($_POST['new_user_notification']);
         else $new_user_notification = 0;
         if($new_user_notification!=0&&$new_user_notification!=1) $new_user_notification=0;
        }
       else

While this makes the checkbox available for all registered users and keeps the setting, no emails are sent. Obviously, something is missing.

Any ideas would be very appreciated!

Mike


Complete thread:

 RSS Feed of thread

powered by my little forum