forked from friendica/friendica-addons
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
2275f7e327
6 changed files with 289 additions and 0 deletions
61
newmemberwidget/README.md
Normal file
61
newmemberwidget/README.md
Normal file
|
@ -0,0 +1,61 @@
|
|||
New Member Widget
|
||||
=================
|
||||
|
||||
With this addon you can enable a widget for the sidebar of the network tab,
|
||||
which will be displayed for new members. It contains a linkt to friendicas
|
||||
introduction pages at /newmember and optionally
|
||||
|
||||
* a link to the global support forum
|
||||
* a link to an eventually existing local support forum
|
||||
* a welcome message you might want to send to your new members.
|
||||
|
||||
There is no extra styling added for this added, so it should work with any
|
||||
theme you have selected, or your user selects. But it was only tested with
|
||||
duepuntozero,quattro and clean.
|
||||
|
||||
Testing it
|
||||
----------
|
||||
You want to test it, but you don't want to create a new account? Take your fav
|
||||
text editor (yeah emacs will do as well) and edit the newmemberwidget.php file.
|
||||
In line 21 you will find a if clause, just add a ! infront of the
|
||||
|
||||
x(!_SESSION
|
||||
|
||||
that will negate the requirement of being a new member, so don't forget the
|
||||
remove that ! again after testing ;-)
|
||||
|
||||
Translations
|
||||
------------
|
||||
If you want to translate this addon, please grab a copy of lang/C/message.po
|
||||
and copy it to lang/XX/message.po where XX is the language you want to
|
||||
translate for (i.e. de, fr, nb-no). After you translated the content go to the
|
||||
root of your friendica directory and run
|
||||
|
||||
php util/po2php.php addon/newmember/lang/XX/message.po
|
||||
|
||||
to translate the message.po file into the strings.php file needed by friendica
|
||||
to catch your translations.
|
||||
|
||||
With the translated files, either do a pull request at github, or send me the
|
||||
two files (message.po and strings.php) you just worked with as attachment to an
|
||||
email.
|
||||
|
||||
Author
|
||||
------
|
||||
* Tobias Diekershoff <tobias.diekershoff(at)gmx.net>
|
||||
|
||||
History
|
||||
-------
|
||||
* **Version 1** (2014-06-01): Initial Release
|
||||
|
||||
License
|
||||
-------
|
||||
This addon is licensed under the [MIT License](http://opensource.org/licenses/MIT).
|
||||
|
||||
> Copyright (c) 2014 Tobias Diekershoff
|
||||
|
||||
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
>
|
||||
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
74
newmemberwidget/lang/C/messages.po
Normal file
74
newmemberwidget/lang/C/messages.po
Normal file
|
@ -0,0 +1,74 @@
|
|||
# ADDON newmemberwidget
|
||||
# Copyright (C)
|
||||
# This file is distributed under the same license as the Friendica newmemberwidget addon package.
|
||||
#
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-06-01 14:12+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: newmemberwidget.php:21
|
||||
msgid "New Member"
|
||||
msgstr ""
|
||||
|
||||
#: newmemberwidget.php:22
|
||||
msgid "Tips for New Members"
|
||||
msgstr ""
|
||||
|
||||
#: newmemberwidget.php:24
|
||||
msgid "Global Support Forum"
|
||||
msgstr ""
|
||||
|
||||
#: newmemberwidget.php:26
|
||||
msgid "Local Support Forum"
|
||||
msgstr ""
|
||||
|
||||
#: newmemberwidget.php:49
|
||||
msgid "Save Settings"
|
||||
msgstr ""
|
||||
|
||||
#: newmemberwidget.php:50
|
||||
msgid "Message"
|
||||
msgstr ""
|
||||
|
||||
#: newmemberwidget.php:50
|
||||
msgid "Your message for new members. You can use bbcode here."
|
||||
msgstr ""
|
||||
|
||||
#: newmemberwidget.php:51
|
||||
msgid "Add a link to global support forum"
|
||||
msgstr ""
|
||||
|
||||
#: newmemberwidget.php:51
|
||||
msgid "Should a link to the global support forum be displayed?"
|
||||
msgstr ""
|
||||
|
||||
#: newmemberwidget.php:52
|
||||
msgid "Add a link to the local support forum"
|
||||
msgstr ""
|
||||
|
||||
#: newmemberwidget.php:52
|
||||
msgid ""
|
||||
"If you have a local support forum and wand to have a link displayed in the "
|
||||
"widget, check this box."
|
||||
msgstr ""
|
||||
|
||||
#: newmemberwidget.php:53
|
||||
msgid "Name of the local support group"
|
||||
msgstr ""
|
||||
|
||||
#: newmemberwidget.php:53
|
||||
msgid ""
|
||||
"If you checked the above, specify the <em>nickname</em> of the local support "
|
||||
"group here (i.e. helpers)"
|
||||
msgstr ""
|
74
newmemberwidget/lang/de/messages.po
Normal file
74
newmemberwidget/lang/de/messages.po
Normal file
|
@ -0,0 +1,74 @@
|
|||
# ADDON newmemberwidget
|
||||
# Copyright (C)
|
||||
# This file is distributed under the same license as the Friendica newmemberwidget addon package.
|
||||
#
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-06-01 12:06+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: newmemberwidget.php:21
|
||||
msgid "New Member"
|
||||
msgstr "Neue Nutzer"
|
||||
|
||||
#: newmemberwidget.php:22
|
||||
msgid "Tips for New Members"
|
||||
msgstr "Tipps für neue Nutzer"
|
||||
|
||||
#: newmemberwidget.php:24
|
||||
msgid "Global Support Forum"
|
||||
msgstr "Globales Forum für Hilfsanfragen"
|
||||
|
||||
#: newmemberwidget.php:26
|
||||
msgid "Local Support Forum"
|
||||
msgstr "Lokales Forum für Hilfsanfragen"
|
||||
|
||||
#: newmemberwidget.php:47
|
||||
msgid "Save Settings"
|
||||
msgstr "Einstellungen Speichern"
|
||||
|
||||
#: newmemberwidget.php:48
|
||||
msgid "Message"
|
||||
msgstr "Nachricht"
|
||||
|
||||
#: newmemberwidget.php:48
|
||||
msgid "Your message for new members. You can use bbcode here."
|
||||
msgstr "Deine Nachricht für neue Nutzer. BBCode kann verwendet werden."
|
||||
|
||||
#: newmemberwidget.php:49
|
||||
msgid "Add a link to global support forum"
|
||||
msgstr "Link zum globalen Support Forum anzeigen"
|
||||
|
||||
#: newmemberwidget.php:49
|
||||
msgid "Should a link to the global support forum be displayed?"
|
||||
msgstr "Soll ein Link zum globalen Support Forum angezeigt werden?"
|
||||
|
||||
#: newmemberwidget.php:50
|
||||
msgid "Add a link to the local support forum"
|
||||
msgstr "Link zum lokalen Support Forum anzeigen"
|
||||
|
||||
#: newmemberwidget.php:50
|
||||
msgid ""
|
||||
"If you have a local support forum and wand to have a link displayed in the "
|
||||
"widget, check this box."
|
||||
msgstr "Wenn du ein lokales Support Forum eingerichtet hast und Link darauf angezeigt werden soll, hier klicken"
|
||||
|
||||
#: newmemberwidget.php:51
|
||||
msgid "Name of the local support group"
|
||||
msgstr "Name des lokalen Support Forums"
|
||||
|
||||
#: newmemberwidget.php:51
|
||||
msgid ""
|
||||
"If you checked the above, specify the <em>nickname</em> of the local support "
|
||||
"group here (i.e. helpers)"
|
||||
msgstr "Wenn der Link angezeigt werden soll, dann trage hier den <em>Spitznamen</em> des Forums ein (z.B. helpers)"
|
16
newmemberwidget/lang/de/strings.php
Normal file
16
newmemberwidget/lang/de/strings.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
;
|
||||
$a->strings["New Member"] = "Neue Nutzer";
|
||||
$a->strings["Tips for New Members"] = "Tipps für neue Nutzer";
|
||||
$a->strings["Global Support Forum"] = "Globales Forum für Hilfsanfragen";
|
||||
$a->strings["Local Support Forum"] = "Lokales Forum für Hilfsanfragen";
|
||||
$a->strings["Save Settings"] = "Einstellungen Speichern";
|
||||
$a->strings["Message"] = "Nachricht";
|
||||
$a->strings["Your message for new members. You can use bbcode here."] = "Deine Nachricht für neue Nutzer. BBCode kann verwendet werden.";
|
||||
$a->strings["Add a link to global support forum"] = "Link zum globalen Support Forum anzeigen";
|
||||
$a->strings["Should a link to the global support forum be displayed?"] = "Soll ein Link zum globalen Support Forum angezeigt werden?";
|
||||
$a->strings["Add a link to the local support forum"] = "Link zum lokalen Support Forum anzeigen";
|
||||
$a->strings["If you have a local support forum and wand to have a link displayed in the widget, check this box."] = "Wenn du ein lokales Support Forum eingerichtet hast und Link darauf angezeigt werden soll, hier klicken";
|
||||
$a->strings["Name of the local support group"] = "Name des lokalen Support Forums";
|
||||
$a->strings["If you checked the above, specify the <em>nickname</em> of the local support group here (i.e. helpers)"] = "Wenn der Link angezeigt werden soll, dann trage hier den <em>Spitznamen</em> des Forums ein (z.B. helpers)";
|
58
newmemberwidget/newmemberwidget.php
Normal file
58
newmemberwidget/newmemberwidget.php
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
/***
|
||||
* Name: New Member Widget
|
||||
* Description: Adds a widget for new members into the sidebar of the network page. The widget will be displayed for the 1st 14days of a account existance and contains a link to the new member page and a free-form text the admin can define.
|
||||
* Version: 1
|
||||
* Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
|
||||
***/
|
||||
|
||||
require_once('include/bbcode.php');
|
||||
|
||||
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 = '<div id="newmember_widget" class="widget">'.EOL;
|
||||
$t .= '<h3>'.t('New Member').'</h3>'.EOL;
|
||||
$t .= '<a href="newmember" id="newmemberwidget-tips">' . t('Tips for New Members') . '</a>i<br />'.EOL;
|
||||
if (get_config('newmemberwidget','linkglobalsupport')==1)
|
||||
$t .= '<a href="https://helpers.pyxis.uberspace.de/profile/helpers" target="_new">'.t('Global Support Forum').'</a><br />'.EOL;
|
||||
if (get_config('newmemberwidget','linklocalsupport')==1)
|
||||
$t .= '<a href="'.$a->get_baseurl().'/profile/'.get_config('newmemberwidget','localsupport').'" target="_new">'.t('Local Support Forum').'</a><br />'.EOL;
|
||||
$ft = get_config('newmemberwidget','freetext');
|
||||
if (!trim($ft)=="")
|
||||
$t .= '<p>'.bbcode(trim($ft)).'</p>';
|
||||
$t .= '</div><div class="clear"></div>';
|
||||
$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']);
|
||||
set_config ( 'newmemberwidget', 'freetext', trim($ft));
|
||||
set_config ( 'newmemberwidget', 'linkglobalsupport', $gs);
|
||||
set_config ( 'newmemberwidget', 'linklocalsupport', $ls);
|
||||
set_config ( '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"), get_config( "newmemberwidget", "freetext" ), t("Your message for new members. You can use bbcode here.")),
|
||||
'$linkglobalsupport' => array( "linkglobalsupport", t('Add a link to global support forum'), get_config( 'newmemberwidget', 'linkglobalsupport'), t('Should a link to the global support forum be displayed?')." (<a href='https://helpers.pyxis.uberspace.de/profile/helpers'>@helpers</a>)"),
|
||||
'$linklocalsupport' => array( "linklocalsupport", t('Add a link to the local support forum'), get_config( 'newmemberwidget', 'linklocalsupport'), t('If you have a local support forum and wand to have a link displayed in the widget, check this box.')),
|
||||
'$localsupportname' => array( "localsupportname", t('Name of the local support group'), get_config( 'newmemberwidget', 'localsupport'), t('If you checked the above, specify the <em>nickname</em> of the local support group here (i.e. helpers)')),
|
||||
));
|
||||
}
|
||||
|
6
newmemberwidget/templates/admin.tpl
Normal file
6
newmemberwidget/templates/admin.tpl
Normal file
|
@ -0,0 +1,6 @@
|
|||
{{include file="field_textarea.tpl" field=$freetext}}
|
||||
{{include file="field_checkbox.tpl" field=$linkglobalsupport}}
|
||||
{{include file="field_checkbox.tpl" field=$linklocalsupport}}
|
||||
{{include file="field_input.tpl" field=$localsupportname}}
|
||||
|
||||
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
|
Loading…
Reference in a new issue