I'm developing a building management system in WP multisite, and can't figure out how to create proper relations between blocks/apartments/owners and/or tenants. This is the the structure:

  1. Create building block
  2. Create apartment and assign it's block
  3. Assign owner to apartment
  4. Assign tenant(s) to same apartment (if there are any)

I'm using Custom Post Type UI for apartments and Advanced Custom Fields. The site will have payment options, booking, helpdesk (all of these are plugins). Users will be created manually, and during creation, they should be assigned to their previously created apartment custom post, so when they log in, they can see only information related to their apartment, and not others.

So, how should I create the relationship between blocks, apartments and users?

  • Whats the question? – Malisa Sep 8 '16 at 15:21
  • How should I create the relationship between blocks, apartments and users? – Giovanni_S Sep 8 '16 at 15:24

Personally I would:

1: create Post with type Building (you can then add meta to this eg: address, lat lng, name etc)

2: create Post type Apartments and associate with building via apartments post meta

3: create metabox for owner for post type apartments, here you can GET all user info with role as owner/landlord and add to post meta

4: as above but for tenants, GET all users with role tenant, when apartment is let.

  • Sorry for the maybe obvious, but associating custom post types via post meta will be literally typing the relationship? Or is there a way to post types like page hierarchy? And how can I select within the post type the site users in order to assign them to the post? – Giovanni_S Sep 8 '16 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.