Mind blowing SEO improving and Google rank increasing Signature Rotator SEO Tool.

Thread: 

How to adding flag in Who's online today ?

Ads
banner
banner
banner
Midori Offline referral

Posts: 41
Joined: Apr 2014
Reputation: 1

#1
Junior Member
Hi !
Can you advise me , How can to adding a flag for every member in "Who's online today" section According to the member (no ip's) settings.

I made {$post['fid4']} and added <img src="images/Flags/{$post['fid4']}.GIF" /> in online_today_index after {$onlinemembers} . but not work .
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#2
Support Team
Hi what flag are you talking about?
$post will only work inside postbit!

Please explain what are you trying to achieve or do I can't understand sorry?

{$post['fid4']} is referring to custom profile fields

online_today_index I am not aware of that template!


Anyways try: {$online['fid4']}
Midori Offline referral

Posts: 41
Joined: Apr 2014
Reputation: 1

#3
Junior Member
I want to show member`s country flag in "Who's online today" section in index (boardstats)
I made a field in member`s cp about choose and select country with flag , I want use that field setting in "Who's online today" section to showing flags . ( sorry I cant attach pic or URL in this forum to show and clear explain to you )
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#4
Support Team
If you have created "Custom Profile Field" that has fid4 then to show it on who's online template use something like this: {$online['fid4']} if it doesn't work then I am afraid you'll need a simply plugin that will retreat user field content!
seo123 Offline referral

Posts: 427
Joined: Mar 2014
Reputation: 16

#5
Senior Member
You can use this to create a plugin:
Hook
PHP Code:
$plugins->add_hook("online_start""user_flag"); 

PHP Code:
$uid $mybb->user['uid'];
$ufid $db->fetch_array($db->simple_select('userfields''fid4''ufid = '.$uid)); 

Then use this in your template
PHP Code:
$ufid['fid4'
Midori Offline referral

Posts: 41
Joined: Apr 2014
Reputation: 1

#6
Junior Member
(04-16-2014 03:30 PM)marcus_avrelius Wrote:  If you have created "Custom Profile Field" that has fid4 then to show it on who's online template use something like this: {$online['fid4']} if it doesn't work then I am afraid you'll need a simply plugin that will retreat user field content!

(04-16-2014 03:41 PM)SEO123 Wrote:  You can use this to create a plugin:
Hook
PHP Code:
$plugins->add_hook("online_start""user_flag"); 

PHP Code:
$uid $mybb->user['uid'];
$ufid $db->fetch_array($db->simple_select('userfields''fid4''ufid = '.$uid)); 

Then use this in your template
PHP Code:
$ufid['fid4'

Thanks but {$online['fid4']} no work for me . Maybe need plugin and Thanks SEO123 but I dont know about plugin creating.
Just I want to show in "Who's online today" section Like this: Midori(pic of country flag),marcus_avrelius(pic of Country flag),SEO123(pic of Country flag), .........
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#7
Support Team
OK I will create a plugin for you but I need to know if you are referring to "Custom Profile Field"? If so then give me some time and I will create a plugin for you Smile

Post here the Custom Profile Field fid?
Midori Offline referral

Posts: 41
Joined: Apr 2014
Reputation: 1

#8
Junior Member
Thanks again , I created a member field about country flag and inserted a
<img src="images/Flags/{$post['fid4']}.GIF" />
code in "postbit_author_user" . It work really nice in members postbit and I want that selected flag showing in online member section too .
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#9
Support Team
Hi there is no need to create a plugin you only need a simple core edit!

Go to: ACP >> Templates >> Your template >> Who's Online Templates >> online > and find:
PHP Code:
<td class="thead" colspan="3"

And replace it with
PHP Code:
<td class="thead" colspan="4"

In the same template find:
PHP Code:
<td class="tfoot" colspan="3" align="right"

Replace it with
PHP Code:
<td class="tfoot" colspan="4" align="right"

Now find:
PHP Code:
<td class="tcat" align="center"><a href="online.php?sortby=username"><span class="smalltext"><strong>{$lang->on_username}</strong></span></a></td

And add this code just above it!
PHP Code:
<td class="tcat" align="center" width="5%"><span class="smalltext"><strong>User Country</strong></td

Now, Go to: ACP >> Templates > Your templates >> Who's Online Templates >> online_row > and find:
Code:
<tr>

Add:
PHP Code:
<td align="center" class="trow1">{$flag}</td

Now open /inc/functions_online.php and find:
PHP Code:
function build_wol_row($user)
{
    global 
$mybb$lang$templates$theme$session

And replace it with this code:
PHP Code:
function build_wol_row($user)
{
    global 
$mybb$lang$templates$theme$session$db;
    
    
    
$uid $mybb->user['uid'];
    
$ufid $db->fetch_array($db->simple_select('userfields''fid4''ufid = '.$uid));
    
    if(
$ufid['fid4'])
    {
    
$flag "{$ufid['fid4']}";    
    } 

Save the file and the content of the user custom field fid4 will show there!
Midori Offline referral

Posts: 41
Joined: Apr 2014
Reputation: 1

#10
Junior Member
Thank you . I did it all but show nothing !!!!
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#11
Support Team
Please PM me a temporarily access to your forum. I want to see it myself!

It's working for me so it's gotta be something that you are missing!
Midori Offline referral

Posts: 41
Joined: Apr 2014
Reputation: 1

#12
Junior Member
Thanks but I tested in local.
At final I inserted below codes
PHP Code:
<!--  Start -->
<if 
condition="{$ufid['fid4']}">
    <
img src="images/flags/{$ufid['fid4']}.GIF" alt="Users Flag!" border="" />
</if>
<!-- 
End --> 

in "index_whosonline" after "{$onlinemembers}"
and I saw "Users Flag!" only !!!!!!!!!!!!
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#13
Support Team
What MYBB Forum version are use using because index_whosonline is not even in the templates list!!!

Who's Online Templates contain:

online
online_row
online_row_ip
online_today
online_today_row


I am positive the tutorial I posted works because I have tested it!
Midori Offline referral

Posts: 41
Joined: Apr 2014
Reputation: 1

#14
Junior Member
I inserted in .................. Index Page Templates ---> index_whosonline and I saw "Users Flag!" only .like: Midori Users Flag! alt only.
In.................. Who's Online Templates --->
online
online_row
online_row_ip
online_today
online_today_row
Inserted
PHP Code:
<!--  Start -->
<if 
condition="{$ufid['fid4']}">
    <
img src="images/flags/{$ufid['fid4']}.GIF" alt="Users Flag!" border="" />
</if>
<!-- 
End --> 
one by one for test but saw nothing.
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#15
Support Team
You don't need to use template conditionals for this! If you follow this reply carefully then it should work.

Avatar in who's online

Make sure you add:
PHP Code:
<td align="center" class="trow1">{$flag}</td

To online_row template otherwise it will never show!!!!!!!!!!!!!
Midori Offline referral

Posts: 41
Joined: Apr 2014
Reputation: 1

#16
Junior Member
Perfect and Very Nice 001_tt1. I got it 001_tongue. Thank you very much
I searched result in index but target was in online page .!!!!!!!!!!!!!!!
I needed it too . Blush001_tt1
so I inserted below code in online_row
PHP Code:
<td align="center" class="trow1"><img src="images/flags/{$ufid['fid1']}.gif" alt="{$flag}title="{$flag}height="17" width="30" /></td
and work well (show flag clearly) but with your code
PHP Code:
<td align="center" class="trow1">{$flag}</td
it show country name only . Thanks again and need more one Blush
how can I show flags in Index Page Templates ---> index_whosonline too 001_tongue

one mistake !! all members have same my flag . same flag show for all members !!!!!!!!!!!
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#17
Support Team
Cool I am glad it works! Yes, my tutorial suppose to return the content of the user field fid4 it had nothing to do with the images!!!!

You mean you want me to adapt this to show on home page or index.php if so please post a new topic!

Quote:one mistake !! all members have same my flag . same flag show for all members !!!!!!!!!!!

Most likely they those users selected the same value! Manually check that to make sure!
Midori Offline referral

Posts: 41
Joined: Apr 2014
Reputation: 1

#18
Junior Member
Quote:Most likely they those users selected the same value! Manually check that to make sure!
Guests and Bots and all visitors have flag same me too (If anybody visit online page his flag is set for all visitors and members) something is wrong ....
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#19
Support Team
PHP Code:
<td align="center" class="trow1"><img src="images/flags/{$ufid['fid1']}.gif" alt="{$flag}title="{$flag}height="17" width="30" /></td

{$ufid['fid1']} you should change fid4 to fid1 here as well!!!!!!!!!!!

PHP Code:
$ufid $db->fetch_array($db->simple_select('userfields''fid1''ufid = '.$uid));
    
    if(
$ufid['fid1'])
    {
    
$flag "{$ufid['fid1']}";    
    } 

P.S. I have just noticed you were using it wrong {$flag} should be used not {$ufid['fid1']}

Try using this code not yours!!!!!!

PHP Code:
<td align="center" class="trow1"><img src="images/flags/{$flag}.gif" alt="{$flag}title="{$flag}height="17" width="30" /></td
Midori Offline referral

Posts: 41
Joined: Apr 2014
Reputation: 1

#20
Junior Member
Thank you very much .
No work for me !! you can see in my forum (It is in persian lang , maybe this is problem fo you , sorry !!!!)
In my try {$ufid['fid1']} is in local and {$ufid['fid4']} is in my forum in site . you can see result in my online page after codes correcting and checking all Based on your tips
h t t p : / / w w w . midorinco.ir/online.php





User(s) browsing this thread: 1 Guest(s)