Advertisement:

Author Topic: Display signatures once only per page  (Read 68572 times)

Offline wing

  • Jr. Member
  • **
  • Posts: 343
    • CarTalkCanada
Display signatures once only per page
« on: October 30, 2005, 10:26:45 AM »
Hi, I thought I would share this small mod.  I noticed my board was getting cluttered by signatures if someone posts ten times in a topic you see their signature 10 times.

So I wrote a quick mod that displays each signature only once per page, the second page of the topic will have the sig again but I wasn't really too concerned abou that and don't think it's worth the effort. 

This was actually really easy to do.  In Display.template.php

find
Code: [Select]
//Show the member's signature?
Before this line add
Code: [Select]
// Show signature only once
               $IDAlreadyDisplayed = 0;
               if (!empty($MemberIDList)) {
                 if (in_array($message['member']['id'], $MemberIDList))
                    $IDAlreadyDisplayed = 1;
               }

Then change
Code: [Select]
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']))
 echo '
                                                        <hr width="100%" size="1" class="hrcolor" />
                                                        <div style="overflow: auto; width: 100%; padding-bottom: 3px;" class="signature">', $message['member']['signature'], '</div>';

to the following:
Code: [Select]
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && !$IDAlreadyDisplayed) {
                        echo '
                                                        <hr width="100%" size="1" class="hrcolor" />
                                                        <div style="overflow: auto; width: 100%; padding-bottom: 3px;" class="signature">', $message['member']['signature'], '</div>';
                $MemberIDList[] = $message['member']['id'];
                } // endif I added the brackets

That is all enjoy!  ;D
« Last Edit: November 06, 2007, 04:11:21 PM by BlackMage »

Offline snork13

  • SMF Friend
  • Sophist Member
  • *
  • Posts: 1,305
  • Gender: Male
  • so little time
    • simplemachines.org
Re: Display signatures once only per page
« Reply #1 on: October 30, 2005, 11:26:52 AM »
works great, thanks for sharing :)

in 1.1rc1 i had to search for

      
Code: [Select]
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']))
echo '
<hr width="100%" size="1" class="hrcolor" />
<div class="signature">', $message['member']['signature'], '</div>';
« Last Edit: October 30, 2005, 11:31:49 AM by snork13 »
Mods
Please DO NOT PM me with requests for individual support, but post your questions and concerns in the appropriate section of the forum where other users can benefit from them as well. Thank you.
I have been super busy as of late. Working on updates to all my modifications for 2.0.1

Offline dcmouser

  • Charter Member
  • Jr. Member
  • *
  • Posts: 187
    • donationcoder.com
Re: Display signatures once only per page
« Reply #2 on: November 02, 2005, 04:51:45 PM »
very clever idea.. thanks for sharing this.

-mouser
 www.donationcoder.com
proud member of donationcoder.com (forum)

Offline c3vettes

  • Semi-Newbie
  • *
  • Posts: 13
  • Gender: Male
    • Carolina Classic Corvettes
Re: Display signatures once only per page
« Reply #3 on: November 08, 2005, 04:06:41 PM »
 :) Sounds perfect. So where's this option located in the cp?
SMF 1.1.5, Subdreamer 2.4 Pro, Coppermine 1.4.10, Flash Chat 4.8.3
www.ncvettes.com [nofollow]
www.cheersdears.com [nofollow]
www.josephcwoodard.com [nofollow]

Offline Tippmaster

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,188
Re: Display signatures once only per page
« Reply #4 on: November 08, 2005, 05:07:27 PM »
it's not an "option"...hence all the code.
The only thing php can't do is tell you how much milk is left in the fridge.



Offline c3vettes

  • Semi-Newbie
  • *
  • Posts: 13
  • Gender: Male
    • Carolina Classic Corvettes
Re: Display signatures once only per page
« Reply #5 on: November 08, 2005, 07:44:21 PM »
it's not an "option"...hence all the code.

I can't find anything relating to signatures, aside from creating one.  Are the existing posts affected, or just the new ones after the code is modded? ???
SMF 1.1.5, Subdreamer 2.4 Pro, Coppermine 1.4.10, Flash Chat 4.8.3
www.ncvettes.com [nofollow]
www.cheersdears.com [nofollow]
www.josephcwoodard.com [nofollow]

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,562
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: Display signatures once only per page
« Reply #6 on: November 08, 2005, 07:47:09 PM »
No there is no administration for this.  Its just a simple change that will do it automatically.  No way to turn it on off install uninstall.  All it does is that instead of displayin you sig everytime you make a reply to a topic it just displays it in your first post or fist page of the topic.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Offline c3vettes

  • Semi-Newbie
  • *
  • Posts: 13
  • Gender: Male
    • Carolina Classic Corvettes
Re: Display signatures once only per page
« Reply #7 on: November 08, 2005, 08:04:41 PM »
OK, tnx...
SMF 1.1.5, Subdreamer 2.4 Pro, Coppermine 1.4.10, Flash Chat 4.8.3
www.ncvettes.com [nofollow]
www.cheersdears.com [nofollow]
www.josephcwoodard.com [nofollow]

Offline wing

  • Jr. Member
  • **
  • Posts: 343
    • CarTalkCanada
Re: Display signatures once only per page
« Reply #8 on: January 26, 2006, 07:07:35 PM »
I was asked to change this a little so I did  :P

The text repeating isn't as much of a concern as images repeating, so I have edited my code to show the signatures more than once but the second time on it only shows the text and not the images.

Code: [Select]
// Show signature only once
               $IDAlreadyDisplayed = 0;
               if (!empty($MemberIDList)) {
                 if (in_array($message['member']['id'], $MemberIDList))
                    $IDAlreadyDisplayed = 1;
               }
                // Show the member's signature?
                if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && !$IDAlreadyDisplayed) {
                        echo '
                                                        <hr width="100%" size="1" class="hrcolor" />
                                                        <div style="overflow: auto; width: 100%; padding-bottom: 3px;" class="signature">', $message['member']['signature'], '</div>';

                                                        $MemberIDList[] = $message['member']['id'];
                } elseif(!empty($message['member']['signature']) && $IDAlreadyDisplayed && empty($options['show_no_signatures'])) {
                                                        $Sig = $message['member']['signature'];
                                                        $tags_to_strip = Array("img");
                                                        foreach ($tags_to_strip as $tag) {
                                                           $Sig = preg_replace("/<\/?" . $tag . "(.|\s)*?>/","",$Sig);
                                                        }
                        echo '
                                                        <hr width="100%" size="1" class="hrcolor" />
                                                        <div style="overflow: auto; width: 100%; padding-bottom: 3px;" class="signature">', $Sig, '</div>';


                }// endif I added the brackets

Offline FBI

  • Semi-Newbie
  • *
  • Posts: 98
  • Great Forum and Free! Its SMF!
Re: Display signatures once only per page
« Reply #9 on: February 04, 2006, 07:55:56 PM »
Its work on RC2. I am using SAFGrey theme.
Thank You :)

Offline yeahimsteve

  • Semi-Newbie
  • *
  • Posts: 31
Re: Display signatures once only per page
« Reply #10 on: March 16, 2006, 04:58:00 AM »
This is totally wonderful.  I too concur that it works very nicely with RC2.  Thank you again!   ;)

Offline carlatf

  • Jr. Member
  • **
  • Posts: 213
  • Gender: Female
    • Buscador de Internet Todalanet
Re: Display signatures once only per page
« Reply #11 on: March 20, 2006, 11:35:24 PM »
Hi,
this is an AWESOME modification, it really cleans up the pages.

A single question, is there a way to modify it to display only one the member location, text, and age?
Is there a way to show only once the title if it's not changed by a user?

best,
Carla

Offline wing

  • Jr. Member
  • **
  • Posts: 343
    • CarTalkCanada
Re: Display signatures once only per page
« Reply #12 on: March 21, 2006, 11:47:01 AM »
Sure anything is "possible".  The thing is you don't want to do too many of these "enhancements" as it will begin to slow down your load times on the pages, you'll also start to suck up memory if you start sorting and checking everything upon display.

Offline loldaolda

  • Semi-Newbie
  • *
  • Posts: 90
  • Gender: Male
    • Unique (not only) schemes for Sony Ericsson W800i | K750i | D750i | K700i
Re: Display signatures once only per page
« Reply #13 on: March 25, 2006, 04:11:08 PM »
Should be built in feature ;)
*hint*hint*

Offline carlatf

  • Jr. Member
  • **
  • Posts: 213
  • Gender: Female
    • Buscador de Internet Todalanet
Re: Display signatures once only per page
« Reply #14 on: March 31, 2006, 07:47:44 PM »
Sure anything is "possible".  The thing is you don't want to do too many of these "enhancements" as it will begin to slow down your load times on the pages, you'll also start to suck up memory if you start sorting and checking everything upon display.
Do you have any idea of how much?
I'd like to delete the avatars and all the user info, if the user posted more than once too.
best,
Carla

Offline wing

  • Jr. Member
  • **
  • Posts: 343
    • CarTalkCanada
Re: Display signatures once only per page
« Reply #15 on: April 01, 2006, 05:40:20 PM »
No idea, but if you know a little php and html you can copy my code and add the avatar stuff as well.

Offline spiketowriss

  • Semi-Newbie
  • *
  • Posts: 39
Re: Display signatures once only per page
« Reply #16 on: April 02, 2006, 05:53:06 PM »
this code is great, thanks! ;)

Offline ivo2296

  • Full Member
  • ***
  • Posts: 514
  • Gender: Male
  • SMF Bulgarian Translator
Re: Display signatures once only per page
« Reply #17 on: April 14, 2006, 10:34:55 PM »
I was asked to change this a little so I did  :P

The text repeating isn't as much of a concern as images repeating, so I have edited my code to show the signatures more than once but the second time on it only shows the text and not the images.

Code: [Select]
// Show signature only once
               $IDAlreadyDisplayed = 0;
               if (!empty($MemberIDList)) {
                 if (in_array($message['member']['id'], $MemberIDList))
                    $IDAlreadyDisplayed = 1;
               }
                // Show the member's signature?
                if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && !$IDAlreadyDisplayed) {
                        echo '
                                                        <hr width="100%" size="1" class="hrcolor" />
                                                        <div style="overflow: auto; width: 100%; padding-bottom: 3px;" class="signature">', $message['member']['signature'], '</div>';

                                                        $MemberIDList[] = $message['member']['id'];
                } elseif(!empty($message['member']['signature']) && $IDAlreadyDisplayed && empty($options['show_no_signatures'])) {
                                                        $Sig = $message['member']['signature'];
                                                        $tags_to_strip = Array("img");
                                                        foreach ($tags_to_strip as $tag) {
                                                           $Sig = preg_replace("/<\/?" . $tag . "(.|\s)*?>/","",$Sig);
                                                        }
                        echo '
                                                        <hr width="100%" size="1" class="hrcolor" />
                                                        <div style="overflow: auto; width: 100%; padding-bottom: 3px;" class="signature">', $Sig, '</div>';


                }// endif I added the brackets

Works perfect on smf 1.0.7

Thanks a lot!

Offline MothMan

  • Jr. Member
  • **
  • Posts: 212
Re: Display signatures once only per page
« Reply #18 on: November 22, 2006, 04:22:18 PM »
If I understand the code correctly, it sets the signature to only display in the first post by that member, on that page.

Could it be modified to only show the signature on the LAST post by that member, on that page?

Offline wing

  • Jr. Member
  • **
  • Posts: 343
    • CarTalkCanada
Re: Display signatures once only per page
« Reply #19 on: December 06, 2006, 09:59:03 PM »
Ouch that would be tough.....  ???  I don't think so...