vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Signature "Line Limiter" (https://vborg.vbsupport.ru/showthread.php?t=67111)

tHe Rk 07-12-2004 11:10 PM

Signature "Line Limiter"
 
Hello all,



I have looked everywhere on all the big hack sites and I can NOT find a hack that allows one to limit signatures based on "Lines" rather than characters. I remember having a hack for it in vB2, but can't seem to find one for vB3. I have seen the other hack that is a "pixel" based limiter, and that's not really what I am looking for. Just a simple Sigs cannot exceed 7 Lines. or 10 lines, or 5 or whatever we would decide to choose. Does anyone know how to do this or where to find the hack?



FYI...running 3.0.1 Thanks.

I posted at vb.com and they sound there isn't currently a way to do it, and it has to be hacked. I have looked everywhere including here, and havn't found a hack yet, so I figured I could request one. Thanks!

Berethorn 07-12-2004 11:14 PM

Great idea! I would guess it should be a fairly easy hack. :)

Andreas 07-12-2004 11:40 PM

This is what I did on our board several month ago (moreless copy&paste, hope it does work)
  1. Create the following phrase in phrasegroup Front-End Error Messages
    varname = sigtoomanylines
    text = Your signature can not be longer than $vboptions[maxsiglines] lines.
  2. In vBulletin Options/User Profile Options create the following setting:
    varname = maxsiglines
    title = Maximum signature lines
    description = The maximum number of lines anyone can use in their signature.
    default = 4
    vBulletin Standard = No
  3. In profile.php FIND
    PHP Code:

    if ($vboptions['maximages'] != 0)
    {
      require_once(
    './includes/functions_bbcodeparse.php');
      
    $parsedsig parse_bbcode($signature0$vboptions['allowsmilies'], 1); 

    REPLACE that with
    PHP Code:

    if ($vboptions['maxsiglines'] != 0) {
      require_once(
    './includes/functions_misc.php');
      require_once(
    './includes/functions_bbcodeparse.php');
      
    $parsedsig parse_bbcode($signature0$vboptions['allowsmilies']);
      
    $siglines 0;
      
    $siglines += fetch_character_count($parsedsig'<br');
      
    $siglines += fetch_character_count($parsedsig'<blockquote');
      
    $siglines += fetch_character_count($parsedsig'<pre');
      if (
    $siglines $vboptions[maxsiglines]-1) {
        
    $preview 'true';
        eval(
    '$errors[] = "' fetch_phrase('sigtoomanylines'PHRASETYPEID_ERROR) . '";');
      }
    }

    if (
    $vboptions['maximages'] != 0)
    {
      if (!
    $parsedsig) {
        require_once(
    './includes/functions_bbcodeparse.php');
        
    $parsedsig parse_bbcode($signature0$vboptions['allowsmilies'], 1);
      } 


rexlu 07-15-2004 07:35 AM

excuse me..

How to do the 2nd step?

Quote:

2. In vBulletin Options/User Profile Options create the following setting:
varname = maxsiglines
title = Maximum signature lines
description = The maximum number of lines anyone can use in their signature.
default = 4
vBulletin Standard = No

-mk- 07-15-2004 09:36 AM

You need to turn debug on.

I just get parse errors anyway.
Quote:

if ($siglines > $vboptions[maxsiglines]-1)) {

Andreas 07-15-2004 10:22 AM

Remove the 2nd closing bracket, was a typo. Sorry.

rexlu 07-16-2004 04:26 AM

um.. I still getting error ..

Fatal error: Call to undefined function: fetch_character_count() in /home/nonoboar/public_html/bbs/profile.php on line 1333

Andreas 07-16-2004 10:46 AM

Oops! Didn't notice that I required functions_misc earlier in profile.php, so this is missing here:

Put
PHP Code:

require_once('./includes/functions_misc.php'); 

after the first if-condition.

Boofo 07-16-2004 01:35 PM

Will this work with any other sig limiting hacks like the image size limiter released a while back? Or will they end up fighting with one another? ;)

Andreas 07-16-2004 01:46 PM

Well ... don't really know, but should work.
Just try it ^.^

paulyy 07-17-2004 02:52 AM

I don't understand number 2, or how to turn debug on?

Can someone explain this a little better please.

assassingod 07-17-2004 07:45 AM

To turn on Debug Mode, open includes/config.php and find:
PHP Code:

$cookieprefix 'bb'

Beneath that, add
PHP Code:

// Debug Mode, 1 on 0 off
$debug '1'

I suggest turning this off when you're finished as well.

royals 07-17-2004 08:29 AM

Is there a way to put in a maximum image size if images are allowed in signature? That would be WONDERFUL!

paulyy 07-17-2004 04:30 PM

Thanks Assassingod :)

paulyy 07-17-2004 04:56 PM

This code stops the viewing of sigantures completely?

EDIT: Nevermind yes it does

tHe Rk 07-17-2004 06:17 PM

Quote:

Originally Posted by KirbyDE
This is what I did on our board several month ago (moreless copy&paste, hope it does work)
  1. Create the following phrase in phrasegroup Front-End Error Messages
    varname = sigtoomanylines
    text = Your signature can not be longer than $vboptions[maxsiglines] lines.
  2. In vBulletin Options/User Profile Options create the following setting:
    varname = maxsiglines
    title = Maximum signature lines
    description = The maximum number of lines anyone can use in their signature.
    default = 4
    vBulletin Standard = No
  3. In profile.php FIND
    PHP Code:

    if ($vboptions['maximages'] != 0)
    {
      require_once(
    './includes/functions_bbcodeparse.php');
      
    $parsedsig parse_bbcode($signature0$vboptions['allowsmilies'], 1); 

    REPLACE that with
    PHP Code:

    if ($vboptions['maxsiglines'] != 0) {
      require_once(
    './includes/functions_misc.php');
      require_once(
    './includes/functions_bbcodeparse.php');
      
    $parsedsig parse_bbcode($signature0$vboptions['allowsmilies']);
      
    $siglines 0;
      
    $siglines += fetch_character_count($parsedsig'<br');
      
    $siglines += fetch_character_count($parsedsig'<blockquote');
      
    $siglines += fetch_character_count($parsedsig'<pre');
      if (
    $siglines $vboptions[maxsiglines]-1) {
        
    $preview 'true';
        eval(
    '$errors[] = "' fetch_phrase('sigtoomanylines'PHRASETYPEID_ERROR) . '";');
      }
    }

    if (
    $vboptions['maximages'] != 0)
    {
      if (!
    $parsedsig) {
        require_once(
    './includes/functions_bbcodeparse.php');
        
    $parsedsig parse_bbcode($signature0$vboptions['allowsmilies'], 1);
      } 


I also have NO IDEA how to do #2??? :ermm:

Andreas 07-17-2004 06:38 PM

Turn on Debug mode, go into that Options Page and Create the Setting.

I think "How do I create a new setting" should be added to vB.org FAQ (if it is not already there), as this is a common task ;)

paulyy 07-17-2004 07:01 PM

On the first page of this thread assassingod explains how to do it ;)

I also got it working on my forum, so if you need a hand PM me :)

Illuvatar 08-14-2004 02:55 AM

[high]* Illuvatar bows low!
[/high]

KirbyDE.....you so rock!!

This has been a pain in my side since version 2.0!! lol

The old sig hack was easily worked around by not using line breaks, and what you did works a charm!! :)

I wish I could click installed! :p

Lion's Heart 08-14-2004 03:56 AM

Quote:

I also have NO IDEA how to do #2???
Open Config.php
After ?>
Add Debug=1;


do follow
Quote:

In vBulletin Options/User Profile Options create the following setting:
varname = maxsiglines
title = Maximum signature lines
description = The maximum number of lines anyone can use in their signature.
default = 4
vBulletin Standard = No

Cyn 01-05-2005 01:00 PM

I had no problem following all the steps but it's not limiting signatures to two lines for me. I logged into one of our test accounts and was able to place several sentences in that account's signature (no carriage returns) that far exceeded two lines, which is the limit I set in the new profile option. Can someone help me figure it out please? :nervous:

Andreas 01-11-2005 07:13 PM

Well, if there are no line-breaks it is just one line - even if it is displayed in more then 1 line on your screen (which just means that it is not wide enough ;))

Or in other words: It is not possible to determine which text length is "one line", as this depends on screen width.

The only way would to specify what "one line" shold be is to specify that it should be max. xx characters.
But one has to keep in mind that if this is based on a 1024x768 resolution, it will be much less then "one line" for somebody using 1600x1200 for example.

Cyn 01-11-2005 07:58 PM

Quote:

Originally Posted by KirbyDE
Well, if there are no line-breaks it is just one line - even if it is displayed in more then 1 line on your screen (which just means that it is not wide enough ;))

Or in other words: It is not possible to determine which text length is "one line", as this depends on screen width.

The only way would to specify what "one line" shold be is to specify that it should be max. xx characters.
But one has to keep in mind that if this is based on a 1024x768 resolution, it will be much less then "one line" for somebody using 1600x1200 for example.

And on top of it all the character count does include vb code. So formatting text such as [ and color= and url= and font=squiggly and such are all included, cheating the true displayed character count.

*Sigh* I wish I could find a reasonble solution to this.

Andreas 01-11-2005 08:08 PM

Well, one could strip the code before checking the length :)

Cyn 01-11-2005 08:10 PM

How would one do that?

Andreas 01-11-2005 08:18 PM

PHP Code:

$length vbstrlen(strip_bbcode($inputtrue)) 


Cyn 01-11-2005 08:31 PM

Great! Where would I place that?

Illuvatar 01-12-2005 02:18 AM

Yea...I've ran into the same issue. :( Without a character count restriction, you can cut and paste a whole paragraph into the siggy and get away with it. lol

We currently have our character limit set to 500, and we may have to go smaller.

Cyn 01-12-2005 06:56 PM

Kirby, I have a thought that perhaps you can help with. Could this be applied to the existing setup for the signature character limit feature in vB3? That way I could place a character limit that would count only the true characters and ignore vBcode. Is it possible to place this same code somewhere to have that effect in the character count?

JimF 01-15-2005 07:19 AM

This little mod combined with this one is a very good thing :).


All times are GMT. The time now is 10:18 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01375 seconds
  • Memory Usage 1,826KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (30)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete