HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Some Relevant info on how to use the Role Signature Plugin

to change Signatures:

you can change the definition in the plugin locale definitions or in conf/locale.php

e.g.

$Definition["the administrators signature"] = 'me new admin sig';
$Definition["the moderators signature"] = "my new moderator sig";

//this is an example how to blank out a signature
$Definition["the members signature"] = "";



If you "look" in default.php - there is a relatively intuitive place to change code - even for the faint-hearted with a bit of logic backgrounf.

you will see:


//here is where you can modify

so if you looked in the default.php (from the details on the download page).

you would see the // comments.

then if you created "Custom roles - e.g. Advisor"
then all users with Advisor role . (the role you had given in vanilla.) and
the only role based signature you wanted.

you could change the code

 if (in_array($administrator, $Roles)) 
              $UserSig = T("the administrators signature");

to

 if (in_array($administrator, $Roles)) 
            $UserSig = T("the administrators signature");

 if (in_array("Advisor", $Roles))
$UserSig = T("The Advisor role signature"); 


and then in definitions.php




$Definition["The Advisor role signature"] = '' The New Advisor Signature ";
$Definition["the administrators signature"] = '';  // this would blank out a signature for the role
$Definition["the moderators signature"] = "";
$Definition["the members signature"] = "";

------

Another example:


if the user is a Moderator role and a  "Advisor Role"  but you prefer the Moderator role to take precedence.

you would place the new advisor role  above

 if (in_array($moderator, $Roles)) 
              $UserSig =  T("the moderators signature");  


  to:



 if (in_array("Advisor", $Roles))
     $UserSig = T("The Advisor role signature"); 

   if (in_array($moderator, $Roles)) 
              $UserSig =  T("the moderators signature");   

since the moderator role is below the Advisor role in the code - it takes precedence if the user is BOTH a Moderator and Advisor.


if the user is a Moderator role and a "Advisor Role" but you prefer the Advisor role to take precedence.

you would place the new advisor role below

 if (in_array($moderator, $Roles)) 
              $UserSig =  T("the moderators signature");  




to:


   if (in_array($moderator, $Roles)) 
              $UserSig =  T("the moderators signature");   

if (in_array("Advisor", $Roles))
     $UserSig = T("The Advisor role signature"); 


I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Comments

  • hgtonighthgtonight MVP
    edited April 2013

    Could I suggest that you use a more unique phrase as your translate key? You can pass a default right in the code.

    if (in_array($moderator, $Roles))
      $UserSig = T('Plugin.RoleSignature.Moderator', 'The default moderator signature'); 
    

    Not only does it prevent overlap, it makes it easier to track what goes where in your locale definitions file, imo.

    There is definitely a trade off in that a user has to use your specific key, rather than the text that pops up. I suppose this makes it more of a preference. :D

    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.

  • peregrineperegrine MVP
    edited April 2013

    @hgtonight said:
    Could I suggest that you use a more unique phrase as your translate key? You can pass a default right in the code.

    if (in_array($moderator, $Roles))
      $UserSig = T('Plugin.RoleSignature.Moderator', 'The default moderator signature'); 
    

    Not only does it prevent overlap, it makes it easier to track what goes where in your locale definitions file, imo.

    There is definitely a trade off in that a user has to use your specific key, rather than the text that pops up. I suppose this makes it more of a preference. :D

    this is pretty unique and it is a default already.
    T("The Advisor role signature");

    and it is already in locales unique to the plugin. so it is pretty easy to track already. and it is defaulted. Frankly, I would find your way a bit more confusing if I was a newbie.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.