User Management Basics CMS PHP

2,910 views

Published on

Learn how to use part of ProdigyView CMS, the user management. Create, update, login and delete users.

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
2,910
On SlideShare
0
From Embeds
0
Number of Embeds
23
Actions
Shares
0
Downloads
36
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

User Management Basics CMS PHP

  1. 1. User Management Basics www.prodigyview.com
  2. 2. OverviewObjectiveLearn to create, update, delete, and login users inProdigyView.Requirements Install version of ProdigyView with a database connectionEstimated 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/Users.php
  4. 4. Users….what about themA user…a better term would be end users… are probably thelife source of what ever you are building. Without saying, youneed a way to manage them. For this tutorial we are going tocover: Creating Users Logging In Updating Users Searching for Users Deleting UsersAspects such as user roles, content multi authors, roles,access levels, etc will come later.
  5. 5. Creating A User Creating a user is fairly simply. Fields are added to an array and passed to PVUsers::addUser() method. Technically the only field required is the user’s email but lets define some other fields. 1. Create the fields 2.Passwords will be MD5 encoded3. Pass arguments to addUser 4. If set to false, the password is not considered hashed and will be hashed
  6. 6. Attempt Login Now that we have a user and we want them to login with their email or username. Let’s give it a try.1. Pass the user’s email 2. Pass the user’s password in 3.Set the cookies on login 4. Check if the user is logged in www.prodigyview.com
  7. 7. Force LoginSometimes we need to forcefully log the user in withoutpassword verification. This can be done throughPVUsers::loginUser(). Either pass in the user’s name orthe user’s email. www.prodigyview.com
  8. 8. Retrieving the User InfoWe have a user in the database and will at some pointneed to retrieve their information. If the user’s email or idis known, their information can be retrieved through thosevalues.1. Retrieve a user’s information using their id 2. Retrieve a user’s information using their email
  9. 9. Searching For usersLet’s say we have multiple user’s with our growing siteand we need to somehow search for them based oncertain criteria. Take a look at the ProdigyView’sStandard Search Arguments and combined withPVUsers::getUserList we can get our results.
  10. 10. Updating A User User’s can be finicky. They want to update their info, change their image, etc. Fine, lets give them what they want. Updating fields can be accomplished by passing the users fields in an array to PVUsers::updateUser(). The only required field is the user’s id. 1. Retrieve the user’s information, returns an array2. Update a field in the array 3.Update the user using the array
  11. 11. And DeletingAfter all the trouble creating a users account, updatingtheir information, the free coffee, they decide they want todelete their account. Let’s comply. Delete a user using their id
  12. 12. Challenge!We know how to create, update and login a user. For thischallenge we do not want MD5 hashing of the passwordbut want to encrypt the password ourselves.Use PVSecurity to create a hashed password andattempt to login with that password.
  13. 13. The Not So Obvious1. When a user is deleted, content they are considered owner of is also deleted. This include subscriptions, points, content, options and relationships, categories and multi-author.2. When updating a user, it is best to retrieve and pass in the whole user document for that user. The reason is because fields that are left empty will be reverted to their default value.3. When a user is logged in, the data in that user’s row from the database is stored in session/cookie. The column’s name acts the key and columns value is the value stored. Ex: $user_email=PVSession::readSeassion(‘user_email’);
  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

×