The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Profile Viewing ?

4 posters

Go down

In progress Profile Viewing ?

Post by Matrix317 January 26th 2015, 9:07 am

I have PhpBB3 Version.

Is this possible to get my forum?
I want Current Activity.
Profile Viewing ? 2wggc94
avatar
Matrix317
New Member

Posts : 21
Reputation : 1
Language : England

http://testaillla.foorumi.biz/forum

Back to top Go down

In progress Re: Profile Viewing ?

Post by Ange Tuteur January 26th 2015, 8:28 pm

Hello @Matrix317,

Give this a try :
Administration Panel > Modules > JavaScript codes management > Create a new script

Title : Your choice
Placement : In all the pages
Paste the code below and submit
Code:
window.location.pathname.match(/\/u\d+/) && $(function() {
  var block = document.createElement('DIV');
  block.className = 'module';
  block.innerHTML = '<div class="inner"><span class="corners-top"><span></span></span><div class="h3">Activity</div><p class="viewing"><a href="#" onclick="return false;" class="loading">Loading activity..</a></p><span class="corners-bottom"><span></span></span></div>';
  $('#profile-advanced-right .module:first').after(block);
  $(block.getElementsByTagName('P')[0]).load('/viewonline tr:has(a[href="/u'+window.location.pathname.match(/u(\d+)/)[1]+'"]) td:last a',function() {
    (!this.innerHTML.length) && (this.innerHTML = '<a href="#" onclick="return false;" class="inactive">Offline</a>')
  });
});


Then go to Display > Colors > CSS stylesheet and paste the following code.
Code:
.module .viewing a {
  color:#696;
  text-shadow:1px 1px 0 #FFF;
  text-align:center;
  font-weight:bold;
  background:#EEE;
  border:1px solid #CCC;
  border-radius:3px;
  display:block;
  padding:5px 3px;
  margin:6px 0;
}
.module .viewing a.loading { color:#996 }
.module .viewing a.inactive { color:#C66 }


This should give you the following result while viewing a profile page :
Profile Viewing ? Captur94
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

In progress Re: Profile Viewing ?

Post by Tonight January 26th 2015, 10:33 pm

Hello, Ange!

I like the style of it, but it bugs for me. It shows either Offline or Viewing online people list (or whatever it is in English boards).
This script works great:
Code:
$(function() {
            var x = document.getElementById('profile-advanced-right');
            if(!x) return; // not a profile, don't do anything
            if( $('.h3', x)[0].getElementsByTagName('em')[0] ) { //the <em>(Online</em> element exists, so the user is online.
                var div = document.createElement('div');
                $(div).load('/viewonline .forumbg', function() { //load the data into a div to look for this users current activity
                    for(var i = 0, links = div.getElementsByTagName('a'), a; (a = links[i++]); ) {
                        if(window.location.href.indexOf(a.href) >= 0) { // we've found it.
                            var data = a.parentNode.parentNode.lastChild.innerHTML;
                            x.getElementsByTagName('img')[0].parentNode.innerHTML += '<br><span class="forum-location">Forum Location: ' + data + '</span>';
                        }
                    }
                });
            }
            else {
                x.getElementsByTagName('img')[0].parentNode.innerHTML += '<br><span class="forum-location">User is offline.</span>';
            }
        });
Is it possible to have it with your style?
Tonight
Tonight
Forumember

Male Posts : 312
Reputation : 80
Language : Estonian, English, Russian
Location : Estonia

Back to top Go down

In progress Re: Profile Viewing ?

Post by Ange Tuteur January 26th 2015, 10:46 pm

@Tonight if the user is not in the online list, it'll display "offline". If you're looking at your profile it'll display what you're doing "viewing who is online". If you use another account that is viewing a specific forum, it'll say that they're viewing that forum like in the example.
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

In progress Re: Profile Viewing ?

Post by Tonight January 26th 2015, 10:59 pm

Yeah, I used a friend for testing, he was looking at a topic, but it showed Viewing who is online.

// Tested again and it still isn't working for me. Might there be other script causing the problems (for example Profile Song)?
Tonight
Tonight
Forumember

Male Posts : 312
Reputation : 80
Language : Estonian, English, Russian
Location : Estonia

Back to top Go down

In progress Re: Profile Viewing ?

Post by Ange Tuteur January 26th 2015, 11:09 pm

@Tonight not at all. It all comes down to how the /viewonline page logs what the member is viewing. If you directly view a topic it'll display the last place you were in /viewonline. Here's an example :

I'm on the forum index, and I click on a topic in latest topics. => The person viewing my profile or /viewonline would see me viewing the forum index still.

Now if I go to the forum which has the topic, let's call this forum "Important" and then click on a topic in this forum. It'll show that I'm viewing the "Important" forum still.

The /viewonline list doesn't log topics, only specific locations such as forums, searches, etc...
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

In progress Re: Profile Viewing ?

Post by Matrix317 January 27th 2015, 8:03 am

Ange Tuteur wrote:@Tonight not at all. It all comes down to how the /viewonline page logs what the member is viewing. If you directly view a topic it'll display the last place you were in /viewonline. Here's an example :

I'm on the forum index, and I click on a topic in latest topics. => The person viewing my profile or /viewonline would see me viewing the forum index still.

Now if I go to the forum which has the topic, let's call this forum "Important" and then click on a topic in this forum. It'll show that I'm viewing the "Important" forum still.

The /viewonline list doesn't log topics, only specific locations such as forums, searches, etc...
Okay, it somehow. Smile
if it did not appear when I went to my view Cpanel or topic.
avatar
Matrix317
New Member

Posts : 21
Reputation : 1
Language : England

http://testaillla.foorumi.biz/forum

Back to top Go down

In progress Re: Profile Viewing ?

Post by Ange Tuteur January 28th 2015, 1:57 am

Matrix317 wrote:Okay, it somehow. Smile
if it did not appear when I went to my view Cpanel or topic.
I'm sorry, but I could not comprehend what you're trying to say. scratch
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

In progress Re: Profile Viewing ?

Post by _Twisted_Mods_ January 28th 2015, 2:27 am

ange does this script run on post profiles?

nm i looked at it and it does not ..

but i have idea for this when i get some time ... when you visit a page it post to a profile field .. only prob is if they close the page or logout it will still show the last page they was on
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2108
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

In progress Re: Profile Viewing ?

Post by Ange Tuteur January 28th 2015, 2:34 am

No, but it can certainly be modified to. I just think that if you have a lot of messages per page it could cause a handful of requests, so caching the results would definitely be something you'd want to do.. The one I posted is only for phpbb3, so if you want to support all versions this is the one you want..
http://fmdesign.forumotion.com/t280-display-user-activity-in-the-profile
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum