function signature_forum_pre_render_user_signature in Signatures for Forums 7
Prerender function for user signatures.
Decide if a signature is displayed or not by setting #printed and change the signature markup that is in #signature.
Available variables: #signature, #content_length, #node, #comment, #user.
2 string references to 'signature_forum_pre_render_user_signature'
- signature_forum_comment_view in ./
signature_forum.module - Implementation of hook_comment_view().
- signature_forum_node_view in ./
signature_forum.module - Implementation of hook_node_view().
File
- ./
signature_forum.module, line 680 - Tweaks signatures in ways inspired by other traditional forum software:
Code
function signature_forum_pre_render_user_signature($element) {
static $show_once_cache = array();
$uid = $element['#user']->uid;
// Apply show once setting.
$show_once = variable_get('signature_forum_show_once_options', SIGNATURE_FORUM_SHOW_ALWAYS) == SIGNATURE_FORUM_SHOW_ONCE;
if ($show_once) {
if (isset($show_once_cache[$uid])) {
if ($show_once_cache[$uid] == TRUE) {
$element['#printed'] = TRUE;
}
}
else {
}
}
// Apply short content action.
$short_content_action = variable_get('signature_forum_short_content_action', SIGNATURE_FORUM_DO_NOTHING);
if (empty($element['#printed']) && $short_content_action != SIGNATURE_FORUM_DO_NOTHING) {
if ($element['#content_length'] < variable_get('signature_forum_short_content_length', 0)) {
if (!_signature_forum_user_exception($element['#user'], 'short_content')) {
switch ($short_content_action) {
case SIGNATURE_FORUM_DO_NOT_DISPLAY:
$element['#printed'] = TRUE;
break;
case SIGNATURE_FORUM_ADDITIONAL_FILTER_FORMAT:
$element['#signature'] = check_markup($element['#signature'], variable_get('signature_forum_short_content_format'), '', TRUE);
break;
}
}
}
}
// Set the cache, to show signatures only once.
if ($show_once && !isset($show_once_cache[$uid])) {
if (empty($element['#printed'])) {
$show_once_cache[$uid] = !_signature_forum_user_exception($element['#user'], 'show_once');
}
}
return $element;
}