Please upgrade here. These earlier versions are no longer being updated and have security issues.

Howto: make each user's signature only appear once per page

This discussion is related to the Signatures addon.

This is quite a simple change for the Signatures plugin:

Find the _DrawSignature function.

The last statement in the function should be:

echo $Display;

Add two lines above that:

// Ensure sig only renders once for each user
unset($UserSignatures[$SourceUserID]);
$Sender->SetData('Plugin-Signatures-UserSignatures', $UserSignatures);

This will unset the user's signature from the signature cache after the first time it is rendered on the page.

Hope someone finds it useful!

Tagged:
hgtonightperegrinevrijvlindermirX

Comments

  • hgtonighthgtonight ∞ · New Moderator

    @jamesinc, I did almost the exact same thing for my community.

    Nice!

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • @jamesinc said:
    This is quite a simple change for the Signatures plugin:

    Find the _DrawSignature function.

    The last statement in the function should be:

    echo $Display;
    

    Add two lines above that:

    // Ensure sig only renders once for each user
    unset($UserSignatures[$SourceUserID]);
    $Sender->SetData('Plugin-Signatures-UserSignatures', $UserSignatures);
    

    This will unset the user's signature from the signature cache after the first time it is rendered on the page.

    Hope someone finds it useful!

    Hi @jamesinc. Please, give more detailes. Should we add:

            // Ensure sig only renders once for each user
            unset($UserSignatures[$SourceUserID]);
              $Sender->SetData('Plugin-Signatures-UserSignatures', $UserSignatures);
        echo $Display;
    

    Right? In what file? In what place?

    Thanks in advance!

  • jamesincjamesinc Sydney ✭✭

    Hi @mirX, sorry for the lateness of my reply!

    This is what my plugins/Signatures/class.signatures.plugin.php looks like, starting at line 283:

             // Ensure sig only renders once for each user
             unset($UserSignatures[$SourceUserID]);
             $Sender->SetData('Plugin-Signatures-UserSignatures', $UserSignatures);
    
             echo $Display;
    

    In case there is any ambiguity, I have zipped the version of Signatures I am currently using in production (1.1.5)

    R_Jhgtonightvrijvlinder
  • jamesincjamesinc Sydney ✭✭

    I have updated this for 1.5.6

    In class.signatures.plugin.php, find the following (line 346):

    if (!is_null($RequestUserID)) 
       return GetValue($RequestUserID, $Signatures, $Default);
    

    And replace it with:

    if (!is_null($RequestUserID)) {
       $Sig = GetValue($RequestUserID, $Signatures, $Default);
       unset($Signatures[$RequestUserID]);
    
       return $Sig;
    }
    
    vrijvlinderR_JmirXhgtonight
  • Another way of doing it is to only show the signature when you hover over the post, with a little bit of jquery.

    grep is your friend.

    jamesincmirX
  • Thanks @jamesinc for assistance!

    Your amendment to version 1.5.6 works fine! <3

  • @x00 said:
    Another way of doing it is to only show the signature when you hover over the post, with a little bit of jquery.

    Thanks @x00 for good idea. What do you think is it possible to show the signature along with small Sharethis buttons when you hover over the post?

Sign In or Register to comment.