You are here

function signature_forum_logic in Signatures for Forums 5

Signature logic, check content is long enough etc.

Parameters

&$signature: Signature text.

$uid: User ID.

$content_length.:

2 calls to signature_forum_logic()
signature_forum_comment in ./signature_forum.module
Implementation of hook_comment().
signature_forum_nodeapi in ./signature_forum.module
Implementation of hook_nodeapi().

File

./signature_forum.module, line 330

Code

function signature_forum_logic(&$signature, $uid = 0, $content_length = 0) {
  $settings = variable_get('signature_forum_settings', signature_forum_defaults());

  // Content minimum length not set, is longer than minimum or the user has a role that is an exception
  if ($content_length >= $settings['signature_forum_min_content_length'] || signature_forum_user_exception($uid)) {
    $signature = check_markup($signature, $settings['signature_forum_format']);
    $signature = trim(sprintf("\n" . $settings['signature_forum_template'], $signature));
    return;
  }
  elseif ($settings['signature_forum_min_content_length_action'] == MIN_CONTENT_ACTION_DO_NOT_DISPLAY) {
    $signature = '';
    return;
  }
  else {
    $signature = check_markup($signature, $settings['signature_forum_format']);
    $signature = check_markup($signature, $settings['signature_forum_min_content_length_filter']);
    $signature = trim(sprintf("\n" . $settings['signature_forum_template'], $signature));
    return;
  }
}