***/ require_once('include/bbcode.php'); use Friendica\Core\Config; function newmemberwidget_install () { register_hook( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init'); logger('newmemberwidget installed'); } function newmemberwidget_uninstall () { unregister_hook( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init'); } function newmemberwidget_network_mod_init ( $a, $b) { if (x($_SESSION['new_member'])) { $t = '
'.EOL; $t .= '

'.t('New Member').'

'.EOL; $t .= '' . t('Tips for New Members') . '
'.EOL; if (Config::get('newmemberwidget','linkglobalsupport')==1) $t .= ''.t('Global Support Forum').'
'.EOL; if (Config::get('newmemberwidget','linklocalsupport')==1) $t .= ''.t('Local Support Forum').'
'.EOL; $ft = Config::get('newmemberwidget','freetext'); if (!trim($ft)=="") $t .= '

'.bbcode(trim($ft)).'

'; $t .= '
'; $a->page['aside'] = $t . $a->page['aside']; } } function newmemberwidget_plugin_admin_post( &$a ) { $ft = ((x($_POST, 'freetext')) ? trim($_POST['freetext']) : ""); $lsn = ((x($_POST, 'localsupportname')) ? notags(trim($_POST['localsupportname'])) : ""); $gs = intval($_POST['linkglobalsupport']); $ls = intval($_POST['linklocalsupport']); Config::set ( 'newmemberwidget', 'freetext', trim($ft)); Config::set ( 'newmemberwidget', 'linkglobalsupport', $gs); Config::set ( 'newmemberwidget', 'linklocalsupport', $ls); Config::set ( 'newmemberwidget', 'localsupport', trim($lsn)); } function newmemberwidget_plugin_admin(&$a, &$o){ $t = get_markup_template('admin.tpl','addon/newmemberwidget'); $o = replace_macros($t, array( '$submit' => t('Save Settings'), '$freetext' => array( "freetext", t("Message"), Config::get( "newmemberwidget", "freetext" ), t("Your message for new members. You can use bbcode here.")), '$linkglobalsupport' => array( "linkglobalsupport", t('Add a link to global support forum'), Config::get( 'newmemberwidget', 'linkglobalsupport'), t('Should a link to the global support forum be displayed?')." (@helpers)"), '$linklocalsupport' => array( "linklocalsupport", t('Add a link to the local support forum'), Config::get( 'newmemberwidget', 'linklocalsupport'), t('If you have a local support forum and want to have a link displayed in the widget, check this box.')), '$localsupportname' => array( "localsupportname", t('Name of the local support group'), Config::get( 'newmemberwidget', 'localsupport'), t('If you checked the above, specify the nickname of the local support group here (i.e. helpers)')), )); }