A Data Project consists of one or more data administration and/or static pages. You can use the role attribute to give users access to Data Projects pages.
Use the $$USER$$ or $$USERID$$ environment variables to get access to the current user:
$$USERID$$ > wp_user.user_id
$$USER$$ > wp_user.user_login
In a student administration system for example, you might need a page to inform students about their personal results. Suppose student results are stored in table STUDENT_RESULTS which has a column STUDENT_NAME that holds the WordPress username of the student (or STUDENT_ID that holds the WordPress userid of the student).
To give students access to thier own data only, you can add the following WHERE clause to the student result page:
STUDENT_NAME = $$USER$$ (or STUDENT_ID = $$USERID$$)
Students will see their own results only. If you have users who need to see all results, you might need a second student result page available to their role.
- You can set the default value of a table column to the WordPress username using the $$USER$$ environment variable:
Data Projects > Manage Table Options > select your table > set “Default value” to $$USER$$
- If you set the WHERE clause to “your_column_name=$$USER$$” and the default value for your_column_name to $$USER$$, users will be able to see and edit their personal data only.
- If you use the $$USERID$$ environment variable, make sure your column is numeric.
- The $$EMAIL$$ environment variable points to the WordPress user email address.
Demonstration Video #
IMPORTANT Please notice that tab Manage Table Options is no longer available. Table Options was renamed to Project Templates and can now be accessed directly from the plugin menu.