Online/Offline Text Info

Guides & Snippets for phpBB3. Try the Snippets here and share Your own Snippets
There is no support here! Only Read Access!
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

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>
Board rules! No PM support
User avatar
DoYouSpeakWak
BBCoder II
BBCoder II
Posts: 27
Joined: 05 Mar 2010, 16:47

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 ?
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

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.
Board rules! No PM support
User avatar
DoYouSpeakWak
BBCoder II
BBCoder II
Posts: 27
Joined: 05 Mar 2010, 16:47

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 ?
User avatar
Oliver
BBCoder III
BBCoder III
Posts: 120
Joined: 07 Mar 2010, 11:55

Re: Online/Offline Text Info

Post by Oliver »

What if the user has hidden there feel? What then is?
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

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.
Board rules! No PM support
User avatar
Galandas
BBCoder III
BBCoder III
Posts: 133
Joined: 07 Mar 2010, 00:08
BBCodes: 35
Favourite BBCode: player yahoo
Favourite MOD: Mod Rey
Location: italy
Contact:

Re: Online/Offline Text Info

Post by Galandas »

you can also apply the style subsilver2? grazie
User avatar
Steve
BBCoder VI
BBCoder VI
Posts: 847
Joined: 05 Mar 2010, 01:10
BBCodes: 2000
Favourite BBCode: p**n tube
Favourite MOD: Non of Stokers

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
Steve wrote: 14 Nov 2024, 16:45 It's happy bastard day!
User avatar
Galandas
BBCoder III
BBCoder III
Posts: 133
Joined: 07 Mar 2010, 00:08
BBCodes: 35
Favourite BBCode: player yahoo
Favourite MOD: Mod Rey
Location: italy
Contact:

Re: Online/Offline Text Info

Post by Galandas »

thank you very much..... :gp:
SteffenWillers©
BBCoder I
BBCoder I
Posts: 1
Joined: 06 May 2010, 22:33

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?
Locked