开发者

expression engine member to category to channel relationships [duplicate]

开发者 https://www.devze.com 2023-02-14 17:55 出处:网络
This question already has an answer here: Closed 11 years ago. Possible Duplicate: One-To-Many member-to-articles relationship
This question already has an answer here: Closed 11 years ago.

Possible Duplicate:

One-To-Many member-to-articles relationship

We are new to expression engine and could maybe use some help from anyone who has built a few sites using this CMS.

We have a small dashboard system where users log in and read articles that are submitted from other authors. We are wanting to have a form which allows a member to chose which categories of articles he would like to be on his home page when he logs in. Then we'd like to figure out how to actually create that home page so that only the categories of articles that the user has chosen are visible.

From a db standpoint this seems to be a one to many relationship between a user and categories, but we have no idea how to accomplish this inside of ee, especially using the members, since it isn't a channel and doesnt seem to allow creating relationships in the member custom fields.

We looked at creating a custom field for every category type, but there are about 95, and as we add or remove them, it would be extremely cumbersome to try keep up with them all. Even if we did we still aren't sure how to connect 1 member to many categories or many entries via a category.

In sum, the idea is to, using the logged in member, get a quick li开发者_运维技巧st of articles, which have been assigned to one of multiple categories, which have been selected as preferences by that logged in member.


Create a form that shows all available categories to the logged-in user (use channel:categories) in either multi-select or checkbox format. POST that form to a template that either has PHP-enabled, or contains a plugin tag of a simple custom plugin ... either one should take the posted array of categories, concatenate them into a pipe-delimited list, and either insert that into a simple new database table (with member_id (use the {logged_in_member_id} variable, or in PHP mode, $this->EE->session->userdata['member_id']) and category list as columns), or less-ideally (but more simply) place them in a cookie.

You can then pull that category list out of the database or cookie and use that as the "category" parameter on the channel:entries tag.

0

精彩评论

暂无评论...
验证码 换一张
取 消