DiscusWare, LLC.
Download Purchase Contact Us
Home
Support Home Documentation Knowledge Base Support Forums Support Request Advanced Services
Discus 4.0 Skin Customization - Adding IP Address Support to Legacy Skins

This document describes how to add IP address support to skins that do not natively support it. Unless you hold a support contract that includes support for customization, DiscusWare does not provide support for the procedures in this section.
Support Site Search
 
Manuals and Docs
  Installation
  Upgrade
  Administration - 4.0
  Administration - 3.1
  Customization
    Skin Primer
    Skin Editing
    Interface Customization
    Templates: Variables
    Templates: Substitution
    Templates: IF-THEN
    Templates: FOREACH
    Templates: FOR
    Templates: DEFINE
    Templates: Arrays
    Templates: Skins
    Templates: Text Ops
    Templates: Subroutines
    Templates: Flow Control
    Templates: Math
    Templates: Global Options
    Templates: Colors
    Templates: Language Files

Introduction

By default, the "tables2" skin distributed with Discus supports the display of user IP address, if configured through the Access Manager. The other skins (classic, updated classic, tables1) do not have a really good place to put the IP address, and hence support for its display has not been included. User-contributed skins may or may not support IP address display, as individual authors are not likely to incorporate or test it if they do not use it on their own boards.

This document will explain how to add IP address support to any skin.

It is assumed for the purpose of this document that you are reasonably familiar with editing Discus skins, either through the Appearance Manager - Editor screen or by transferring the file to your computer, editing it manually, and transferring it back. If not, you need to read the skin primer before using this document.

Skin Editing

The control over individual messages is achieved in the "individual_message" part of the skin. These instructions will explain how to add the IP address as a field in your messages. The IP address will be introduced onto the page according to Access Manager settings, and will then remain there permanently. How you display the IP address is up to you to format - we'll put it on the page, you put it where you want.

At the TOP of the individual_message part of the skin, add the bold code from below (the red code is shown only as a reference point for where you should insert this code, and may be slightly different depending on the skin being used):

<#part "individual_message"#>
<!--Post: $message->{number}--><!--Time: $message->{time}--> ## DO NOT CHANGE!!!
<!--p:$message->{property}-->\ ## DO NOT CHANGE!!!
<#define $ip_address = ""#>
<#if $message->{field_ip_address} ne ""#>
  <#define $ip_address = "$message->{field_ip_address}"#>
<#else#>
  <#if $message->{ip_address} ne ""#>
    <#define $ip_address = "$message->{ip_address}"#>
  <#endif#>
<#endif#>
<!--field:ip_address--><!--use: $ip_address--><!--/field-->

The code you added does not itself print anything visible onto the page. However, after that code, the user's IP address is now stored in the variable $ip_address and can be used anywhere in the ensuing portion of the skin.

When you use $ip_address to indicate the poster's IP, keep in mind that you SHOULD NOT put the variable within any Discus identifier tags (e.g., DO NOT put $ip_address between <!--name--> and <!--/name-->). Also keep in mind that the $ip_address variable may be empty (for pre-4.0 posts, or any posts that do not have the IP address set due to Access Manager settings).

Example - IP Address in parentheses on classic skin

Make the modifications indicated in bold to these lines in the "individual_message" part of the skin to make the IP address appear in parentheses after the poster's name:

<#if $message->{email} ne ""#>
  <#replace "%name" with "<!--email--><a href="$message->{email}" target="_blank"><!--/email--><!--name-->$message->{author}<!--/name-->{#if $ip_address ne ""#} ($ip_address){#endif#}</a>" in $l#>
<#else#>
  <#replace "%name" with "<!--name-->$message->{author}<!--/name-->{#if $ip_address ne ""#} ($ip_address){#endif#}" in $l#>
<#endif#>


Download Purchase Contact Us
Privacy Policy
Copyright © 2005, DiscusWare, LLC, All Rights Reserved