I'm coming over from Drupal and I'm very used to the way Drupal handles users and objects (called nodes over there.) I have to learn how WordPress handles these same situations.

Since we're going to be confused with the same words that mean different things, I will define some of them here:

  • Node - In Drupal, everything is a node. A post is a node. A page is a node. A product is a node.
  • Author - In Drupal, every node has an author. Think of the WordPress post author.
  • Product - In Drupal, a product is a node. On my site, I sell books. So a book is a product which is a node.
  • Book Author - In the normal sense, a book's author is the person who wrote it. I'm going to refer to this as book-author from now on to avoid confusion with node author. Every book-author is a user on the site.

On my site, since every node needs an author, when I create the products I associate the author of the node with the book-author. Imagine creating a post on WordPress and saying the post author is someone other than yourself. Same thing.

On the user's profile page (the book-author's profile) I can list the books they have written (with links to the actual product node) on their profile page. I simply have a section where I render each product where they are the node author.

Now I need to learn the way WordPress handles this situation whether via a plugin or code in the functions.php. So far I've been reading up on the user profiles and they aren't near the same as Drupal.

  1. How do I associate a user as a book-author? I assume this will be some kind of custom role in WordPress; however, I've been reading up on that and it seems the roles in WordPress are related only to posting permissions and the like.

  2. How do I associate a user (book-author) to a product? I'm using the WooCommerce plugin. I know I can create a custom field on the product, call it Author, and then put a name in there but this will just render as simple text. I need to associate this field as a link to the user (book-author) profile and be able to associate this product on the user's profile.

  3. Is the user profile even the appropriate way to handle this in WordPress? Or should I be looking into some other kind of template? Perhaps a custom post type that has a block of code in the template that will render a listing of products based on the post's title (used here as the author name) or something like that? If that's a good way to do it, how then do I associate links back to this custom post page? i.e. when clicking a user's name in a comment it should now go to that associated custom post instead of the user profile.

Sorry if all of this is confusing. It's out of the box behavior in Drupal and since this is literally my second week using WordPress it's all a bit confusing to me as well.

NOTE: an admin should create a Drupal tag. Doing a quick search I find many posts in relation to Drupal here and it may better assist users who are familiar with both platforms find questions they can expertly answer. ;-)

没有正确的解决方案

许可以下: CC-BY-SA归因
scroll top