10 years ago
3
Topic

Greeting Octopoos -

I have a simple Parent-Child pattern that occurs throughout a project I’m working on. As an example, I have 2 types of users— Business and Individual (both content type Member). A Business user can create an article to announce a job opening (content type Job). A Business user should be able to list all their Jobs. An Individual user, can list Jobs and view individual Jobs. When viewing a Job, an Individual user should be able to view the User Profile of the Business user who posted the Job (the Job's author).

I’ve been using the Related Article type of field in the Job form to create a relationship to the Member who creates it, and although it works fine for development and testing, the Related Article field isn’t going to work for production unless there are ways to configure it better than I have.

The reason is because (as I have implemented it) the Related Article field creates a drop down list of Members and the user must select the related Member before saving the Job form. There are two problems with this:

1) I want the relationship to be created automatically, without requiring the user who is creating the Job to select their own name from a list, and…

2) I don’t want the listbox in the HTML even if it is hidden and defaulted to some value because in production the list will contain thousands of Members.

So, approaching it a different way, I have attempted to use a simple text field to store the ID of the Job’s author and use that to maintain the relationship. I am able to store the ID with no problem, but it alone is an inadequate reference when displaying a Job— the link from a Job to its author’s profile requires linking to the Article ID that contains the author’s profile which is different form the User ID of the author (I’m using the User Form Bridge plugin).

So, it seems that if I’m going to use a simple text field to store the related key, that key should be the Article ID for the Job author’s profile, and not the Job author’s User ID.

So questions:

1) How can I get the Article ID of the current user’s profile? If I can store this in the Job form, I can use it as a reference to the Job author's profile when displaying the Job.

2) Is there a way to use the Related Article type field more effectively than I am; perhaps configuring it to create the association automatically and without rendering the listbox?

I’m new to SEBLOD, and really love it. My greatest concern now is that because of a lack of complete knowledge of it, I may be “re-inventing the wheel” at times and doing things the hard way when more effective Best Practices already exist. Hopefully someone here can help me avoid that.

Thanks a million!

Denver

Get a VIP membership
4229 Posts
Kadministrator
10 years ago
2
Level 1

Hi,

if I understand you correctly what you require is actually a link to article author, you can use article author field for that purpuse and set its live value to user - id

10 years ago
1
Level 2

Thanks, Klas.  If it's that easy, it will be terrific. And then I'll be sure that I was going at it the hard way.

I'm traveling now and not able to try this immediately, but I will soon and will let you know where I end up. Thanks for the quick response!

Best Regards,

Denver

10 years ago
0
Level 3

Hi Denver,

Have you make a test? Is the solution proposed by klas enable you to find a solution to your need?

Regards,
Mehdi.

Get a VIP membership