diff --git a/inc/display.php b/inc/display.php
index 3d1d6c99..cd2e4a5d 100644
--- a/inc/display.php
+++ b/inc/display.php
@@ -133,13 +133,25 @@
function capcode($cap) {
global $config;
+ if(!$cap)
+ return false;
+
+ $capcode = Array();
if(isset($config['custom_capcode'][$cap])) {
- if(is_array($config['custom_capcode'][$cap]))
- return sprintf($config['custom_capcode'][$cap][0], $cap);
- return sprintf($config['custom_capcode'][$cap], $cap);
+ if(is_array($config['custom_capcode'][$cap])) {
+ $capcode['cap'] = sprintf($config['custom_capcode'][$cap][0], $cap);
+ if(isset($config['custom_capcode'][$cap][1]))
+ $capcode['name'] = $config['custom_capcode'][$cap][1];
+ if(isset($config['custom_capcode'][$cap][2]))
+ $capcode['trip'] = $config['custom_capcode'][$cap][2];
+ } else {
+ $capcode['cap'] = sprintf($config['custom_capcode'][$cap], $cap);
+ }
+ } else {
+ $capcode['cap'] = sprintf($config['capcode'], $cap);
}
- return sprintf($config['capcode'], $cap);
+ return $capcode;
}
function truncate($body, $url, $max_lines = false, $max_chars = false) {
diff --git a/templates/post_reply.html b/templates/post_reply.html
index d14505bd..e01567a2 100644
--- a/templates/post_reply.html
+++ b/templates/post_reply.html
@@ -14,17 +14,17 @@
{# start email #}
{% endif %}
- {{ post.name }}
+ {% set capcode = post.capcode|capcode %}
+ {{ post.name }}
{% if post.trip|length > 0 %}
- {{ post.trip }}
+ {{ post.trip }}
{% endif %}
{% if post.email|length > 0 %}
{# end email #}
{% endif %}
- {% if post.capcode|length > 0 %}
- {# show capcode #}
- {{ post.capcode|capcode }}
+ {% if capcode %}
+ {{ capcode.cap }}
{% endif %}
{% if post.mod and post.mod|hasPermission(config.mod.show_ip, board.uri) %}
[{{ post.ip }}]
diff --git a/templates/post_thread.html b/templates/post_thread.html
index c236fdcc..ad65e6fc 100644
--- a/templates/post_thread.html
+++ b/templates/post_thread.html
@@ -58,17 +58,17 @@
{# start email #}
{% endif %}
- {{ post.name }}
+ {% set capcode = post.capcode|capcode %}
+ {{ post.name }}
{% if post.trip|length > 0 %}
- {{ post.trip }}
+ {{ post.trip }}
{% endif %}
{% if post.email|length > 0 %}
{# end email #}
{% endif %}
- {% if post.capcode|length > 0 %}
- {# show capcode #}
- {{ post.capcode|capcode }}
+ {% if capcode %}
+ {{ capcode.cap }}
{% endif %}
{% if post.mod and post.mod|hasPermission(config.mod.show_ip, board.uri) %}
[{{ post.ip }}]