News:

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

Main Menu

Display signatures once only per page

Started by wing, October 30, 2005, 10:26:45 AM

Previous topic - Next topic

Nifelhein

#20
If you are using SMF 1.1 Final the changes are fairly minor, but sicne there are some, just find
// Show the member's signature?
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>';


And change it to:
// 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 class="signature">', $message['member']['signature'], '</div>';
                $MemberIDList[] = $message['member']['id'];
                } // endif I added the brackets

MothMan

I'd still LOVE to be able to ahve this altered to only show the display on the FINAL occurence of that poster on the page, not the first....

I don't know if this would be of any help to anyone... I don't understand most of this coding stuff... but we had a hack on a Proboard forum that did this (showed the sig. once per user per page, on that users FINAL post in the page.

I know the coding is all different... but wondered if maybe posting the hack that worked for Proboards might twig someones mind into a way for it to work for SMF?

The hack for Proboards is:

<script type="text/javascript">
<!--
/* only show last occurance of a signature on each page - ross*/
if(location.href.match(/ion=(display|gotopost)/)) {
var td = document.getElementsByTagName('td');
var us = [];
for(i=td.length-1; i>4; i--) {
if(td.item(i).colSpan == '3' && td.item(i).vAlign == 'bottom') {
var username = td.item(i).parentNode.parentNode.parentNode.parentNode.parentNode.getElementsByTagName('a').item(1).href.split(/user=/)[1];
if(us[username])
td.item(i).lastChild.style.display = 'none';
us[username] = 'true';
}
}
}
//-->
</script>

wing

I can think of a few ways to do this.

1) Determine # of posts per page from variable.  Then Scan through that many posts and count up each user.  Then on X post from that user only put their signature (slow but saves memory)

2) Follow the same way SMF does it now, which is output one post at a time in a loop except instead of actually outputting to the screen put it into a variable, and do not output to screen.  Once the page is ready to go, go back through your stored arrays and clean up the signatures. (memory hog but might be slightly faster since you do not have to read the database more than once).

Both are not the best solutions, maybe someone has another idea.

MothMan

Any more ideas on this?  (modifying to display the signature in the users *last* post on the page)

-megalithanod

Hopefully this isn't changing the direction of the thread since it has morphed into a request for the sig to show on the last post.....but as with many I am new to SMF and have a question on the original code change.

I have no issue putting this into the default view, but what is the procedure if you don't have a display.template.php for a certain theme you have chosen as a default for your board?  I have used the BlackRain theme as a starter, which doesn't contain a Display.Template.php file in the theme, although I do see one in the default theme.  Changing this doesn't affect the theme until I copy it into the BlackRain theme folder, but then all the button and layout settings are changed to those of the default (as I would expect).

Am I missing something or where to look to see where to apply this for all themes, or for one that doesn't have the needed template file?  I am hoping not to have to create a template for the theme settings as I do like the layout on this one and would hate to have to recreate it from scratch.

Thanks in advance for your patience

-megalithanod

my apologies for jumping the gun and posting on this one.  I found the display.template.phpo in the classic theme was driving the display and have copied it into the theme I use, making the modification there.

aglioeolio

nice Mod, it' s really useful to clean up things in topic



Sapphire_H

Thanks much for this mod - and for the update for 1.1.1 - works perfectly!!  VERY glad I didn't have to give this one up when I upgraded!

c3vettes

SMF 1.1.5, Subdreamer 2.4 Pro, Coppermine 1.4.10, Flash Chat 4.8.3
www.ncvettes.com
www.cheersdears.com
www.josephcwoodard.com

Con

I can't find //Show the member's signature?
that line in the file..
and if it helps, I'm using a template named black22

icman

Show PageRank On Your site

http://meelink.com/Google-PageaRank-Indicator.php
Webmaster & SEO Tools Top google make it esay
http://www.meelink.com
Php website
http://www.mindphp.com
My Forum site witch ptc
http://ptc.icphysics.com/webboard/SFM/index.php
Thailand Domain Company Search
http://thaiwebdirectories.meelink.com

TrueSatan

 Thanks for this code...very useful!

It seems to me that it deserves to be used rather more often and thus to be a packaged mod...seeing as wing has been good enough to do all the coding the least I can do is to do the packaging of it...herewith both versions...the original that removes the signature text and the later one that removes the images...

http://www.mediafire.com/?2z2ayndfjhi SMF_Display_Images_In_Signatures_Only_Once_Per_Page_v1.1.zip

http://www.mediafire.com/?2jdn5gde2od SMF_Display_Signatures_Only_Once_Per_Page_v1.1.zip

Perhaps wing might consider adding one or other or both to the mods list...or give permission for them to be added.

Nifelhein

This really should be a built-in option heh.

TrueSatan

 One person's must have can be another person's clutter...so long as it's readily available as a mod I don't see that we have to worry too much.

BTW the packages are for SMF 1.1.1 and 1.1.2

Nifelhein

Well, options are often a great thing, and having it as a mod is truly enough for me. ;)

Diablo1880

Hi I tried the code changes suggested in this topic and for some reason it just doesn't work :(  I've applied the changes to the main and only theme Display.template.php as well as the default Display.template.php and it is not taking effect (images appearing more than once on a page)

I tried the packages and it returns a installation error when I try to install them.

I am running 1.1.2 SMF.

Thanks

TrueSatan

Perhaps you would quote the installation error and any error log item relevant to the mod...the information you've given isn't enough to work out what the problem might be.

Diablo1880

Okay sorry, i presume its a standard error you recieve when a package reports installation errors

Error in Package Installation
At least one error was encountered during a test installation of this package. It is strongly recommended that you do not continue with installation unless you know what you are doing, and have made a backup very recently. This error may be caused by a conflict between the package you're trying to install and another package you have already installed, an error in the package, a package which requires another package that you don't have installed yet, or a package designed for another version of SMF.


Installing this package will perform the following actions:
Type Action Description
1. Execute Modification ./Themes/default/Display.template.php Test failed


It throws no php errors but at the same time it doesn't actually have any effect.

TrueSatan

LOL this isn't a problem with the mod at all! You need to do a manual install as some other mod appears to have already altered the files this mod seeks to alter. Do a search for manual install if you need details on how to do it.

metallica48423

Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Advertisement: