I`m creating a simple social network site, I need to implement a sophisticated friend request system, one which works like facebook, this will work as follows: If James wants John to be his friend, he will click John's name. John will be notified that James has asked to be his friend( notification will appear on John's profile page) John will then need to agree for James to be his friend. Once agreed, they will both be friends.
And I would also like to restrict access to the user's profile to people who that users friends, in orther words, if the logged in user is trying to view a profile of someone who is not their friend, they should not be able to.
Anyone who have idea on how i can solve this i will really appreciate.
shibobo2001
0
Newbie Poster
Recommended Answers
Jump to PostWell you would need some kind of 'friend' table that would link together the different user_ids. It could also have an 'active' flag on it that represents whether a request is pending or active (0 for pending, 1 for active). Depending on how the login system works, if you use …
Jump to PostOk so for the friends table (this is a basic example) you could have 3 fields:
user_id(int), friend_id(int), active(bool)
when a user decides to add a friend you put the original user_id in the user_id field. The id of the member they want to add goes in the …
Jump to PostOk so assuming $arrFriendList from the previous example holds all the user_ids of the friends you then use these in a query against the user table. Again there will be a more efficient way to do this probably but it would go something like:
$Friends = ""; …
Jump to PostHi, I'm Maxi from Argentina, and I'm here looking for something very similar to what shibobo2001 is asking for.
In my case I'm trying to integrate a phpBB forum with a custom portal I'm developing, but the friend system of phpBB doesn't really works for me.
phpBB comes with this …
All 13 Replies
TommyBs
1
Junior Poster in Training
shibobo2001
0
Newbie Poster
TommyBs
1
Junior Poster in Training
shibobo2001
0
Newbie Poster
TommyBs
1
Junior Poster in Training
Charca
0
Newbie Poster
akshaygupta1311
commented:
10
+0
shibobo2001
0
Newbie Poster
ksureshraju
0
Newbie Poster
vizz
0
Junior Poster
justted
0
Junior Poster
kingmak3r
0
Newbie Poster
sandeep2147
0
Newbie Poster
Brian_3
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.