2

I get stucked. I've to do this: I've a channel "Projects" where a Super Author write a list of projects. I've another channel "Articles" where Authors can write articles and make a unique relationship with a single entry in "Projects" channel. But only Super Author can allow which Author can select that single project. So in a field in "Articles" entry for that author, it should be listed only allowed "Projects" entries for that author.

EX: There is S_A (Super Author), A_1 (Author 1), A_2 (Author 2). S_A make Prj_1, Prj_2, Prj_3 and assign that permissions:

Prj_1 -> A_1
Prj_2 -> A_1;A_2
Prj_3 -> A_2

A_1 when write an article in "Articles" channel can select from a dropdown only Prj_1 & Prj_2, and can't see Prj_3 in the list;

A_2A_1 when write an article in "Articles" channel can select from a dropdown only Prj_2 & Prj_3, and can't see Prj_1 in the list;

I've done this steps: I've created 3 different channels:

- Authors (with plug-in Profile:Edit); 
- Project;
- Articles;

In Projects i've created this channel fields: prj_author that is a Playa field to allow S_A to select allowed Authors.

In Articles i've created this channel fields: art_projects that is a Playa field to show all the entries in the "Projects" channel, but here i can't filter entries for the selected author in prj_author playa field.

Please can somebody can help me? I can offer a beer :D

1 Answer 1

3

You'll need to write a custom fieldtype to achieve this - I can't think of any existing fieldtypes that could accomplish this for you.

So in your fieldtype, you'd query exp_playa_relationships for all parent_entry_id's where where child_entry_id was equal to the entry_id associated with ee()->session->userdata('member_id'). (Not sure how Profile:Edit stores its Channel/Member relationships, but it's probably in a simple DB table.) Then, use that data to build a menu from there.

Very difficult to then pass this to a Playa field though - you'd be best off building your own dropdown menu.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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