User:Becasita/SubPages/Templates/UserStats

From Yugipedia
Jump to: navigation, search

[[User:{{{user}}}|{{{user}}}]] ()

Description

Based on the {{RFP/user links}} template.
To be used to display several stats of a given user. Can be used when reporting an user or alerting to some behavior from that user.

Usage

{{subst::User:Becasita/SubPages/Templates/UserStats
| user     = 
| talk     = 
| contribs = 
| uploads  = 
| logs     = 
}}
user
The user name.
talk
To be filled with 1 in order to display a link to the user talk page.
contribs
To be filled with 1 in order to display a link to the user contributions.
uploads
To be filled with 1 in order to display a link to the user uploads.
logs
To be filled with 1 in order to display a link to the user logs.

Example

The setting:

{{subst::User:Becasita/SubPages/Templates/UserStats
| user     = Becasita
| talk     = 
| contribs = 1
| uploads  = 
| logs     = 1
}}

Outputs:
Becasita (contribslogs)

Note: The parentheses ( ) will always appear.

Draft

Code

Note: This is a more organized way of the code, to facilitate when editing.

<!--Replace subst: with {{{|safesubst:}}}.-->
{{ subst:#replace: 
{{ subst:#vardefine: $FLAG | }}<!--Declaring var. $FLAG will save a status.-->

{{ subst:#vardefine: $DOT | _ • }}<!--Declaring var. $DOT contains a space and a dot (or bull)-->

[[User:{{{user}}}|{{{user}}}]] (
{{ subst:#if: {{{talk|}}} | [[User talk:{{{user}}}|talk]]{{ subst:#vardefine: $FLAG | talk }} }}

{{ subst:#if: {{{contribs|}}} | <!--Insert FIRST #switch here--> [[Special:Contributions/{{{user}}}|contribs]]{{ subst:#vardefine: $FLAG | contribs }} }}

{{ subst:#if: {{{uploads|}}} | <!--Insert SECOND #switch here--> [[Special:ListFiles/{{{user}}}|uploads]]{{ subst:#vardefine: $FLAG | uploads }} }}

{{ subst:#if: {{{logs|}}} | <!--Insert THIRD #switch here--> [[Special:Log/{{{user}}}|logs]] }}
)
 | _ | }}<!--Replaces the underscore at var. $DOT with nothing, thus creating spacing. The underscore is used as padding.-->
#switches are provided below, outside of the code, to avoid clogging:

FIRST:
{{subst:#switch: {{ subst:#var: $FLAG }}
       | talk = {{ subst:#var: $DOT }}
       | #default = 
}}

SECOND:
{{subst:#switch: {{ subst:#var: $FLAG }}
       | talk
       | contribs = {{ subst:#var: $DOT }}
       | #default = 
}}

THIRD:
{{subst:#switch: {{ subst:#var: $FLAG }}
       | talk
       | contribs
       | uploads  = {{ subst:#var: $DOT }}
       | #default = 
}}