phpBB

Development Wiki

Showing a message to new users

From phpBB Development Wiki

Revision as of 15:46, 11 December 2009 by Naderman (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

To show a message to new users (for example rules or information about the community or a warning that messages will be moderated) use following code in overall_header.html. (ACP>Styles>Templates>overall_header.html)

<!-- IF S_USER_LOGGED_IN and $user->data['user_posts'] == 0 -->                                 
  <!-- Your text here -->
<!-- ENDIF -->

This will first check if the user is logged in and then check if the user has made no posts yet. If both is true, the text/HTML you put in the place of will appear on every page (since you insert the code in overall_header.html).

Usage example

As a user of phpBB 3.0.5 I'd recommend adding the following code to the bottom of overall_header.html.

<!-- IF S_USER_LOGGED_IN and $user->data['user_posts'] == 0 -->
<div id="message" class="rules">
  <div class="inner"><span class="corners-top"><span></span></span>
    <strong>{L_INFORMATION}:</strong> <!-- Your text here -->
    <span class="corners-bottom"><span></span></span></div>
  </div>
<!-- ENDIF -->

Credits

irc.freenode.net #phpbb-coding and http://wiki.phpbb.com/Template_Syntax#User_Variables were helpful at creating this information.