#1  
Old 04-25-2008, 01:59 AM
Raymond Benc's Avatar
Raymond Benc Raymond Benc is offline
phpFoX Developer
 
Join Date: Aug 2005
Posts: 3,860
Thanks: 77
Thanked 1,160 Times in 309 Posts
Feedback Score: (3)
Raymond Benc has disabled reputation
Default [1.6.20] Common Friends (Hook)

Plugin Version: 1.3

I was browsing Facebook earlier and wanted to create a quick mod for us. Thought the "Common Friends" feature would be handy. Browsed our forums and found there was already a mod similar to this which can be found here.

With this version of that mod it uses the hook system introduced with v1.6.20 so in order to use this plug-in you will need that version installed. Decided to use that method to create the plug-in instead of creating it as a module so we can release an example of how to use the hook system.
However if you don't have v1.6.20 installed and you are still using an older build or even v1.5.1 there is a hack to get this working on those versions as well. To view this hack check out the "Extra Hacks" section below.

The "Common Friends" block will look similar to the "My Friends" block found on a users profile. For a better idea of how the mod looks check out the screen shot attached with this thread. The plug-in also includes a "View All" page where the user can view all the friends they have in common with the user they are viewing.

I ran a few tests and all is working fine on my end, but I tested it locally and the best way to test this sort of plug-in is on a live community where users have a lot of different friends. So if you do install this plug-in let me know how it goes.

Okay lets get to the good stuff.

To install/upgrade the plug-in...

1) Download the ZIP "CommonFriends.zip" attached with this thread.

2) Unzip it and you should find the following folders:
Code:
Content visible to registered users only.
Upload those folders to your sites root directory.

3) Rename the file
Code:
Content visible to registered users only.
to
Code:
Content visible to registered users only.


4)
Login into your Admin CP and navigate to:
Code:
Content visible to registered users only.
Then make sure the setting:
Code:
Content visible to registered users only.
is set to: Yes

Next make sure the setting:
Code:
Content visible to registered users only.
is set to: No

Next make sure the setting:
Code:
Content visible to registered users only.
is set to: No

That's it. Visit a user you know you are friends with and might already have friends in common to test out the plug-in.

By default the plug-in will list 6 common friends. To change this open the file:
Code:
Content visible to registered users only.
Then look for:
Code:
Content visible to registered users only.
Change the 6 to any number you want. Good idea would be either 9, 12, 15 etc...

In that file you will also notice:
Code:
Content visible to registered users only.
These are the phrases used for the plug-in. By default the header of this block is "COMMON FRIENDS". Feel free to change that to anything you want. If anyone is interested to use this on multilingual sites let me know and I can write up a quick guide on how to add the phrases into a language package.

More tests need to be done so if you do install the plug-in let me know if you run into any problems.

Extra Hacks

Here are some extra hacks you can do to improve or change the functionality of the plug-in.

Get this plug-in working on v1.5.1 or any v1.6.x build.

Follow the install steps above. When getting to step 4 just skip that step and instead open the file: /design/templates/default/public/user/index.html

Look for:
Code:
Content visible to registered users only.
Above that add:
Code:
Content visible to registered users only.
You should then be good to go.



Add the Common Friends Block under My Friends

By default I have added the Common Friends block above the My Friends block. If you would like to add it under the My Friends block instead rename the file:
Code:
Content visible to registered users only.
to
Code:
Content visible to registered users only.
Multilingual Support

If your site has more then one language package installed you can do the following to make sure this plug-in can work on all language packages.

1) Open the file
Code:
Content visible to registered users only.
Then look for something similar to:
Code:
Content visible to registered users only.
With this example I will just work with the phrase "COMMON FRIENDS" which is the header of the block for this plug-in. So the part we are going to be working with is:
Code:
Content visible to registered users only.
2) Login into your Admin CP and navigate to the "Phrase Manager"

3) Click on "Add New Phrase"

4) For the "Varname" insert:
Code:
Content visible to registered users only.
The reason I used "common_friends" is because the phrase being used is
Code:
Content visible to registered users only.
5) For the "Text" of each language package you have installed simply insert
Code:
Content visible to registered users only.
This will work for the default English language package so for the other language packages you will need to translate it. Once you have done that click on save.

6) Once you have added the phrase you should get a message simliar to this:
Code:
Content visible to registered users only.
The part we will be using is:
Code:
Content visible to registered users only.
7) Now go back to the file
Code:
Content visible to registered users only.
and look for
Code:
Content visible to registered users only.
and replace that with
Code:
Content visible to registered users only.
As you may have noticed the part we added is:
Code:
Content visible to registered users only.
all we need to do is add the variable for each phrase which in this case 'common_friends' was created. That's it, you should then have a phrase created for each language package. Follow the same steps for the other phrases and change only the actual "varname" and "text".
Attached Images
File Type: jpg commonFriends.jpg (14.7 KB, 552 views)
Attached Files
File Type: zip CommonFriends.zip (5.5 KB, 293 views)
__________________
Regards,
Raymond Benc (phpFoX Developer)
/**
*
@ Blog | Twitter | My Mods
*/

Last edited by Raymond Benc : 05-16-2008 at 02:35 PM.
The Following 34 Users Say Thank You to Raymond Benc For This Useful Post:
ajmboy (04-25-2008), Altan (06-28-2008), azjr247 (04-25-2008), borosound (10-05-2008), c2play4cam (01-24-2009), Cfriskme (01-19-2009), chemosi (12-14-2008), chodhry (04-25-2008), coolwurkz (04-25-2008), dude (04-29-2008), forestclown (05-22-2008), JANEMARCIA26 (07-23-2008), knowzdamnwell (04-28-2008), kraze2007 (04-29-2008), Kribba (04-25-2008), Matrix (05-20-2008), metro (04-27-2008), Mindsplitter (11-16-2008), myfuecom (04-25-2008), myonit (05-10-2008), nemo (04-28-2008), ourlordsfriends.com (08-12-2008), Pdog89gt (01-19-2009), profilebooth (07-11-2008), RainbowWarrior (11-20-2009), robit (08-18-2008), rossmilne (01-03-2009), SlideRiceFC (04-28-2008), tenaki (01-24-2009), thunder88 (01-24-2009), tresavon (01-28-2010), Vincent_C (04-25-2008), waleric2 (04-28-2008), zaidey (06-10-2008)
  #2  
Old 04-25-2008, 02:05 AM
coolwurkz's Avatar
coolwurkz coolwurkz is offline
3rd Party Developer
 
Join Date: Nov 2006
Location: Philippines
Posts: 3,590
Thanks: 250
Thanked 742 Times in 392 Posts
Feedback Score: (11)
coolwurkz will become famous soon enough
Default

testing now
__________________
Teamwurkz Zones - Get Your Unlimited Premium Phpfox Themes NOW!
Over 50 mini mods! Plus EMAIL Templates
Please contact us here for support

Get the news and latest updates! follow us
  #3  
Old 04-25-2008, 02:19 AM
coolwurkz's Avatar
coolwurkz coolwurkz is offline
3rd Party Developer
 
Join Date: Nov 2006
Location: Philippines
Posts: 3,590
Thanks: 250
Thanked 742 Times in 392 Posts
Feedback Score: (11)
coolwurkz will become famous soon enough
Default

hook system nice :) just tested this works great so far.
__________________
Teamwurkz Zones - Get Your Unlimited Premium Phpfox Themes NOW!
Over 50 mini mods! Plus EMAIL Templates
Please contact us here for support

Get the news and latest updates! follow us
  #4  
Old 04-25-2008, 03:33 AM
knowzdamnwell's Avatar
knowzdamnwell knowzdamnwell is offline
phpFox Guru
 
Join Date: May 2007
Location: Virginia
Posts: 174
Thanks: 85
Thanked 28 Times in 22 Posts
Feedback Score: (0)
knowzdamnwell is on a distinguished road
Send a message via Yahoo to knowzdamnwell
Default

I just installed your plugin and so far working perfectly :D
__________________
running 2.0.3

Man! The only animal to fear
  #5  
Old 04-25-2008, 05:09 AM
alexdale alexdale is offline
phpFoX Wannabe
 
Join Date: Apr 2008
Posts: 36
Thanks: 1
Thanked 1 Time in 1 Post
Feedback Score: (0)
alexdale is on a distinguished road
Default

thos mod works great, but is it possible to show a "[view all common friends]" link? i got a friend and we have like 200+ friends in common. Wanted it to have a separate page for viewing all commong friends just like "[view all my friends]".
  #6  
Old 04-25-2008, 06:41 AM
parmenti's Avatar
parmenti parmenti is offline
phpFox Fanatic
 
Join Date: Dec 2006
Posts: 1,035
Thanks: 91
Thanked 96 Times in 57 Posts
Feedback Score: (3)
parmenti is on a distinguished road
Send a message via AIM to parmenti Send a message via MSN to parmenti Send a message via Yahoo to parmenti
Default

yes, agreed... the other post on the forums already has this feature which I have implemented on my site already.. does this hook version allow for this? thanks
  #7  
Old 04-25-2008, 07:24 AM
myfuecom's Avatar
myfuecom myfuecom is offline
phpFoX Junior Guru
 
Join Date: Nov 2007
Posts: 72
Thanks: 12
Thanked 4 Times in 4 Posts
Feedback Score: (0)
myfuecom is on a distinguished road
Default

looking forward to more use of the hook system, thanks natio. hopefully soon installing a mod will be as easy as the plugin system on vbulletin

way to go :)
__________________
"Puzzled at the sheer mention of CODE"
  #8  
Old 04-25-2008, 07:33 AM
webmasterx's Avatar
webmasterx webmasterx is offline
phpFox Fanatic
 
Join Date: Mar 2008
Posts: 2,044
Thanks: 75
Thanked 508 Times in 263 Posts
Feedback Score: (-1)
webmasterx is on a distinguished road
Default

how can i make it appear below the friends list on profiles?

p.s. a view all feature would be great
__________________
Tutorials::General
PHP For beginners | Learning AJAX

Tutorials::phpFoX
How to mod phpFoX 1.6 | phpFoX ajaxCall

PHP Code:
return self::CODE_NAME#Rawr 
  #9  
Old 04-25-2008, 03:26 PM
boostedtofu boostedtofu is offline
phpFoX NewBie
 
Join Date: Feb 2008
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Feedback Score: (0)
boostedtofu is on a distinguished road
Default

A view all friends in common would rock!
  #10  
Old 04-25-2008, 10:41 PM
ajmboy's Avatar
ajmboy ajmboy is offline
phpFox Fanatic
 
Join Date: Feb 2006
Posts: 2,891
Thanks: 112
Thanked 157 Times in 115 Posts
Feedback Score: (1)
ajmboy is an unknown quantity at this point
Default

I guess the hook system is only build 20..right? Still using build 19 on one of my sites...

NATIO, did you see the badge option in facebook when you were browsing there?

http://forums.phpfox.com/showthread....facebook+badge

Would make a great mod to promote communities on other sites!

Thanks for the FREE Mod!
__________________
Running 1.6 build 21 and Version 2.01, vBulletin plugin, VBSEO, & PHPFOXSEO
Using Platinum Server Management
The Following User Says Thank You to ajmboy For This Useful Post:
borosound (10-05-2008)
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 07:02 PM.