I am looking for some sort of method to have a user based system for a wordpress site.
Basically a user will be able to store simple pieces of information.
These pieces of information will then be displayed when the user logs in.
I notice in Wordpress you can have users login to something like an admin section, all i would like is the user to login from the homepage, and then redirect to one page that allows a user to add information, the information is based on variables added to a google map. the information added to the map should then be saved.
This information can then viewed by all users of the site
i have looked at Buddypress and wpsymposium but i think it is a little overkill for what i want.
Any ideas on how i could get this going?
There are several ways you can go about doing this. You can either:
Create your own user table (ID, username, email, password, etc.) and
a separate data table for the information you want to store for each
user. This would not exist as a part of the Wordpress Framework, but instead simply be displayed from within your Wordpress Installation.
You can look into a combination of hooks to create the environment you want for your users that exists as an extension of Wordpress itself. Look into Adding Roles for these users. You will also have to define their Capabilities as well. From there, you can either Create A Menu Page for those users to enter their information, or use a combination of Custom Post Types and Custom Meta Boxes to provide an environment for your users to work within.
Since you're using this specifically for Google Maps, I would say that the second option would be overkill, especially if your users aren't expected to log in very often. The benefit to the second approach, however, is that you would be able to utilize the information provided in each post in more than one way if you wanted to.
Weigh your options, and see what suits your - and your users' - needs best.
Related
I can't seem to find the answer to this online.
I don't have much experience with Wordpress but I need to build a site using a few plugins. They all offer the ability for users to register and login, and I need to know if they will all use the same user implementation (i.e. the native Wordpress one), so that when a user registers/logs in once they will get access to all of the plugins' features and be logged into all of them.
The plugins specifically are:
https://wordpress.org/plugins/paid-memberships-pro/faq/
https://wordpress.org/plugins/camptix/
https://wordpress.org/plugins/private-messages-for-wordpress/
First and third one seems to use WP Login. In second one users seems to use formula to order tickets so they will probably have to fill all fields every order, but still logged as your WP users. Second plug-in using external website to finalise ordering so your user will have to log in somewhere else.
In my opinion for example thanks to first plugin you will be able to control access to second one and your users will not have to register twice to use third one.
My tool uses:
PHP for scripting.
mySQL for DB.
Apache for host.
There will be 2 groups of users.
I want to give access to 1 group of users only for 2 webpages.
The other group of users will have the access for all the pages and links.
Is there a way I can hide certain links on a webpage from a certain group of users, too.
How can I achieve this.
Fairly new to programming.
Any help will be greatly appreciated.
Thank you.
Lets say, Admin & normal user.... in that case we will have a column in the user table which will store he/she is admin or not. When you do authentication, fetch this value & keep it in SESSION. So in every page you check this person is admin or not with that session value using if clause.
It's hard to give any fitting exmaples without code, but if you have a MySQL and know some PHP, the basic way of solving this problem would be connecting to the database, checking what group the currently logged in user is (check by ID or however you set things up) and wrapping if statements around the links you want to hide from certain people that check if they belong to the right group to see said pages. You can also hide the pages from them by just putting a check whether they can see the page content or not on top of the content and throwing some sort of no permission error when needed. For this basic example hard-coding the groups into the files should be sufficient. If you plan on expanding all this later on, I'd maybe make a seperate table in your database controlling page view permissions.
You can also include HTML code in your PHP if statements by just closing the PHP section after the if (?>) and put the closing bracket of the if at the end of your HTML menu for the secret group (<?php } ?>).
If you provide us with some code snippets, we can maybe help you a bit more with examples.
There are many ways you could achieve this.
How to 'hide' the page
A good way to really hide the pages would be to check the type of user before displaying anything. If the type of user has access to the requested page, display it. If the user does not have access, you could send a 404 page not found error.
This way, user which does not have access to the page wont even know the page exist even if they have the URL.
Authenticate the user
As mentioned by Akhil Sidharth, you can use a $_SESSION variable to keep the type of the user trying to view the pages.
Every application now a days is using group, permission and capabilities to restrict site/application users from accessing the page/content/link within the site/application. Sometime group might be refereed as role to organize users. Let me describe -
Group/Role - Role might be - Admin, Manager, Employee, Customer etc. Your application should have role management system where you can manage(add/edit/delete) the roles/user-groups. These roles should be stored in DB tables.
Permission - Permission might be Allow, Deny, Restrict etc.
Capabilities - Capabilities might define the list of works/actions/activities that a user can take on your site or on a particular page. Some examples are - a. Can View XY*Z link b. Can View X*B page c. Can create user d. Can assign permission e. Can change permission etc.
Apart from this, your application should have two addtional management page -:
Configure capabilities & permission for the said roles, where you can configure and set capabilities either 'Allow'/'Deny' for the roles.
Role to users - This is the page where you can put the users into a particular role.
In this way you have the idea, what a particular users have rights/permissions to do on the site & restrict the users over accessing the contents/pages/links accordingly.
Alternatively, the simplest way for you now is to add a 'type' field in your user DB table. Add a drop down of users types where you are creating/updating the user & save the user type in your user db table. Restrict the user on the basis of user type accordingly.
I come to you because I'm a little bit lost in the implementation of a specific project...
Here is the configuration of my project:
- A Wordpress website
- An external database outcome of the ERP "OpenERP", containing a table that contains hundreds of users.
In the Wordpress site, I need to create a form that will allow visitors to register in the external database. I also need the visitor to be registered as a user in the Wordpress website because in the near future, registered users will have access to particular content via Wordpress.
In addition to this, the client wants to continue to add new users via OpenERP. In this case, the new user will also need to be created "immediately" in Wordpress.
How can I do this?
Thank you in advance,
Cédric
I looked at "OpenERP" real fast, hoping there is an API. Instead I got confused on the product, just a little. There are fundamentally a few ways to go, here is the path I would explore :
Does "OpenERP" have any type of API for adding and polling users? This is the way to go. So when a new user is registered (created) in WP you can hook the creation via wp_insert_user() see : http://codex.wordpress.org/Function_Reference/wp_insert_user to get started. The hook would check with OpenERP for a user ("does exist") and create if new to OpenERP.
When OpenERP has a new user created, ideally you can send the details to WP, in any number of ways, to create a new user. Creation of the user can include forced PW creation, random PW, and even welcome emails. See wp_create_user via http://codex.wordpress.org/Function_Reference/wp_create_user. You could create an API, a hidden method, an adaptor, etc.
The unanswered question is "What features are available in OpenERP to talk to a remote site over http or the network?". Additionally, what security holes are you opening up and how do these concern the business?
Technically, creation of a password and account, in any professional situation, requires secure practices. SSL/https or possibly SOAP/WSDL to the rescue?
The bottom line : Wordpress has all of the tools, hooks, and features needed to accomplish your goals. What does OpenERP have to allow you to meet these goals?
One final concern, you could have a situation of user conflict - a user created in OpenERP and WP. Some extra logic may be needed, as well as a consideration of how you (as the programmer) choose to define what makes a user unique (email can change, making email a junky unique identifier), user names also can change (not in WP). If these attributes change (edited) you could have heartburn. The entire CRUD cycle needs to be accounted for in detail on both systems. A WP ID to OpenERP ID relationship table, with status, will probably become a requirement.
There are a few other ways to go, but above highlights how I would begin thinking about the problem.
Hope this helps.
how is it possible to make something like this:
Admin Creates accounts with specific username and password
then from the website the user logs in to his account and views personal account data the admin uploaded to his account.
For instance there is a client who has bought something.Then he logs in to his site account and views what he bought last week (in fact browsing specific server data)
How can that be done?With a simple script?A cms or what?
Thanks for any help!
The best answer is in google :)
Really try to search a little in google something like "user management with php" and probably you can find a huge quantity of answer.
Btw i think that to do a basic user management with php you need:
Design a database that handle user and if needed basket, and whatever you want (news, etc.).
Then the basic information you need in your database for usera management are:
Username, email, password (be sure that the password is crypted for example with md5) and the user role (admin, editor, etc).
You need to specify the user roles (i think you can use a table for it, or a file, it is only up to you to decide how roles are handled).
For track purchase of the user you must create a relation between purchases and user_id So for example you can have a table called orders where you have minimum these files item_id order_id user_id so the user can have in its dashboard a complete tracking of its history.
Then how to manage user sessions? You can use COOKIEs so if the user login succesfully you set a cookie into user browser, and then check if the cookie exist you show for example some information, if the cookie doesn't exist you show other informations.
These are the basic steps to manage users (probably many information are missing). But this is good if you want to learn something, but if you want something strong and probably more secure you can think to use a CMS and maybe only create some customization of it if needed.
You could do it with script, or cms. I think script is more suitable than cms - which would be overkill, and you would have to spend more time trying to get the cms out of the way than actually doing what you want.
The best option in my mind however is a framework. Seeing as how you have tagged your question php, I am going to recommend CakePHP. This will allow you to solve your problem quickly, by making a simple app based on user accounts, and also to be able to leverage existing codebase (including plugins like ACL for example). This approach will allow you to maintain structure, and develop/maintain your app more easily in the future.
I have my website and it's form is like this:
Information
More information
Yet more information
I want to allow users to register a username and a password so that they can log in and leave comments on the items 1, 2, 3 etc. Each item of information is stored in a mysql table, so to generate the page, each item 1, 2, 3 etc is a row/record from the table.
I am looking for a guide/resources on how to accomplish user registration and commenting on my items.
You will find a good tutorial that takes you through the steps to create a login for your website with PHP here.
After you get the login to work you can modify it to suit your particular circumstances.
Most likely you will have to create a table with userid and itemid to store which user has access to which item.
User registration is fairly straight forward. Create a form that asks for information about the user that you desire, probably protect it with some sort of captcha (I'd recommend recaptcha). A lot of registration includes some sort of email verification, but I find that annoying.
As to commenting, I'd create the idea of a permission. Anyone not logged in has the "guest" permission, which doesn't allow commenting, and logged in users have the "user" permission and therefore can comment on content.
net.tutsplus has been doing a series of videos on how you can use the CodeIgniter PHP framework to accomplish many different things on a website such as a login screen. I think after you watch this video you have a better understanding of what you will need to implement your security requirements and also see an example of the MVC pattern that is very common nowadays.
Good luck and hope this helps you.