Online/Offline Text Info

Guides & Snippets for phpBB3.
Try the Snippets here and share Your own Snippets

Online/Offline Text Info

Post by Stoker »

Online/Offline Text Info
Written by Stoker, inspired by DoYouSpeakWak??

This phpBB3 snippet will show you how to display Online/Offline text in viewtopic and profile.
Demo: this board.

Open styles/prosilver/template/viewtopic_body.html
Find:

Code: Select all

<!-- IF postrow.POSTER_POSTS != '' --><dd><strong>{L_POSTS}:</strong> {postrow.POSTER_POSTS}</dd><!-- ENDIF -->
Before add:

Code: Select all

<dd><strong>Status:</strong><!-- IF postrow.S_ONLINE --><span style="color:#008000; font-weight:bold;"> {L_ONLINE}:</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;"> {L_OFFLINE}:</span><!-- ENDIF --></dd>
Open styles/prosilver/template/memberlist_view.html
Find:

Code: Select all

<dt>{L_USERNAME}:</dt>
Before add:

Code: Select all

<dt>Status:</dt><dd><!-- IF S_ONLINE --><span style="color:#008000; font-weight:bold;"> {L_ONLINE}:</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;"> {L_OFFLINE}:</span><!-- ENDIF --></dd>

Re: Online/Offline Text Info

Post by DoYouSpeakWak »

Thought a bit about this last night. I was sure that online and offline pure text allready was in the language files. So no need for hardcoding and translation problems.

I was right. common.php

Code: Select all

	'OCCUPATION'				=> 'Occupation',
	'OFFLINE'					=> 'Offline',
	'ONLINE'					=> 'Online',
So if im not mistaken this

Code: Select all

<dd><strong>Status:</strong><!-- IF postrow.S_ONLINE --><span style="color:#008000; font-weight:bold;"> Online</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;"> Offline</span><!-- ENDIF --></dd>
Can look like this

Code: Select all

<dd><strong>Status:</strong><!-- IF postrow.S_ONLINE --><span style="color:#008000; font-weight:bold;"> {L_ONLINE}</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;"> {L_OFFLINE}</span><!-- ENDIF --></dd>
And this

Code: Select all

<dt>Status:</dt><dd><!-- IF S_ONLINE --><span style="color:#008000; font-weight:bold;">Online</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;">Offline</span><!-- ENDIF --></dd>
like this

Code: Select all

<dt>Status:</dt><dd><!-- IF S_ONLINE --><span style="color:#008000; font-weight:bold;">{L_ONLINE}</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;">{L_OFFLINE}</span><!-- ENDIF --></dd>
An the private messages in ucp is not covered by this. Should they be ?

Re: Online/Offline Text Info

Post by Stoker »

You will still be missing the word "'Status:"
This is the easiest way I could figure out doing this, 2 template changes and you have got it.
But offcourse, if we are talking coding guidelines you never hardcode templates.

Re: Online/Offline Text Info

Post by DoYouSpeakWak »

I missed that. Its no biggie. But a language/common.php might be the best solution.

What about adding this to the ucp ? What do you think about that ?

Re: Online/Offline Text Info

Post by Oliver »

What if the user has hidden there feel? What then is?

Re: Online/Offline Text Info

Post by Stoker »

I think it would be nice with an extended version, properly coded so it can be translated and used in several languages.
But then its more a mod than a snippet.
Feel free to post it in the support area, then I will move it to the mods forum.

Re: Online/Offline Text Info

Post by Galandas »

you can also apply the style subsilver2? grazie

Re: Online/Offline Text Info

Post by Steve »

open/styles/subsilver2/template/viewtopic_body.html
find:

Code: Select all

<span class="postdetails">
add after:

Code: Select all

<b>Status:</b><!-- IF postrow.S_ONLINE --><span style="color:#008000; font-weight:bold;"> Online</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;"> Offline</span><!-- ENDIF -->
open styles/subsilver2/template/mamberslist_view.html
find:

Code: Select all

			<!-- IF AVATAR_IMG -->
				<tr>
					<td align="center">{AVATAR_IMG}</td>
				</tr>
			<!-- ENDIF -->
add after:

Code: Select all

			<tr>
    			<td><b>Status:</b><!-- IF S_ONLINE --><span style="color:#008000; font-weight:bold;">{L_ONLINE}</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;">{L_OFFLINE}</span><!-- ENDIF --></td>
			</tr>
statuso.PNG
statusoo.PNG

Re: Online/Offline Text Info

Post by Galandas »

thank you very much..... :gp:

Re: Online/Offline Text Info

Post by SteffenWillers© »

thanks for the Post but i have a quetion. What do you mean with the common.php with the codeI was right. common.php

Code: Select all

Code: Select all
       'OCCUPATION'            => 'Occupation',
       'OFFLINE'               => 'Offline',
       'ONLINE'               => 'Online',

So if im not mistaken this

Code: Select all

Code: Select all
    <dd><strong>Status:</strong><!-- IF postrow.S_ONLINE --><span style="color:#008000; font-weight:bold;"> Online</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;"> Offline</span><!-- ENDIF --></dd>


Can look like this

Code: Select all

Code: Select all
    <dd><strong>Status:</strong><!-- IF postrow.S_ONLINE --><span style="color:#008000; font-weight:bold;"> {L_ONLINE}</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;"> {L_OFFLINE}</span><!-- ENDIF --></dd>


And this

Code: Select all

Code: Select all
    <dt>Status:</dt><dd><!-- IF S_ONLINE --><span style="color:#008000; font-weight:bold;">Online</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;">Offline</span><!-- ENDIF --></dd>

like this

Code: Select all

Code: Select all
    <dt>Status:</dt><dd><!-- IF S_ONLINE --><span style="color:#008000; font-weight:bold;">{L_ONLINE}</span><!-- ELSE --><span style="color:#FF0000; font-weight:bold;">{L_OFFLINE}</span><!-- ENDIF --></dd>

where do I add code to what? Namely, I have no plan what needs to be stored where.
Sorry for my bad english. Can help me for my Problem?