4 * Description: Display membership date in profile
6 * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
11 use Friendica\Core\Hook;
13 use Friendica\Util\DateTimeFormat;
15 function membersince_install()
17 Hook::register('profile_advanced', 'addon/membersince/membersince.php', 'membersince_display');
20 function membersince_display(array &$b)
22 if (DI::app()->getCurrentTheme() == 'frio') {
24 $doc = new DOMDocument();
25 $doc->loadHTML(mb_convert_encoding($b, 'HTML-ENTITIES', 'UTF-8'));
27 $elm = $doc->getElementById('aprofile-fullname');
29 $div = $doc->createElement('div');
30 $div->setAttribute('id','aprofile-membersince');
31 $div->setAttribute('class','col-lg-12 col-md-12 col-sm-12 col-xs-12 aprofile');
33 // The seperator line.
34 $hr = $doc->createElement('hr','');
35 $hr->setAttribute('class','profile-separator');
38 $label = $doc->createElement('div', DI::l10n()->t('Member since:'));
39 $label->setAttribute('class', 'col-lg-4 col-md-4 col-sm-4 col-xs-12 profile-label-name text-muted');
41 // The div for the register date of the profile owner.
42 $entry = $doc->createElement('div', DateTimeFormat::local(DI::app()->profile['register_date']));
43 $entry->setAttribute('class', 'col-lg-8 col-md-8 col-sm-8 col-xs-12 profile-entry');
45 $div->appendChild($hr);
46 $div->appendChild($label);
47 $div->appendChild($entry);
48 $elm->parentNode->insertBefore($div, $elm->nextSibling);
50 $b = $doc->saveHTML();
53 $b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . DI::l10n()->t('Member since:') . "</dt>\n<dd>" . DateTimeFormat::local(DI::app()->profile['register_date']) . "</dd>\n</dl>", $b, 1);