Ignore:
Timestamp:
Jun 1, 2010, 10:54:16 PM (14 years ago)
Author:
Eric
Message:

[NBM_Subscriber]

First release coded 1.0.0:

  • Admin panel added
  • Adding language files: FR and EN are OK, other are partially done
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/NBM_Subscriber/main.inc.php

    r6436 r6439  
    11<?php
    22/*
    3 Plugin Name: NBM_Subscribe
    4 Version: 1.0.a
    5 Description: Permettre aux visiteurs inscrits de s'inscrire eux-même à la notification par mail (NBM) - To allow the registered users to subscribe themself to the notification by mail (NBM)
    6 Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=
     3Plugin Name: NBM Subscriber
     4Version: 1.0.0
     5Description: Permet aux visiteurs inscrits de gérer eux-même leur abonnement à la notification par mail (NBM) - Allows registered visitors to manage their own subscription to the notification by mail (NBM)
     6Plugin URI:
    77Author: Eric
    88Author URI: http://www.infernoweb.net
     
    4040
    4141
    42 /* Adding NBMS in profile page */
    43 //add_event_handler('loc_begin_profile', 'NBMS_Profile');
     42/* Saving from profile with added data */
    4443add_event_handler('save_profile_from_post', 'NBMS_Save_Profile');
    4544
    4645function NBMS_Save_Profile()
    4746{
    48   global $conf;
     47  global $conf, $user;
    4948 
    5049  if (!empty($_POST['NBM_Subscription']) && in_array( $_POST['NBM_Subscription'], array('true', 'false')))
    51 {
    52    $fo=fopen (NBMS_PATH.'log.txt','a') ;
    53    fwrite($fo,"======================\n") ;
    54    fwrite($fo,'le ' . date('D, d M Y H:i:s') . "\r\n");
    55    fwrite($fo,$to . "\n" . $_POST['NBM_Subscription'] . "\r\n") ;
    56    fclose($fo) ;
    57 
    58   $query = '
     50  {
     51    $query = '
    5952UPDATE '.USER_MAIL_NOTIFICATION_TABLE.'
    6053  SET enabled = \''.$_POST['NBM_Subscription'].'\'
    6154  WHERE user_id = \''.$user['id'].'\';';
    6255
    63   pwg_query($query);
    64 }
    65   /*if (isset($_POST['NBM_Subscription']) and $_POST['NBM_Subscription'] == 'true')
    66   {
    67   $query = '
    68 UPDATE '.USER_MAIL_NOTIFICATION_TABLE.'
    69   SET enabled = \'true\'
    70   WHERE user_id = \''.$user['id'].'\';';
    71 
    72   pwg_query($query);
     56    pwg_query($query);
    7357  }
    74   elseif (isset($_POST['NBM_Subscription']) and $_POST['NBM_Subscription'] == 'false')
    75   {
    76     $query = '
    77 UPDATE '.USER_MAIL_NOTIFICATION_TABLE.'
    78   SET enabled = \'false\'
    79   WHERE user_id = \''.$user['id'].'\';';
    80 
    81     pwg_query($query);
    82   }*/
    8358}
    8459
     60/* Adding NBMS in profile page */
    8561add_event_handler('load_profile_in_template', 'NBMS_Load_Profile');
    8662
     
    11288}
    11389
     90/* Original template modification */
    11491function NBMS_prefilter($content, &$smarty)
    11592{
     
    12299  $addon = '{if $ALLOW_USER_CUSTOMIZATION}
    123100  <fieldset>
    124     <legend>{\'NBMS_Title\'|@translate}</legend>
     101    <legend>{\'NBMS_Section\'|@translate}</legend>
    125102      <ul>
    126103        <li>
    127           <span class="property">{\'NBMS\'|@translate}</span>
    128           <span class="property">{$TEST}</span>
     104          <span class="property">{\'NBMS_Text\'|@translate}</span>
    129105          {html_radios name=\'NBM_Subscription\' options=$radio_options selected=$NBMS}
    130106        </li>
     
    137113  return str_replace($search, $replacement, $content);;
    138114}
    139 
    140115?>
Note: See TracChangeset for help on using the changeset viewer.