Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Rohan_ on July 10, 2009, 04:34:51 PM

Title: Disable Signature in Post
Post by: Rohan_ on July 10, 2009, 04:34:51 PM
hi .. i want a option of disable signature in this post .. for not to show the user signature in the post when the option was selected by the users
Title: Re: Disable Signature in Post
Post by: kat on July 10, 2009, 04:51:27 PM
It's in your profile, under "Look and Layout Preferences".

Or, do you mean only in certain places?

If so, I'd imagine that'd need coding and I doubt it'd be too easy.
Title: Re: Disable Signature in Post
Post by: Rohan_ on July 10, 2009, 05:52:49 PM
ya i want it disable for the post that user selects in . like in additional options when we post :) like dont use smileys in additional options .. i want a option dont use signature in additional options :)
Title: Re: Disable Signature in Post
Post by: kat on July 10, 2009, 06:09:17 PM
Might be best to post in the coding board, then.  :)
Title: Re: Disable Signature in Post
Post by: babjusi on July 10, 2009, 06:15:14 PM
Have a look at this mod. It might be useful for what you want.

http://custom.simplemachines.org/mods/index.php?mod=1242
Title: Re: Disable Signature in Post
Post by: Rohan_ on July 11, 2009, 05:19:39 AM
no no babjusi that not ok .. i want a option in additional options or in quick reply of disable signature in this post ...i want this option given to all the users that have signature permission .... example : don't use smileys in our additional options when we post :D
Title: Re: Disable Signature in Post
Post by: babjusi on July 11, 2009, 07:10:52 AM
Quote from: Rohan_ on July 11, 2009, 05:19:39 AM
no no babjusi that not ok .. i want a option in additional options or in quick reply of disable signature in this post ...i want this option given to all the users that have signature permission .... example : don't use smileys in our additional options when we post :D

Ah I see. Something like that would require some tweaking. As Kat said above, try to post at the coding board.
Title: Disable Signature in Post
Post by: Rohan_ on July 11, 2009, 08:22:38 AM
hi .. i want a option of disable signature in this post .. for not to show the user signature in the post when the option was selected by the users ........

i want a option in additional options or in quick reply of disable signature in this post ...i want this option given to all the users that have signature permission .... example : don't use smileys in our additional options when we post
Title: Re: Disable Signature in Post
Post by: Rohan_ on July 11, 2009, 08:23:15 AM
can u do something ??
Title: Re: Disable Signature in Post
Post by: babjusi on July 11, 2009, 08:29:57 AM
Quote from: Rohan_ on July 11, 2009, 08:23:15 AM
can u do something ??

Atm my free time is very limited Rohan_, sorry.
Title: Re: Disable Signature in Post
Post by: Rohan_ on July 11, 2009, 08:38:52 AM
can anyone help me ?? i dont think its hard to do for you ..
Title: Re: Disable Signature in Post
Post by: Arantor on July 11, 2009, 09:09:25 AM
Like several of the modifications you've requested, this is not a simple or quick modification, requiring database schema changes, changes to the core sources and theme modifications.

As and when people can get round to this, someone will for you.
Title: Re: Disable Signature in Post
Post by: Rohan_ on July 11, 2009, 12:01:30 PM
Okay Arantor ill wait here :)
Title: Re: Disable Signature in Post
Post by: catfished on July 11, 2009, 06:19:00 PM
Well, I sure hope someone figures it out. It's standard with VBulletin and MyBB for sure. Could be in other forum software as well, not sure.

Here's how it looks in MyBB:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fcatfished.com%2Fsigopt.jpg&hash=d75f51984a62950b403aa5064dfe6dc0f7270b34)
Title: Re: Disable Signature in Post
Post by: Rohan_ on July 11, 2009, 07:06:34 PM
ya its in vb .. i ask coz i also have a vb site
Title: Re: Disable Signature in Post
Post by: SoLoGHoST on July 11, 2009, 07:16:09 PM
I'm busy working on another MOD at the moment, but despite what others may say, this is a fairly simple edit...  Create a variable that says true or false in Post.php where the post gets created, believe it is in the Post function, set it in the Post2 function, and call this variable in Display.php, then in Display.template.php, output the signature based on whether it is set to true or false...

Well, like I said, currently busy, but those are the steps.  Will hopefully get around to this if I ever finish this other MOD I'm currently working on.
Title: Re: Disable Signature in Post
Post by: Arantor on July 11, 2009, 08:15:39 PM
And where is that value stored for others to see/not see it? Yes, it's in the Post2 function that it would be stored - but it has to be stored somewhere so that Display.template.php can know not to do it.

So while it isn't a huge mod - you still have to store that value somewhere, which means you have to either attach it to the end of the post somehow, or you modify the schema to add a 'do not add signature to this post' flag.
Title: Re: Disable Signature in Post
Post by: Windy on July 11, 2009, 09:01:48 PM
I wouldn't see this as being too difficult either, the easiest thing imo would just be to duplicate the don't use smilies code and just make sure to pass the value to the output array.
Title: Re: Disable Signature in Post
Post by: Arantor on July 11, 2009, 09:38:36 PM
So you have to modify the structure of smf_messages to do that - just as there is a column for smileysEnabled.
Title: Re: Disable Signature in Post
Post by: Kays on July 11, 2009, 09:52:26 PM
Check out this mod, I think it's what you're looking for.

http://custom.simplemachines.org/mods/index.php?mod=409
Title: Re: Disable Signature in Post
Post by: catfished on July 11, 2009, 10:37:25 PM
Quote from: Kays on July 11, 2009, 09:52:26 PM
Check out this mod, I think it's what you're looking for.

http://custom.simplemachines.org/mods/index.php?mod=409

Thanks but unfortunately it's not like the ones in other forum software. I installed it in one of my 1.1.9 forums using the default theme. It allows you to check the box to include a sig but it can't be changed by modifying/editing the post. Also the sig is no longer automatically included in your posts. You have to tick the box to show the sig or else it defaults to no sig.
Title: Re: Disable Signature in Post
Post by: SoLoGHoST on July 12, 2009, 04:11:35 AM
Quote from: Arantor on July 11, 2009, 08:15:39 PM
And where is that value stored for others to see/not see it? Yes, it's in the Post2 function that it would be stored - but it has to be stored somewhere so that Display.template.php can know not to do it.

So while it isn't a huge mod - you still have to store that value somewhere, which means you have to either attach it to the end of the post somehow, or you modify the schema to add a 'do not add signature to this post' flag.

you can use the same array that gets used for attachments in Display.php:  $message, and then do a foreach on $message where the signature gets put in Display.template.php:

foreach ($message['signature'] as $signature)
   if ($signature)
     // show it


You can use the output array from the Main function in Display.php, which gets returned to Load a SignatureContext from this, and either load the signature or return false...

For Example in Display.php (Display() Function):

// Compose the memory eat- I mean message array.
$output = array(
'attachment' => loadAttachmentContext($message['id_msg']),

Just Add...

'signature' => loadSignatureContext($message['id_msg']),


and then in the loadSignatureContext($id_msg) function that you will create, get the $user_info['id'] and determine if the signature should be displayed or not.  You can look at how the loadAttachmentContext() function does this, however, you will not need to make an array in this function since you are dealing with only 1 signature.  Attachments deal with 1 or more, so this is why it creates an array and applies a for each on the array in the loadAttachmentContext() function.

Anyways, I'm not trying to get involved with this MOD, as I said, I have my MASTERPIECE MOD almost complete!!  It's going to be a big hit for sure!

Good Luck!
Title: Re: Disable Signature in Post
Post by: Rohan_ on July 12, 2009, 04:34:04 AM
so what now ?? tell me exactly what i need to do ?
Title: Re: Disable Signature in Post
Post by: SoLoGHoST on July 12, 2009, 08:17:33 PM
Ok, my bad, just looked at it again, and you will not need this in Display.template.php

foreach ($message['signature'] as $signature)
   if ($signature)
     // show it

a simple if ($message['signature']) will do it or if (!empty($message['signature']))

You will need to define as $global variable in the following functions Post() <- may not need it here, Post2() <- may not need it here either, loadSignatureContext() <-- Definitely Need it here, and Display() <-- Definitely Need it here, as this is how the global $attachments is done.  Now look at what variable is used to show the signature currently, should be something like:  $message['member']['signature'] or something like this in Display.template.php.  Look for where this gets defined in Display.php (most likely in Display() function), use the same definition to define the global variable in loadSignatureContext() function.  Create a checkbox in Display.template.php (give it a name so you can access it and determine if it is set ( if (isset('checkbox_name'))) in the Post2() function).  Set $message['signature'] = loadSignatureContext($id_msg) again in the Post2() function if it is set, otherwise $message['signature'] = '';, or maybe just try:  $message['signature'] = true or false.  If you have your loadSignatureContext function working properly, you should be able to just set this to either true or false and it should do it just fine.

But like I said, not trying to get involved with exact code to give you, as this is something that you can do yourself, and I'm currently busy with a MOD on my hands, taking all of my time atm.

Just know that this is the way to do this!  Create a test board and have a go with it, try everything that I mentioned, and be persistent, you'll get it.

Cheers!
Title: Re: Disable Signature in Post
Post by: Rohan_ on July 13, 2009, 03:48:59 AM
hey i am not a coder please tell me the exact replacements to do with my files
Title: Re: Disable Signature in Post
Post by: [SiNaN] on July 13, 2009, 01:11:43 PM
The mod linked here does what you are trying to achieve:

Quote from: Kays on July 11, 2009, 09:52:26 PM
Check out this mod, I think it's what you're looking for.

http://custom.simplemachines.org/mods/index.php?mod=409

Quote from: catfished on July 11, 2009, 10:37:25 PM
Thanks but unfortunately it's not like the ones in other forum software. I installed it in one of my 1.1.9 forums using the default theme. It allows you to check the box to include a sig but it can't be changed by modifying/editing the post. Also the sig is no longer automatically included in your posts. You have to tick the box to show the sig or else it defaults to no sig.

There is an option to enable it by default in Admin > Features and Options > Layout > Show Signature Checked?.

For editing, you want to try requesting it from the mod author.
Title: Re: Disable Signature in Post
Post by: Rohan_ on July 13, 2009, 01:58:00 PM
ohh yeahh Sinan u have done it friend .. its solved .. its nothing and the people is taking too hard .. but my sources/display.php gave me a problem so i edited it manually :) thanks a lot everyone for help