geekitude / dokuwiki-plugin-userhomepage

Dokuwiki plugin to automatically create user's homepage and/or namespace
https://www.dokuwiki.org/plugin:userhomepage
5 stars 9 forks source link

Add the userpage to the `Last modified by` text #44

Closed Gamemap closed 2 years ago

Gamemap commented 2 years ago

Perhaps this could be included in the documentation. (https://www.dokuwiki.org/plugin:userhomepage#user_links) This code needs to be included in the main.php of the wiki template to add a link at the bottom of the page to the user page of the last editor.

last_modified

Old Code:

<div class="docInfo"> <?php tpl_pageinfo() ?></div>

New Code:

<div class="docInfo">
                <?php
                        if (!plugin_isdisabled('userhomepage')) {
                            $userhomepageHelper = plugin_load('helper','userhomepage');
                        }
                        // If User HomePage helper is loaded, replace standard 'Logged in as...' link (case where one or both pages don't exist is managed by User HomePage helper
                        if ($userhomepageHelper) {
                            $fn = $INFO['filepath'];
                            if(!$conf['fullpath']) {
                                if($INFO['rev']) {
                                    $fn = str_replace($conf['olddir'].'/', '', $fn);
                                } else {
                                    $fn = str_replace($conf['datadir'].'/', '', $fn);
                                }
                            }
                            $fn   = utf8_decodeFN($fn);
                            $date = dformat($INFO['lastmod']);

                            if($INFO['exists']) {
                                $out = '';
                                $out .= '<bdi>'.$fn.'</bdi>';
                                $out .= ' · ';
                                $out .= $lang['lastmod'];
                                $out .= ' ';
                                $out .= $date;
                                if($INFO['editor']) {
                                    $out .= ' '.$lang['by'].' ';
                                    $out .= '<bdi>'.$userhomepageHelper->getAnyPublicLink(editorinfo($INFO['editor'],true)).'</bdi>'; // tpl_pageinfo() mit userhomepage link
                                } else {
                                    $out .= ' ('.$lang['external_edit'].')';
                                }
                                if($INFO['locked']) {
                                    $out .= ' · ';
                                    $out .= $lang['lockedby'];
                                    $out .= ' ';
                                    $out .= '<bdi>'.editorinfo($INFO['locked']).'</bdi>';
                                }
                            }
                            echo $out;
                        } else {
                            tpl_pageinfo();
                        }
                    ?>
                </div>
                <!--<div class="docInfo"> <//?php tpl_pageinfo() ?></div> //This is replaced by all above

The Code is copied from the function tpl_pageinfo() and then modified. ($out .= '<bdi>'.$userhomepageHelper->getAnyPublicLink(editorinfo($INFO['editor'],true)).'</bdi>')

geekitude commented 2 years ago

That's exactly what getAnyPublicLink function was made for but I didn't go deep enough :blush: Thanks for pointing that out 👍

I will very soon build a new helper function to use in place of tpl_pageinfo() rather than adding instructions to documentation.

geekitude commented 2 years ago

Fixed (https://github.com/geekitude/dokuwiki-plugin-userhomepage/commit/3f7c6f6d4d20069748761693db5eefe7bb5fa71e) Added a helper fuction and documentation (https://www.dokuwiki.org/plugin:userhomepage#editor_locker_link) to replace docInfo plain text to display link to editor's (or locker's) public page.

Gamemap commented 2 years ago

Thank you very much!

geekitude commented 2 years ago

You're welcome. Thanks for your ideas.

Le lun. 20 déc. 2021 à 17:51, Gamemap @.***> a écrit :

Thank you very much!

— Reply to this email directly, view it on GitHub https://github.com/geekitude/dokuwiki-plugin-userhomepage/issues/44#issuecomment-998100683, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACA5CCNOCRRL426ATU7ZL3DUR5NK5ANCNFSM5KE4XUBQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you modified the open/close state.Message ID: @.*** com>