User Relationships CMS PHP

1,171 views

Published on

Create relationships between users in ProdigyView. Can be used for developing social networking websites.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,171
On SlideShare
0
From Embeds
0
Number of Embeds
21
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

User Relationships CMS PHP

  1. 1. User Relationships www.prodigyview.com
  2. 2. OverviewObjectiveLearn to create relationships between users, similar tosocial networking sites.Requirements Install version of ProdigyView with a database connection Understanding of how to create a userEstimated Time10 Minutes www.prodigyview.com
  3. 3. Follow Along With Code Example1. Download a copy of the example code at www.prodigyview.com/source.2. Install the system in an environment you feel comfortable testing in.3. Proceed to examples/user/UsersRelationships.php
  4. 4. Having A RelationshipHaving a relationship is nothing easy. It takes time,commitment, lot of moneys and sometimes lots ofchocolate to feel loved if you are being neglected.Thankfully in ProdigyView all you need to have is morethan one user and you can define a relationship betweenthem. We will be covering in tutorial: Creating a relationship Checking if a relationship exist Modifying a relationship Deleting a relationship(breaking up) www.prodigyview.com
  5. 5. Add Some UsersOur example starts by first creating some users. If you arefollowing along in the code example, there are two moreusers created besides the two below.
  6. 6. Creating A Relationship Now that we have our users present in the database, we can start creating relationships. It takes two to make this thing go right, so we at least require two users, a relationship type, and relationship status.1. Add the first user 2. Add the second user 4. Add the relationship status. Meaning of3. Set the relationship type numbers is set by you. Example 1 could be ‘accepted’ and 0 mean ‘pending’.
  7. 7. Database ViewYour database should look something like after adding theusers. www.prodigyview.com
  8. 8. Searching RelationshipsNext we can search through our relationship usinggetUserRelationshipList() method. The method uses PVStandard Search arguments when querying formatches.1. Search for users based on the requesting users field 2. The ‘,’ symbolizes an OR used in SQL3. Returns the relationships as an array of arrays
  9. 9. Compare RelationshipsSince we are pulling out our users, lets do some comparisonsusing the checkUserRelationship(). This method checks ifthere is an relationship among users. Explanation on nextslide. www.prodigyview.com
  10. 10. Comparison Explanation 1. Iterate through the 2. Get the users information based on their relationships user_id in the relationship3. Print out the found relationship type 4. Check is there is any relationship based on the two users ids 5. Results on next slide
  11. 11. The Comparison ResultsIf they are suppose be a family, something is definitely off.
  12. 12. Removing A RelationshipObviously the relationships were not quite working out soit’s time for everyone to go there separate ways. I guessthat means it’s time to delete some relationships. Delete the relationship by passing in the relationship id www.prodigyview.com
  13. 13. Review1. Add a relationship PVUsers::addUserRelationship()2. Check if a relationship exist by using PVUsers::checkUserRelationship().3. Search for user relationships with PVUsers::getUserRelationshipList()4. Delete a user relationship with PVUsers::deleteUserRelationship() www.prodigyview.com
  14. 14. API ReferenceFor a better understanding of the users, visit the api byclicking on the link below.PVUsers More TutorialsFor more tutorials, please visit:http://www.prodigyview.com/tutorials www.prodigyview.com

×