Support

Account

Home Forums General Issues Custom tables

Solving

Custom tables

  • Is it possible to create custom tables? For instance we use WordPress to manage our school website and it would be great to create custom entities and then create relations with users. We manage custom user roles (parents, students & teachers).

    For instance it would be useful to create a table “Courses” and then create relations:
    – teachers 1<>N
    – Parents 1<>N
    – Students 1<>1

    Possible?

  • Custom database tables, no.

    WP has custom post types https://codex.wordpress.org/Function_Reference/register_post_type. Courses, Teachers, Parents and Students would all fit nicely into custom post type. Or even Courses and “People” where People has a custom taxonomy https://codex.wordpress.org/Function_Reference/register_taxonomy to divide them into teachers, parents and students. I don’t know how much experience you have with WP, but it’s easier to work within the system it presents then to try to bend it into something else. Using custom post types and custom taxonomies you can then create the relationships that that you’re looking for.

  • Thanks John,
    Teachers, Students and parents already exist in my scenario (as custom roles) however I miss “Courses/classes” and relationships to users depending on roles, Could I achieve this with custom post types?

    For instance, user Paul is a student, attending “Math 4”, his sister Lisa is a student attending “Literacy 2”, Mary is a parent (mum of Paul and Lisa), Andrew is teaching in all courses.

    Could all the relationships above be managed with custom post types?

  • It might be possible, but I can’t say I will know all of what would be involved.

    First off, you’d need to relate students to parents.
    second you’d need to have a courses/classes post type that was is somehow related to teachers and students and these user fields could be restricted to a certain user role.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Custom tables’ is closed to new replies.