News:

Wondering if this will always be free?  See why free is better.

Main Menu

restrict signature size by membergroups?

Started by starkfu, October 16, 2007, 08:12:09 PM

Previous topic - Next topic

starkfu

Has anyone accomplished this?

I am currently trying to apply the code for board level restriction on signatures to be controlled per membergroup in the "edit membergroups" section of admin.  So that membergroups can have different size signatures.

I will continue to push on, and post what I come up with, but if anyone has accomplished this, please drop me some hints.

Thanks,

~Starkfu
*RTFM*

starkfu

I would even be satisfied with maybe a little guidance on membergroup specific limitations.

I am guessing I can que the database for the membergroup # assigned, but am confused on where my character limitation number would be stored, perhaps another entry into the membergroups table in the database for character limits to be stored?  Then call it into the spot where the board normally limits the signatures?

It makes sense in my head, but I guess I need to learn more about the methods used by the board.
*RTFM*

starkfu

So far:

I added a field to smf_membergroups called signaturelength.

I was able to code the template for an input box that would input to that field of the database.

I am trying to now figure out where I can call this value back and integrate into the code that limits the signatures of everyene through admin settings.

So what I found was in profile.php

// Make sure the signature isn't too long.
   if (isset($_POST['signature']))
   {
      require_once($sourcedir . '/Subs-Post.php');

      if (!empty($modSettings['max_signatureLength']) && $func['strlen']($_POST['signature']) > $modSettings['max_signatureLength'])
         $_POST['signature'] = addslashes($func['substr'](stripslashes($_POST['signature']), 0, $modSettings['max_signatureLength']));

      if (strlen($_POST['signature']) > 65534)
         $_POST['signature'] = addslashes($func['truncate'](stripslashes($_POST['signature']), 65534));

      $_POST['signature'] = strtr($_POST['signature'], array('"' => '\\"', ''' => '\\'', ''' => '\\''));
      preparsecode($_POST['signature']);
   }


So I want to know how I can call my per membergroup value and insert it to limit the characters in the signature?
*RTFM*

starkfu

after more research, it looks as though I can leave the code alone in the profile.php and just modify the db_request in modsettings.php to call the membergroup specific character limit and not the board's general one.

If I can get this all completed, I will package it up and try to submit it as a mod.

Is there any headway with the mod SDK - It appeared to be missing from the discussion thread.

Can some one clarify that for me please?
*RTFM*

starkfu

ok,

last attempt, I could really use a hint or some help.

I have added a field to the database smf_membergroups to hold the (int) for signature limit in characters.  I am good on the templates and sources to add the value into the database, now I want to que the value in the db and insert it into this code located in sources/profile.php
if (!empty($modSettings['max_signatureLength']) && $func['strlen']($_POST['signature']) > $modSettings['max_signatureLength'])
         $_POST['signature'] = addslashes($func['substr'](stripslashes($_POST['signature']), 0, $modSettings['max_signatureLength']));


I think that before the ">" sign I can add my argument, but am unsure of the best way to que the database and insert my argument.

Any help is greatly appreciated.
*RTFM*

Advertisement: