4 * Description: Change number of contacts shown of profile sidebar
6 * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
10 use Friendica\Core\Hook;
11 use Friendica\Core\Logger;
12 use Friendica\Core\Renderer;
15 function numfriends_install() {
17 Hook::register('addon_settings', 'addon/numfriends/numfriends.php', 'numfriends_settings');
18 Hook::register('addon_settings_post', 'addon/numfriends/numfriends.php', 'numfriends_settings_post');
20 Logger::notice("installed numfriends");
25 * Callback from the settings post function.
26 * $post contains the $_POST array.
27 * We will make sure we've got a valid user account
28 * and if so set our configuration setting for this person.
31 function numfriends_settings_post($a,$post) {
32 if(! local_user() || empty($_POST['numfriends-submit']))
35 DI::pConfig()->set(local_user(),'system','display_friend_count',intval($_POST['numfriends']));
41 * Called from the Addon Setting form.
42 * Add our own settings info to the page.
45 function numfriends_settings(App &$a, array &$data)
51 $numfriends = DI::pConfig()->get(local_user(), 'system', 'display_friend_count', 24);
53 $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/numfriends/');
54 $html = Renderer::replaceMacros($t, [
55 '$numfriends' => ['numfriends', DI::l10n()->t('How many contacts to display on profile sidebar'), $numfriends],
59 'addon' => 'numfriends',
60 'title' => DI::l10n()->t('Numfriends Settings'),