Skip Navigation

[Resolved] Reply to a form with a cred_generic_field again, and again

This support ticket is created 5 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 7 replies, has 2 voices.

Last updated by Nigel 5 years, 11 months ago.

Assisted by: Nigel.

Author
Posts
#1202003

From an earlier ticket, Shane from Support gave a solution to 'reply' to a post form. Forms are used to notify registered users on a Membership site to communicate with eachother.

In the first step a form is created by a user and sent to another user and gets notified by mail.
The receiver has the possibility to reply on that form on the fronted as a field is added to the post
This is how the field is generated:

[cred_generic_field type='textarea' field='opmerking' class="form-control" output="bootstrap"]
						{
							"required":0,
  							"persist":1,
							"default":""
						}
		[/cred_generic_field]

We could have the situation that more than one reply is given (for example the original gives answer and the receiver a new remark), so I was wondering if it's possible to generate a new cred_generic_field, every time the form is submitted with new data. And secondly holds the data from previous corrections.
Will it be possible to generate a new mail-notification every time the form is sent?

#1202373

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

I'm not familiar with the details of how you set this up in the first place, but from the question it very much sounds like a solution for a single reply to a single post.

You could have multiple replies using a similar method, but you would have nothing to track who made which replies, threading of replies etc. that users would likely expect.

It seems to me you have two alternatives if you want a more fully-featured messaging system.

One is to simply use the built-in WordPress comment system. Allow comments on the post type in question and people can have fairly complex conversations.

If you don't like that idea, we have described how to develop a more fully-featured messaging system in these documentation pages, which you could use as a starting point for your needs: https://toolset.com/learn/how-to-create-a-messaging-system-with-toolset/

#1202419

Nigel,

Question for using the Messaging System:
- We will use this for sending leads between employees/departments. However, Management needs to be able to see and monitor these conversations. Will it be visible for certain group of users (VIP) on the frontend (Access?).
- If it's a converstion only between two users like an e-mail conversation, it will not be usable and I need to continue with the earlier development I have made.

The way I developed so far was based on the information I received from Support.

#1202522

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I haven't implemented the messaging system, but reading through it it is intended for communication between two users, rather than a public messaging system that can be viewed by other users.

To make any recommendations for how you implement this I need to know the specifications of what you require, if you could please provide a clear description, noting what you have done so far.

#1202592

Nigel,

Maybe you can look at the production-site.

1. I have a form for submitting the lead
2. There's a view for all leads
3. Click on a lead and it will bring you to a form to edit the lead.
4. All fields are 'read-only' but one new field is added:

[cred_generic_field type='textarea' field='opmerking' class="form-control" output="bootstrap"]
						{
							"required":0,
  							"persist":1,
							"default":""
						}
		[/cred_generic_field]

So far so good.

My initial question is if it's possible to repeat the last step again, and again, and again.....
User A makes the lead for User B, User B makes a remark, User A respond to this etc.

To use the standard 'comment' or leave a reply from WordPress is not an option.

#1203746

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

That's not going to work.

If you have already created a comment (i.e. added a field "opmerking") to a post and then edit that post with a form then you will be changing the existing opmerking field, not adding another one.

I think you will need a solution whereby you create a custom post type for replies, and make a one-to-many relationship between your posts and these replies (replies are children of the posts).

You make a form to add a child post (the reply) and include a link for this when editing the posts. As many replies can be added as needed. Your template for displaying the main post type will include a View to list replies belonging to that post, and displaying them in chronological order should be sufficient to maintain the order of the conversation.

See https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/#creating-forms-when-a-parent-post-is-preselected

#1204543

I read what you're saying, I understand it too, I have read all documentation but still can't get it done.
The examples are for realtionships for a artist - album, student - course but none of them seems to suit my situation.

I made a CPT for replies with a textfield for 'Remarks/Opmerkingen'
I created one to one relationship
I added a Field to my 'Edit the lead' form and put the link/field

It doesn't show what I try to achieve. I try a lot of things and spending hours of trying. Why is this so complicated?

#1204688

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Simon

You need a one-to-many relationship, not one-to-one (there can be many replies).

To help demonstrate what's required I set up a test site that does what you require.

You can login and see for yourself here: hidden link

Note that there is a "Thing" post type, to which you can add "Reply" posts via a form to add child posts.

Visit the existing thing post on the front end and try the add reply link.

Then check the content template for single things to see how it is put together.

Note, there is one cheat.

We are missing the ability with forms to publish child posts to be able to redirect to the parent after submission. I've had to add a code snippet (at Toolset > Settings > Custom Code) to achieve this, but you might want to submit a request for that: https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/