Tapatalk Modification for vB3 - Issue with Avatar Icons


 
Thread Tools Search this Thread
Top Forums Web Development Tapatalk Modification for vB3 - Issue with Avatar Icons
# 1  
Old 01-18-2014
Tapatalk Modification for vB3 - Issue with Avatar Icons

This post will be soon moved to the "Web Application" forum so our Tapatalk developer friends can follow an unresolved issue with regard to how the Tapatalk app fetches can caches avatar icons.

We start this process by creating a hook in the vB 3.8 tapatalk file get_online_users.php

PHP Code:
($hook vBulletinHook::fetch_hook('neo_tapatalk_online_bits')) ? eval($hook) : false
in the location within the file here:

PHP Code:
$from 'browser';

if(isset(
$loggedin['useragent']))
      {
            
$userAgent $loggedin['useragent'];
             
             if(
strpos($userAgent,'Android') !== false || strpos($userAgent,'iPhone') !== false ||  strpos($userAgent,'BlackBerry') !== false)
             
$from 'mobile';
             if(
strpos($userAgent,'Tapatalk') !== false)
                    
$from 'tapatalk';
              if(
strpos($userAgent,'BYO') !== false)
                    
$from 'byo';            
      }


$username mobiquo_encode($loggedin['musername']) ? mobiquo_encode($loggedin['musername']) : mobiquo_encode($loggedin['username']);

(
$hook vBulletinHook::fetch_hook('neo_tapatalk_online_bits')) ? eval($hook) : false
and the hook code simply takes the $from variable and adds a small bit of text to the $display_text that is displayed in the TT "People" page:

PHP Code:
 if($from == 'tapatalk'
       { 
             if(empty(
$userinfo['avatarurl'])) 
                    
$userinfo['avatarurl'] = 'customavatars/avatar46598_1.gif';  // testing this line
                    
$display_text $display_text mobiquo_encode(' ...  (using Tapatalk)'); 
        } 
else if(
$vbulletin->userinfo['styleid'] == '137'
        { 
                  
$display_text $display_text mobiquo_encode(' ... (using Mobile Skin)'); 
        } 
else if(
$from == 'mobile'
        { 
                  
$display_text $display_text mobiquo_encode(' ... (using Mobile No Skin)'); 
        } 
Image

This code works as expected, and in the screen shot above; we can see two online TT users.

(Note: There is also one "special system bot" user we created that is used to display system information to mods, but I will not describe that code in this post; it is discussed in this post).

Because this works so easily, I then decided to add icons for all users who do not have icons already (because they did not upload a custom avatar). We will do this for the. I created many different hooks and experimented in many different places (because there is an issue with the icons, as they are fetched and cached in the TT app)

Currently, I am using the vB 3 file: functions_user.php

and the hook is:

PHP Code:
// final case: didn't get an avatar, so use the fake one
if (empty($userinfo['avatarurl']) AND $returnfakeavatar)  // we never use this fake one, only the hook code below
     
{
                
$userinfo['avatarurl'] = $stylevar['imgdir_misc'] . '/unknown.gif';
      }

(
$hook vBulletinHook::fetch_hook('neo_vbulletin_fetch_avatar_from_userinfo')) ? eval($hook) : false
and the hook code we are testing is quite simple:

PHP Code:
if($userinfo['avatarurl'] == ''

$agent $location;   // for testing purposes
   
if($userinfo['usergroupid'] == '10')   
     
$userinfo['avatarurl'] = 'customavatars/avatar302016126_2.gif';   
else if(
$userinfo['usergroupid'] == '5')   
     
$userinfo['avatarurl'] =  'customavatars/avatar302016126_2.gif';   
else if(
$userinfo['usergroupid'] == '13')   
    
$userinfo['avatarurl'] = 'customavatars/avatar34166_2.gif';   
else if(
$userinfo['usergroupid'] == '11')   
    
$userinfo['avatarurl'] = 'customavatars/avatar44786_2.gif';   
else if(
$userinfo['usergroupid'] == '3')   
    
$userinfo['avatarurl'] = 'customavatars/avatar302052812_2.gif'
else   
   {   
     if(
$agent == 'tapatalk')   
        {   
         
$userinfo['avatarurl'] = 'customavatars/avatar46598_1.gif';   
        }   
     else if(
$agent == 'browser')   
        {   
         
$userinfo['avatarurl'] = 'customavatars/avatar302087525_1.gif';   
        }   
       else if(
$agent == 'mobile')   
        {   
         
$userinfo['avatarurl'] = 'customavatars/avatar302051592_2.gif';   
        }   
       else  
        {   
         
$userinfo['avatarurl'] = 'customavatars/avatar302087525_1.gif';   
        }   

    }   

// our simple logging code for debugging
if(1)  
{  
     
$log '/var/log/apache2/neo_fetch_avatar_from_userinfo';  
     
//$stuff = print_r($userinfo,TRUE);  
     
error_log(date(DATE_RFC822).' '.$userinfo['usergroupid'].'  '$_SERVER['REMOTE_ADDR']. 
'  '$userinfo['username'] .' URL  '.$userinfo['avatarurl'] .' From: '.$agent."\n"3$log);

OBTW, I also modify the function (used above) to send it the required $location parameter:

PHP Code:
function fetch_avatar_from_userinfo(&$userinfo$thumb false$returnfakeavatar true,$location''


This code basically says, fetch the avatar from the userinfo with an addition location parameter, and if there is no user avatar, replace with our custom avatar, one for various user groups, and if the user is not a member of any of those groups, show a default "UX" avatar, but if their location is "Using Tapatalk" then show a different TT icon.

Unfortunately, this does not work. You can see in the image above, two users are online via TT and the status message is correct, but the icon is not correct. We see the default "UX" icon and not the "TT" icon.

Also, FYI:

Code:
fetch_avatar_from_userinfo()

is called from the TT include file common.php

which is located in our modified function (with our optional agent param):

Code:
function mobiquo_get_user_icon($userid,$agent = '')

which contains this code:


PHP Code:
$icon_url "";
if(
$vbulletin->options['avatarenabled']){
     
fetch_avatar_from_userinfo($userinfo,true,false,$agent);

     if(
$userinfo[avatarurl]){
            
$icon_url get_icon_real_url($userinfo['avatarurl']);
     } else {
           
$icon_url '';   // this should never happen because we add default icons in the  fetch_avatar_from_userinfo() function
     
}

I have tried placing the hooks in various locations, clearing the cache, restarting the app on the mobile phone, even restarting the phone. The logging info always shows that the icons are set correct by the code; but they do not display correctly.

So, I have concluded this is a pre-fetching or caching bug in the TT app that causes the avatar icons not to display properly. In this same screenshot, the icons are wrong for the two logged in TT users:

Image
# 2  
Old 01-18-2014
Example debug logging output:

Quote:
Sat, 18 Jan 14 05:14:04 -0500 2 128.66....... carpannav URL customavatars/avatar302087525_1.gif From:
Sat, 18 Jan 14 05:53:35 -0500 2 58.137....... dmangus URL customavatars/avatar46598_1.gif From: tapatalk
Sat, 18 Jan 14 05:53:35 -0500 2 58.137....... shad0w_GR URL customavatars/avatar302087525_1.gif From: browser
Sat, 18 Jan 14 05:53:35 -0500 2 58.137....... saggiboy10 URL customavatars/avatar302087525_1.gif From: browser
Sat, 18 Jan 14 05:53:35 -0500 2 58.137....... Prathmesh URL customavatars/avatar46598_1.gif From: tapatalk
Sat, 18 Jan 14 05:53:36 -0500 2 58.137........ shad0w_GR URL customavatars/avatar302087525_1.gif From:
Sat, 18 Jan 14 05:53:36 -0500 2 58.137........ saggiboy10 URL customavatars/avatar302087525_1.gif From:
Sat, 18 Jan 14 05:53:37 -0500 2 58.137........ shad0w_GR URL customavatars/avatar302087525_1.gif From:
Sat, 18 Jan 14 05:53:37 -0500 2 58.137........ saggiboy10 URL customavatars/avatar302087525_1.gif From:
You can see that for two TT users, the correct TT default avatar is set, but it does not show correctly in the app. Clearing the cache, restarting the app and/or the phone does not fix the issue.
# 3  
Old 01-18-2014
Update: This is very strange.

Without any notice TT upgraded their app to remove the user avatar from the "People" pages. Why they would do this, without coordinating with forum owners and admins, is beyond me to understand.

I guess that when TT has a bug in something and they cannot fix it, they just "remove it" without discussing it with forum admins?


Image

Update: I worked many hours to debug this issue and then TT just deleted the feature from the app. It's a bit frustrating.. needless to say.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Web Development

Tapatalk - More Frustrations with Icons, Versions and User Agent String

My frustration with Tapatalk continues. After reinstalling TT for the forums, I'm trying to tweet it so we can get a lot of benefit for forum members. TT has both a free version and a "Pro" version (which we pay for). I paid for the "Pro" version, and the first thing I noticed was that the app... (3 Replies)
Discussion started by: Neo
3 Replies

2. Web Development

Tapatalk Modification for vB3 - Adding User for System Information

Referring back to this thread: Tapatalk Modification for vB3 - Issue with Avatar Icons I mentioned that we had some "system bot" code: In this post, I describe that code and how easy it is to create a "system bot" user for Tapatalk (TT): Basically, its quite easy. We add a hook to... (0 Replies)
Discussion started by: Neo
0 Replies

3. What is on Your Mind?

Member Reviews of the Movie: Avatar

Please comment and vote only if you saw the movie. What did you think? (13 Replies)
Discussion started by: Neo
13 Replies

4. What is on Your Mind?

How to get an avatar to work?

I have uploaded a small image, 64x64 and about 5k in size, that was about a week ago, I still do not see my image when I post, or maybe I just can't see it and others can? It helps me scroll through threads and find my own posts easier, but on this forum it either doesn't show up for me or is just... (1 Reply)
Discussion started by: raidzero
1 Replies

5. Post Here to Contact Site Administrators and Moderators

Avatar problem

Hi, I wanted to change my avatar, but I get the message You may not upload animated images. How come that this user has one? https://www.unix.com/members/3394.html https://www.unix.com/avatars/perderabo.gif All users are equal, but some are more equal than other? Thanks. (0 Replies)
Discussion started by: Ebbi
0 Replies

6. News, Links, Events and Announcements

Similar Threads - a new vB3 feature for UNIX.COM

Note the new feature on UNIX.COM, many thread at the bottom of the page have a new feature: Similiar Threads Here is an example on one of Perderabo's posts: https://www.unix.com/showthread.php?t=16337 Kudos to the vB folks for this built-in feature!! Neo (0 Replies)
Discussion started by: Neo
0 Replies

7. Post Here to Contact Site Administrators and Moderators

avatar

where can i upload an image for avatar (3 Replies)
Discussion started by: royal
3 Replies
Login or Register to Ask a Question