[geeklog-cvs] geeklog: Fix #0001081: Introduce a [user:] autotag to link to a ...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Thu Mar 18 13:24:34 EDT 2010


changeset 7807:e0bb8af6438f
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/e0bb8af6438f
user: Akeda Bagus <admin at gedex.web.id>
date: Wed Mar 17 02:03:41 2010 +0700
description:
Fix #0001081: Introduce a [user:] autotag to link to a user's profile

diffstat:

 system/lib-plugins.php |  17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diffs (34 lines):

diff -r 4fbe29eb965c -r e0bb8af6438f system/lib-plugins.php
--- a/system/lib-plugins.php	Wed Mar 17 03:28:40 2010 +0700
+++ b/system/lib-plugins.php	Wed Mar 17 02:03:41 2010 +0700
@@ -1485,7 +1485,9 @@
 
     // Determine which Core Modules and Plugins support AutoLinks
     //                        'tag'   => 'module'
-    $autolinkModules = array('story' => 'geeklog');
+    $autolinkModules = array(
+        'story' => 'geeklog', 'user' => 'geeklog'
+    );
 
     foreach ($_PLUGINS as $pi_name) {
         $function = 'plugin_autotags_' . $pi_name;
@@ -1604,6 +1606,19 @@
                         }
                     }
                 }
+                
+                if ($autotag['tag'] == 'user') {
+                    $autotag['parm1'] = addslashes($autotag['parm1']);
+                    if (! empty($autotag['parm1'])) {
+                        $sql = "SELECT uid, fullname FROM {$_TABLES['users']} WHERE username = '{$autotag['parm1']}'";
+                        $result = DB_query( $sql );
+                        $A = DB_fetchArray( $result );
+                        $url = $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'];
+                        if (empty($linktext)) {
+                            $linktext = COM_getDisplayName( $A['uid'], $autotag['parm1'], $A['fullname'] );
+                        }
+                    }
+                }
 
                 if (!empty($url)) {
                     $filelink = COM_createLink($linktext, $url);



More information about the geeklog-cvs mailing list