Helping you Build Your Own Social Network!

Faster, better and easier!

Buddypress Recent Profile Visitors Plugin

Jotted by Brajesh Singh in Buddypress, Buddypress Premium Plugins, Plugins, premium on February 23, 2010
We are Hiring new WordPress/buddyPress developers

I promised in the beginning of Buddydev for this plugin, so I got some time yesterday and made it work.

Buddypress recent Profile Visitors Plugin shows the most recent profile visitors on a user profile. The profile visiting recording can be turned on/turned off by a user.

here is a screenshot to show how it looks.

recent-profile-visitors

If you don’t want to show your visits to other user’s profile, You can disable from the settings->Recent Visitors options as shown below

recent-visitors-settingsPlease note, if you turn off the profile visits, It will not show you who visited your profile. I just wanted to make it fair enough, so it is mutual, if you want to see who visited your profile, keep the settings on. Once you turn the settings off, It will not record any data for you.

The settings are user specific.

How to Install

1. Download the plugin from here http://buddydev.com/download/recent-visitor-for-bp.zip
2. Unzip recent-visitor-for-bp.zip
3. Upload recent-visitor-for-bp folder to wp-content/plugins
4. Go to Wp Admin->Plugins->Installed and activate “Bp Recent Profile Visitors”
5. Let the plugin do its magic.
Alternatively, you can use wp-admin->Plugins->Add New, click on the upload tab and browse this zip file, upload and click activate, you are done.

How to Use

If you are using Buddypress 1.2 default theme or the Buddypress child theme for bp-default, The recent visitors are automatically displayed at the profile using the action hook “bp_after_member_header”, otherwise, you can always call


visitors_show_my_recent_visitor();

It will list the most recent 5 visitors

Code snippets:-

Some example codes


$total_unique_visitors=visitors_get_unique_visitors_count($user_id);//if you  do not  provide user id, it will show that for displayed user

$total_profile_visit=visitors_get_profile_visit_count($user_id);//this returns total profile visits, which includes multiple visits by same user

/** Get the $n most recent visitor of $user_id**/

$users=visitors_get_recent_visitors($user_id=null,$count=5);//return array of users, manipulate them

Hope you will like it :) Looking forward to hear more for the enhancement.

NOTE: This is a premium plugin and only available to buddydev premium members.

Please join buddydev premium to access this plugin(with many other plugins too), It gives you access to all our premium plugins/themes and support forum for as low as $30, check out buddydev premium to find more.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • BlinkList
  • DZone
  • FriendFeed
  • IndianPad
  • MySpace
  • Netvouz
  • Reddit
  • SphereIt
  • StumbleUpon
  • Technorati

Related posts:

  1. BP Redirect to profile Plugin :redirect Users to their profile on Login on buddypress sites
  2. BP Flickr Plugin- Allow your users to show their latest flickr images on their BuddyPress profile
  3. Plugin BP Auto activate Auto Login-redirect to profile, automatically activate your new user signup, log them in and redirect to their buddypress profile on signup
  4. Introducing BuddyPress Message Privacy Plugin
  5. Allow your users to change their Profile page background using BP Custom Background For User Profile Plugin

45 Responses to Buddypress Recent Profile Visitors Plugin

  • Cool one, Brajesh.
    Btw, Stealth Mode for Admin must be “off” or else Admin’s visit won’t be recorded, as I found out :-)
    Thanks.

    • Thanks for the comment Mercime.
      This plugin does not take into account the stealth mode. Should I make it compatible with stealth mode for admin.
      Looking forward to your views.
      It has its own settings page, under settings for enabling/disbling recording. By default, the visit recording is enabled.

      Thanks
      Brajesh

  • Very nice Brajesh!

    One problem though: although recent visitors’ avatars do show where they should, the Recent Visitors Options don’t show in Profile Settings.

    Any ideas?

    • That was an expected issue. The problem is Buddypress does not provides any hook to add the settings on general settings page, And I don’t want to add the settings to notification page, as These can not be considered as notification.

      So, I tried to add the new settings page, which works, but depends on the loading order of plugins. If Buddypress loads earlier, It works, otherwise it does not.
      try to deactivate the plugin and rename it to something like “xyz visitor”, that will delay its load and will make it work.
      I will post a question in IRC/buddypress forum to get Andy’s/JJJ’s view/solution on this.

      • @Brajesh

        Sadly, that didn’t work. I’ll wait… this isn’t something that I consider essential, like Gallery! Thanks for all your hard work on that, by the way!

  • Hi Brajesh

    do I get that right, that it only shows to the owner of the profile, but not any visitor?

    Second question: I shortly did a german translation for it. I named the file recent-visitor-for-bp-de_DE.po and put it in the folder. It doesn’t work.
    I don’t have any experience creating language-files… Where do I have to put the file and how does it need to be named?

    Thanks…
    Ps: Cool addition…

  • Another question: Would it be possible, to deactivate the settings-page altogether. I think it is not necessary and just one option more for the confused normal visitor. If you could make it optional or just hand me, how to hack the code :-)

  • Hi,
    does it runs with the single WP?
    Thanks
    Helge

    • hi Helge
      Yes, It will work with single wp+bp 1.2+. If you are using default theme, It will show up automatically on profile page(obviously after someone visits your profile after activatinbg this plugin).
      If you are not using the default theme, please take a look at the post, you may have to put a function in your themes profile page.

  • Do you think this could be modified to work with posts? Posts’ Recent Visitors? If so what could be done you think. thanx

  • yes, what about other bp components like groups , maybe even forums & a sitewide blogs widget- latest visitors ,maybe even specific post/page visitors like Navo mentioned , almost feels like the next step could be filtering users based on same topic visits , same group visits ,ect…. a visual interpretation of avatars/users having something in common but this is just me thinking so it needs to resonate and i may be completely off .
    it sounds interesting to me , lets see if i feel the same after my first cup of coffee,lol great work Rajish !

    • “…a visual interpretation of avatars/users having something in common” that’s exactly it. it makes perfect sense… :) with a post i guess the same effect could be done simply by taking comments avatars and displaying them by user photo grid but it wouldn’t include members who don’t comment.

      • Well, I think We need a versatile component.
        Implementing for next release :) Will allow you to hopefully track everything, but will that be good, I dunno :D

  • hey we can go very,very far with something like this but later … Here is just an example to how far we can go but later (unless Rajish askes me to get involved ).
    I am obviusly talking 3.0 semantics widget/plug that generates avatars/topics of members friends who match up to visitors interests and this would be the easy part that my team will modd ourselves if we need to do it .

    The more interesting part (also not hard at all) would be using an api i know that will not only give visitors matching members based on internal community meta but will show a visiting user membersof community who match up to that users External meta – based on keywords they used when serching around or even meta from websites they came from , the results are based on fresh super relative action based external meta users bring with them from interacting on the way to our community data.

    There is such an option already available , we can all use in our projects but this is something that would have to be discussed in another post or a more appropriate place and Rajish if you need any details on such things, u know where to find me so now lets get back to BEGINNING:

    for now i think we should suggest things that could be implemented in the next upgrade…

    think towards providing this option for other bp components not just the profile..
    I would be interested in being able to see who last visited a specific group or specific blog or forum thread, this would be more then just useful to many and my current project where i could test and display some extra mods we my add ourselves, who knows .. Lets rock this thing out !

    ps. im starting to take an hour or two for play time per day and will start devoting much more to such developments , its just a joy to be part of this,
    thanx Rajish i finally got a Premium/Pro account with you yesterday based on your original direction which i mentioned months ago, remember !

    • hi Robert
      Thanks for the comment. Yeh, I guess, The first idea needs a better place(May I suggest, we may discuss that in forum :) )

      For the second, making the functionality available to each of the component, yes, that is what In my plan for the next update. Just thinking about the flexibility we want to provide siteadmin/group admins and users to opt in/out of such thing.

      It is going to come soon. :)

      btw, thanks for joining BuddyDev, I hope you would like the plugins available and look forward to assist you more in your projects :)

  • Hi Brajesh,
    I am premium member, this plugin is really good, working fine.
    I have small problem, in my theme at member header, it dispalys like
    ————————————————–
    Recent Visitors

    [img]
    ————————————————–

    as in my memb-header is wide, it looks like heading and img have no relationsship!!,. so I want to display like
    ————————————————–
    Recent Visitors
    [img]
    ————————————————–
    I guess I have to change in below code, but am not good at php coding, I can`t change css settings of my theme..

    if(empty($recent_visitors))
    return;//if no visists yest, do not show at all
    $output=”
    Recent Visitors”;
    foreach($recent_visitors as $visitor){
    $output.=visitors_build_visitor_html($visitor);
    }
    plz tell me how can i modify, without distrubing my theme settings, may be have to add seperate settings than h5..

    Thanks
    Praveen
    http://www.techflourish.com

  • In above comment Heading “Recent Visitors” displays at the center of member-header,
    but i want to display at the left-hand side…

    plz check at
    http://techflourish.com/mem_header_display.jpg

    Thanks
    Praveen

    • hi Praveen
      Thanks for the comment. Just checked your screenshot.
      It is most probably a css issue. Is it easy for you to change the css?

      Since you mentioned, you have issues with PHP, php editing will not be required if you can change css.
      Please check using firebug, and try to put something like

      .recent-visitors h5{text-align:left;}

      That should do it.
      If it does not work, please point me to the live installation(or PM me if the site is private) and I will post the css for doing that.

      • Hi Brajesh,

        Thanks a lot for your support, If you tell me where exactly I have to add, i can do it,. or give me ur email-id where i can send my theme css files, or do u need ftp login to my site?

        regards
        praveen
        praveen@techflourish.com

        • Praveen
          It should be added to the css file(hopefully style.css) of your theme.
          Just sent you a mail. Please send me the theme, I will edit and send you back in minutes :)

          Thanks
          Brajesh

  • Hi Brajesh,

    - is this Plugin compatible with WP 3.0 and BP 1.2.4.1 ?
    - is this Plugin working when ACtivity-Stream is disabled ? ( I just have Groups and Forums at my website).

    Many thanks,

    • hi Erich73
      Thanks for the comment. Have not tested with a new install of wp3.0 but there are no reasons why it should not work and it has nothing to do with activity stream.

      Let me check it now, will post back in 15 minutes.

      Thanks
      Brajesh

    • Just checked now. yes, It works with wp 3.0/wpms 3.0 and it has no effect whether you have other components disabled/enabled.

  • Hi, I’m using this plugin and it’s working. However I created a widget to call visitors_show_my_recent_visitor($user_id); in my sidebar, but it displays visitors for current profile being viewed when I want to view my visitors only. Am I doing something wrong?

    • It will not work.

      visitors_show_my_recent_visitor();

      does not take any argument and work for displayed user only.

      Though you can use visitors_get_recent_visitors($user_id,$num) and then iterate over the return array to show the list of the visitors, It is in no way elegant.

      I will be providing another function in the API to allow you do this. The update should come by 10th July.

  • I had another question, is there a simple way to display more than 5 recent visitors? Thanks.

    • Currently you will have to manually change it in the code of visitors_show_my_recent_visitor where we are calling visitors_get_recent_visitors, I am modifying it and it will be easy to do in next version.

  • i Brajesh,

    Can we have this as a widget? I would like to see the users who visited my profile in the sidebar, since header is getting cluttered.

    Also when i visit some other users profile I should not be able to see who visited their profile or my profile visitors either.

    thanks.

  • hello. i want to ask how to make this plugin working with bp mag theme. and i realy don’t know where should i add the code and what is the code.

  • The version of buddypress of my site is 1.2.8.

  • Is this turned on for each member by default? If not is there a way I could have it turned on for all members?

  • Singh, love you plugins!
    And now I also found this!
    I want to add them to a widget instead of below the profile.
    You mention in one of your posts you will release an API..can I add the plugin to a widget now or?
    My plan is to make it work with the Achievement plugin, so my users can “unlock” this feature when they reach a certain score.
    This might be more advanced, but If I can have them shown in a widget to start with that would be a great start.

    Any direction or tip would be MUCH appreciated :o )
    Keep up the good work!

    Kind Regards Dan

    • Hi Dan,
      sorry i could not reply to you earlier.
      Please let me know if you are still interested in the iidea of widget? I will put it for you.

  • Hi, i just installed the plugin, the options in the settings are displayed, but i am not using the default buddypress theme, and i was wondering if that is why i cant se any visitors?

    any tips?
    regards Chris

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get Adobe Flash playerPlugin by wpburn.com wordpress themes