Recent Tutorials
Who is online?
In total there are 7 users online :: 2 Registered, 0 Hidden and 5 Guests

djblah, SLGray

[ View the whole list ]


Most users ever online was 172 on Fri 19 Feb 2016, 05:17

Display how many times a profile was viewed

View previous topic View next topic Go down

avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4675
Points : 9689
Reputation : 2331
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Fri 30 Jan 2015, 00:08

This plugin will allow you to display and log how many times someones profile was viewed. This is the first plugin for the database which will work on any version. Wink



Creating a new table

If you haven't set up your database, please read over this topic : http://fmdesign.forumotion.com/t281-installation-a-database-for-your-forumotion-forum

Otherwise, go to your database, and click "New table" to create a new database table. In the textarea, paste the following code, and click submit.
Code:
[table id="fa_views" class="database_table"][tr][td]Username[/td][td]Views[/td][/tr][/table]


Let it process your request, and the new table should be ready for us to use. Smile


Installation

If you want the style for the view module like in the example, go to Administration Panel > Display > Colors > CSS stylesheet, and paste the following code.
Code:
.fa_views { color:#999; text-shadow:1px 1px 0 #FFF; text-decoration:none; text-align:center; font-size:11px; font-weight:bold; background:#EEE; border:1px solid #CCC; border-radius:3px; display:block; padding:5px 3px; margin:5px 0; }


Now, to install the plugin, go to Administration Panel > Modules > JavaScript codes management, and create a new script.

Title : fa_views
Placement : In all the pages
Code:
window.location.pathname.match(/\/u\d+/) && $(function() {
  var pid = 279, uid = window.location.pathname.match(/u(\d+)/)[1], mod = '#profile-advanced-right .module:first',n;
  $('.bodylinewidth').length && (mod = 'td[width="300"] .forumline:first td.row1.gensmall');
  $('.pun').length && (mod = '#profile-advanced-right .module:first .main-content');
  $(mod).append('<div class="fa_views">Profile views : <span id="view_total">0</span></div>');
  $.get(_database.tid, function(data) {
    n = $('#fa_views #u'+uid+'_views',data);
    n.length ? n = Number(n.text()) + 1 : n = 1;
    document.getElementById('view_total').innerHTML = n;
    _database.post({
      pid : pid,
      tableid : 'u'+uid+'_views',
      update : ['\\[td id="u'+uid+'_views"\\]\\d+\\[/td\\]','[td id="u'+uid+'_views"]'+n+'[/td]'],
      newRow : '[tr][td]'+document.title.match(/^.*? - (.*)$/)[1]+'[/td][td id="u'+uid+'_views"]'+n+'[/td][/tr]'
    });
  });
});

In the script, where you see YOUR_PID, you need to replace this by your database table's post ID. To find this ID click "edit database", then edit the post which holds your new table. Right in the address bar will be your PID, copy and paste this where YOUR_PID is.


When you're finished, save the script, and you should be ready to go ! To ensure that the installation was successful, make your way to a few profiles, and then return to your database. If the installation was successful, you'll see those profiles logged in the database table. Thumb left



If any problems or questions, let me know. Enjoy ! Mr. Green
avatar
Beyonder
Member
Title :
Gender : Male
Age : 20
Posts : 18
Points : 1250
Reputation : 6
Location : Beyond Realm
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://narutorpguniverse.forumotion.com

PostBeyonder on Sat 30 May 2015, 01:19

Does it take long for a new table?
avatar
Beyonder
Member
Title :
Gender : Male
Age : 20
Posts : 18
Points : 1250
Reputation : 6
Location : Beyond Realm
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://narutorpguniverse.forumotion.com

PostBeyonder on Sat 30 May 2015, 15:00

Sad it isnt working for me.
avatar
Beyonder
Member
Title :
Gender : Male
Age : 20
Posts : 18
Points : 1250
Reputation : 6
Location : Beyond Realm
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://narutorpguniverse.forumotion.com

PostBeyonder on Sun 26 Jul 2015, 07:30

Bump?

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

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