$name, 'URL' => get_admin_plugin_menu_link(NBMS_PATH.'/admin/NBMS_admin.php') ) ); return $menu; } /* Saving from profile with added data */ add_event_handler('save_profile_from_post', 'NBMS_Save_Profile'); function NBMS_Save_Profile() { global $conf, $user; if (!empty($_POST['NBM_Subscription']) && in_array( $_POST['NBM_Subscription'], array('true', 'false'))) { $query = ' UPDATE '.USER_MAIL_NOTIFICATION_TABLE.' SET enabled = \''.$_POST['NBM_Subscription'].'\' WHERE user_id = \''.$user['id'].'\';'; pwg_query($query); } } /* Adding NBMS in profile page */ add_event_handler('load_profile_in_template', 'NBMS_Load_Profile'); function NBMS_Load_Profile() { global $conf, $user, $template, $lang; $query = ' SELECT enabled FROM '.USER_MAIL_NOTIFICATION_TABLE.' WHERE user_id = \''.$user['id'].'\' ;'; $data = pwg_db_fetch_assoc(pwg_query($query)); $values = $data['enabled']; $template->assign('radio_options', array( 'true' => l10n('Yes'), 'false'=> l10n('No'))); $template->assign( array( 'NBMS'=>$values )); $template->set_prefilter('profile_content', 'NBMS_prefilter'); } /* Original template modification */ function NBMS_prefilter($content, &$smarty) { global $template, $lang; load_language('plugin.lang', NBMS_PATH); $search = '

'; $addon = '{if $ALLOW_USER_CUSTOMIZATION}

{\'NBMS_Section\'|@translate}
{/if}'; $replacement = $addon.$search; return str_replace($search, $replacement, $content); } ?>