Jump to content

[SOLVED] "friends" script


LanceT

Recommended Posts

Anyone know how I would go about constructing a "friends" function sort of like a buddylist thing. An example would be on Myspace where someone will add people as their friends, then the person added needs to confirm the friend add and then both are friends.

I'm not quite sure how I would even go about constructing this kind of function, any hints? Thanks.
Link to comment
Share on other sites

Create a table like this:

TABLE friends
friendID (the person they are adding)
requesterID (the person who added them)

and this...

TABLE friend_requests
friendID
requesterID

When they want to make a request to be someones friend add the info to the friends request table, then you can display somewhere on your site where they can accept/decline them. If they accept add the info to the 'friends' table.

This is a pretty simple concept...so I'm not sure what else I could say. If you don't understand something, let me know.

Link to comment
Share on other sites

[quote author=pocobueno1388 link=topic=124474.msg515785#msg515785 date=1170031566]

TABLE friends
friendID (the person they are adding)
requesterID (the person who added them)



[/quote]

friendID and requesterID are the same thing. The person they are adding and the person who added them? That doesn't make sense.

For example, person 1 makes a request to be friend to person 2, the person they are adding is person 2 and the person who added them ("them" referring to person 1) is still person 2.

Please clarify it a little bit.

I kind of understand what you are saying, but also, I need person 1 and person 2 to both appear in eachother's profiles under friends. In this case, wouldn't it only go onto one person's profile?
Link to comment
Share on other sites

Have a table full of friend requests.

Structure it with a field for the person requesting to be friends with, and for the person being requested of, and the status of the request i.e pending, accepted etc. (delete rejected requests)

You can then display the accepted requests as you please.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.