I am working on a social network, and I am doing it with php and mysql, I need to know how to make users have customizable profiles...
Like editing status, ect...
Also making it so only friends can veiw their profile..
Also how do I add a user's page/directory to the website directory(example: domainname.com/someonesprofile)
Thank You
-Techy
That's a pretty generic question, but I'll give it a whirl.
First of all, you need to determine what a profile should contain and so forth, such as status, relationships, name, addresses, .... The list goes on. You then need to write an interface to a service that provides this information; this can be a PHP function, a class, whatever, really.
Second, you need to access this interface from within your web application. A suitable course of action is probably to have a function that assures that whoever is trying to access the information is logged in, is in the relevant authorization group (friends list), and so on.
The editing part is done quite simply through an HTML form or similar; there's no magick[sic] involved. The function to parse this form would again assure that the logged in user has the appropriate rights to edit the profile (e.g. is the same user or a trustee of some kind, parent, lover, who knows...)
As for the last bit; here mod_rewrite is your friend. You probably would want to have URLs along the line of http://example.org/profile/username , which the server would translate to /?action=profile&user=username, or something to that effect.
The file /profile/username would as such not exist on the server file system in any real sense, but seem to be a completely normal HTML file when viewed from the outside.
You must start with the database. You will need a table for Person, obviously. You will need a table that joins Person to Person many-to-many, for viewing privileges. You will need a table for levels of authorization. And you will need other tables that serve up what privileges go where.
The interface is secondary. Some developers would use something simpler than PHP to develop the UI functions that rely on these database resources.
I know that there are very nice frameworks available which handle the whole profile/login/friends functionality. Pinax for Django springs to mind. Ime quite sure similar things are available in PHP but unfortunatiely I know very little about the PHP community, so I don't have a link.
Related
I don't know if this question belongs here or not, someone please move it to an appropriate place if needed.
We are working on a web application using PHP and MySQL. The software is of the sort that provides a lot of pre-fed data to its users. For example, a list of questions and answers like a knowledge base. Now every user who registers into the system would have the liberty to add/update/delete this knowledge base, without affecting the data of the other users.
Now I understand that we would require to have a master copy of this pre-fed data, and would have to make a copy of this data available to users.
I was wondering how to implement this in the system without affecting the performance.
Would we have to create separate databases for each user?
Any pointers?
Thanks!
I find three approaches to this, they'd depend upon your domain requirement.
You're 'seeding' configurations and basic data for which it does make sense (to me) to localize the settings per user. I guess most of the apps follow this.
If it's domain data, when you say knowledge base (which I take to be very huge), it'd make more sense to save the per user edits and merge the master data with a user's personalized data. This is a very abstract & I wouldn't know it's implementation unless I actually see the data modeling, but then this looks a viable approach!
Save edits from all the users separately at one location (per collection or however you wish) if you want collaboration and stuff. With this, I think, it'd be easier to grow your knowledge base, although you can do the same with the previous approach with a little help from DBA!
If I use a backend system like drupal or joomla, would I be able to have it so that each user-type is directed to a specific version of the site with specific links available to them - rather than just "hiding" a link or article which these systems already do?
To be specific, what I'm trying to do is provide a community based studygroup site where students can contribute to each other based on the courses they register for. So ideally I don't want someone in stats to have to see a list of irrelevant channels/pages. I know that making a CRM-esque site from scratch can do this, or getting something like CRMery which is a joomla extension can also possibly do what I need by rewriting specifics within the code and design of the software (not even sure if the license would permit that). But I want to avoid the cost and more importantly time, of a CRM from scratch and was wondering if I just make different websites (or portals of some sort) available based on user login it could speed up the development cycle significantly.
I was thinking that the logic would work as follows:
visit www.communitysite.com
log in
be directed to a specific site (as there will be multiple pages relevant to the login) that contains all the details for the registered course (which would include things like embedded videos from youtube, chat system for users that are online and registered for that course, and perhaps something along the lines of note/document sharing). Someone suggested using subdomains for this - but if it grows beyond three or four courses then it becomes very impractical to have a subdomain for each subject. Also, if they select multiple courses such as bio and chem they should be able to see those as well without having to visit a new domain every time.
Any ideas or feedback would be much appreciated. I know for a fact that I can do this via a non-joomla/drupal based site, for instance using php - but being the only one in my team with a background in programming, I wanted something simple for the tutors themselves to use if they needed access to the backend.
I'm not looking for someone to do this for me, just if it's possible and maybe your ideas on a better flow of logic as I understand that this might not be the best way to manage a site like this.
Thanks!
I'm not sure of the specific drupal/joomla requirements, but essentially what would be done:
Upon registration of the user, assign values to the "types" of classes to which they are registered. For example, algebra, geometry, calculus would all have individual identifiers associated with them, but would also belong generally to the group "math".
Determine the types of groups that user would hypothetically be interested in seeing. For example, if they are enrolled in Biology 400 they would likely also be interested in something like Physics 200 or Chemistry 300.
When the user signs in and is redirected to their home page, your database query would be something like :
"SELECT * FROM courses WHERE course IN (array)"
Where array would be a generic container (like math, science, language, history, psychology) holding the individual courses.
In short you would need to make sure you have a hierarchy to the courses (e.g., American History 101 -> History -> Humanities) and display only courses belonging to the same category.
You can make course id and assign it to the userid so when some one will login based on course they have chosen you can show them specific part of site by checking course id from users table for that user.
There are a lot of ways to do something like this in Joomla (or any CMS) and how to do it really depends a lot on how complex you want to make to make the site, the work flow (are you assigning the students to classes or are they selecting) and how much custom coding you want to do. Also are these classes going to change constantly or are they set.
If people are able to select their own groups you could look a a system like jomsocial or similar. You don't have to reinvent things, you just need to think a little differently about what tools you need.
I am building a PHP application. For my application, user's profiles / pages are setup and displayed intially by visiting domain.com/username or domain.com/accountnumber.
My question is this - how do you do that, while retaining the ability to make informative application pages that have the url of domain.com/pagename? My main example of this is vimeo, which has vimeo.com/about, vimeo.com/developers, etc., while allowing you to set your username to vimeo.com/username. My concern is that I will launch my application and not have the ability to create the link I want to in the future because it is taken as a username.
What would be your advice, or what has been your experience? Is there a common list to reserve that is recommended? I am not sure what to do. Thanks for the help.
There are a number of ways you can achieve what you asking - read up on routes and routing to gain a better understanding.
Many frameworks offer a way in achieving what you are asking - Zend Framework being one.
Alterantivly, if you are building it from scratch you could implement a different structure i.e.
domain.com/u/joebloggs
domain.com/user/joebloggs
domain.com/a/123456
domain.com/account/123456
This effectivly ensures your urls cannot be affected by someone username. You'll need to look into Mod Rewrite if using creating your own routes.
There are many frameworks available already that offer this ability, try Zend Framework.
You'll need to read up on Routes with ZF to implemented what it is you require.
The answer is you don't design your urls like that. I know vimeo does it, but they probably have run in to this headache.
A better solution is to namespace your resources. Look closely at stackoverflow's urls for better examples of good url design.
If you are absolutely stuck with this url design, consider organizing your "content tokens" (the bit of the url that identifies the thing you want) into groups, and giving them an order of priority. E.g.:
if token matches a static page, show static page
else search for and show user page by account name
else search for and show user page by account number
When users sign up, don't allow them to use names that are static pages. (You may want to reserve a set of static page names in advance.)
If you make a new static page later and a user name conflicts, you can forcibly change his user name and send him an "I'm sorry" email. This will hopefully be a rare enough occurrence that you don't need to solve it with code.
One way would be to use curl or similar to request domain.com/requestedname at the registration, returning an error to the user if the URL doesn't return a 404. As for future conflicts, there is simply no way to do that. You either have to make a list at the beginning of all potential future reserved words and disallow those usernames (impractical), cross your fingers and hope a conflict doesn't occur (also impractical), request a username change from the user when a future conflict occurs (unprofessional?) or use a different namespace for usernames and system pages.
I'm working with PHP and need to add a survey component. I would prefer something that allows me to embed the survey on the site. The creation of the survey itself can be off-site, no problem there, as long as the users themselves don't have to go elsewhere to answer the survey. Does something like this already exist?
There's another issue: some of the surveys may be closed surveys i.e. sent to a specific group of emails and only those can answer it. So I'm guessing the user will have to click a link which has his email and code coded as parameters. Any other ways to do the same thing that I may be missing?
I'm open to all suggestions... but would really prefer not to have to install an entire open source system for this, unless all else fails.
Wufoo and SurveyMonkey are both really good for this, especially given your requirements. I'd advise you rethink using PHP, per se, and consider embedding one of these in your site (you can control the HTML/CSS so it looks the same). Otherwise, there are quite a few options for you to evaluate... see these lists.
There exist many survey extensions. Maybe you'd like to use survey extension by Joomplace. Now I'm developing an e-commerce website so I think to buy this one. Here is their site: http://www.joomplace.com. I know that this survey supports front-end authoring and it's also possible to create different kinds of reports. Also you can define the list of users you want to address the survey to. But this is for Joomla based sites.
I've been approached about writing a system for a client. They currently want something to replace the email approach that is currently being used.
The system is fairly simple on the surface. There is my client, who is the customer, and his clients.
His clients need to be able to create new messages which are then saved in a repository so to speak. They can also edit and delete their messages.
My client should be able to view all the messages for him (so he can process them so to speak) and essentially be able to view them, filter them through advanced filters / search criteria, through a smart looking web front-end.
My main experience in this kind of thing is using PHP/MYSQL/Oracle. I can see that it is quite easy to create a system for this using these technologies. One dB, which will have aroound 20,000 records created per year say. Allow access to my client to view, advanced filtering and searching, and to his clients to create, edit and delete.
I'm just wondering if I'm missing anything obvious here, in terms of an off-the-shelf solution? Or should I be considering some other technologies (I pretty much can use anything I have to).
Many thanks,
There are a multitude of options. I don't think any of them is better than the others for your application. I'd go with what you already know, or what you can hire people easily to create/maintain.