Skip Navigation

[Closed] Attache Sponsors to a Post / Relationship

This support ticket is created 3 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 9 replies, has 2 voices.

Last updated by Shane 3 years, 10 months ago.

Assisted by: Shane.

Author
Posts
#1640205

Tell us what you are trying to do?
===============================================
I am setting up a platform where entrepreneur are posting their Project to look for assistance with their transition to environment sustainability.

They Post their Project with a list of Sectors they need help with (It is a set list of areas not free text and will not vary*).
Professionals visiting the site will decide if they can assit those project and offer their help in one of those sectors.

For now I have setup the Project CPT / Linked to the User as Project Manager Role the listing and submission are ok (although still struggling on auto-login user after registration but this is another support Ticket)

I am coming now to the part whee I set-up the Sponsor Process.

Basically when on a Project page a visitor will decide to support/assist a particular Project, they will hit a button to start the relationship:
1. Create a user account with a particular Role (ie. Sponsor)with basic info and some custom user field (Telephone), enter a message to start the conversation and submit.
2. Upon submission the Project would be attached to the Sponsor User and there can be many user assisting with one Project (But only one Author of the project)

The trick here is to be able to submit the form without having to leave the Project Page > Create the user account then login then then .... so similarly to the other ticket I have open the user needs to be created and auto logged in.

Of course if the Sponsor user is already logged in and existing sponsor they can sponsor/assist other project and the button would only ask a message to start the conversation and be linked to the project as sponsor.

I was going to then create CRED User form then submit a message and create the relation via relationship?

If you could please direct me as to how to tackle this process with the minimal steps, my main concern is that the autologin is an issue so having the visitor taken away from the Project Page would be a turn off and prob will deter a few potential sponsors.

I hope I was clear and look forward to your input.

Thank you, Stephane

Is there any documentation that you are following?
===============================================
The Relationship and User Creation

What is the link to your site?
===============================================
hidden link

#1642157

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Stephane,

Reading through your ticket I can see where this can be possible but not in the exact sequence that you want it.

For instance you won't be able to Create the user , Log them in and allow them to be a Sponsor of a project all at the same time.

What I suggest is that you add a child form to the Project, then restrict the child form to only users who are Logged in under a specific role.

You can simply let them know that they need to be Registered/Logged in to be a Sponsor. Then we can take it from there.

Ideally the sponsor will become a child of the Project, so you will need to create a One to Many relationship between the Project and Sponsors.

Please let me know what you think of this.

Thanks,
Shane

#1656029
Step 3.png
Step 2.png
Step 1.png

Hello again,

Sorry for the delay we have been swamped and just getting back on this now 😐

Thank you for your input, I have indeed a form on the Post/Project's Single page template and a logged in user can submit a message and this is working ok.
However the client seems to be reticent in having too many step (Register > login > back to page > Submit message > Sponsor ...)
Being a sponsoring based on good will we are trying to not create too many steps so the faster the better.

I am looking at another approach and instead of having the Guest creating an account I am trying to have a Contact Form on the page to allow the guest to leave a message that will sit associated with the current Post/Project viewed.

That way when a guest navigate to any project and is interested in sponsoring they would click a button to display the CRED Form in a popup, enter their Details / Name/contact/email and a messgae and submit the form that woul dbe automatically linked to the project filling the Project ID in the lookup field / relationship field ?

The Author could then see the message submitted in their account page via a view and also recieve the message by email using their email address store as the author.

Is this possible?

I beleive i should use the following code:

[cred_generic_field field='custom-parent-field' type='select' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":[],
"persist":1,
"options":[ ...your explicit options here... ]
}
[/cred_generic_field]

Is it right to have the setup as new post-type ie Contact-Message (With name/email/message as content) and a relation 1 project > Many Contact-Messages?

Thank you for you time
stephane

#1656615

Hello again,

Just a quick thought, if all I need is a Form recording the Post/Project ID to then list those messages in aview for the Post/Project Author, would a simple Field recording the Project/Post ID be enough instead of a relationship??

Cheers
Stephane

#1657313

Hello again,

I look forward to hear your feedback, but all seems to work ok the way I set up as outlined above.

Just one thing not working at the moment, is to get the Author's email displayed in the email notifcation?

I use the following shortcode, which works in the form view but somehow return nothing in the notification:

[wpv-post-author format="meta" meta="user_email" item="$current_page"]

Lmk
thank you
Stephane

#1658981

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Stephane,

Let me see how best I can respond to your queries.

I am looking at another approach and instead of having the Guest creating an account I am trying to have a Contact Form on the page to allow the guest to leave a message that will sit associated with the current Post/Project viewed.

This can indeed work as you outlined it and from what I've read you were already able to achieve this by setting up the child post form on the Parent page and having the child form pull the email of the parent.

This way the Parent Author gets notified when a new Sponsor has been added. Seeing that the Guests would need to give an email then this will be suitable for setting up the child post without them having to log in.

Just one thing not working at the moment, is to get the Author's email displayed in the email notification?

Are you referring to the Author of the Child post? Meaning when I want to become a sponsor the email I input into the form ?

Or are you referring to the Author of the Parent Post.

if all I need is a Form recording the Post/Project ID to then list those messages in a view for the Post/Project Author, would a simple Field recording the Project/Post ID be enough instead of a relationship??

Yes this can be sufficient enough just to record the Parent post ID in the form itself which is essentially what the post relationship would do. I would still recommend having a relationship setup because at a glance when Editing A Parent post you will get a table that will list out all the Child posts.

So it helps to keep things a little more streamlined and managed. If you were just logging the ID's in the child posts then you will need to keep a mental track of which is the Parent post .

Please let me know if this helps.
Thanks,
Shane

#1660323

Thank you for your reply.

so far it is working ok in that it allows any guest to easily send a message to the Post Author.

Now for y our first Quetion, it is the Email of the Post's Author not the Child Post.
Ie. I am looking at a Post/Project > I want to send a message to the Post Author > Fill in the Post Cred Form that is sent to the Post (Parent) Author notifying them they have a message, AND also the Visitor who sent the form receive an email to the Emaiul they fill in. Now in this notification I would like to insert the Post's Author's Email so they can contact them further off the site if needs be.

I used the following : which shows the Post's Author's email on the screen but comes out Blank in the Notification email:
[wpv-post-author format="meta" meta="user_email" item="$current_page"]

What am I doing wrong?
I managed to add the Post's link / Title simply using : [wpv-post-link]
But the Author's email just won't come thru, any idea?

I also got the Cred Form to record the User_id and the project_id so that I can further display a list of related message sent thru this form in a dedicated Post author section where the author can manage their published Project and see the message sent to them (Beside also receiving an email notification of course). I assume I will be able to use those store ID to show all the message sent to them and furthermore all the messages sent ralted to a Post using the post_id for the project int he actual message. Iused the Message module as a reference and will get to this now... I hope I will manged.

But while I am doing this, as you mentioned it is still good to have a relationship remaining and setup, but can I easily create /set the relationship between the message and hte Post using a default, can you please gimme a pointer as to how to do this?

For now for example I used the following to store the Post_id in a hidden field when a visitor submit a message:

[cred_field field='aproject-id' value='[wpv-post-id item="$current_page"]' class='form-control' output='bootstrap']

Can I do the same for the relationship field? and how? 🙂

Thank you for your time
s

#1663959

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Stephane,


I am looking at a Post/Project > I want to send a message to the Post Author > Fill in the Post Cred Form that is sent to the Post (Parent) Author notifying them they have a message, AND also the Visitor who sent the form receive an email to the Emaiul they fill in.

Are you using a generic field to store the Parent's email on the child post form ? If so could send me a screenshot of the field ? If not please still send a screenshot of what exactly you using to setup the notification to send the email to the parent.

but can I easily create /set the relationship between the message and hte Post using a default, can you please gimme a pointer as to how to do this?

There is a way that you can create a Child Post from the parent i.e have a button on the Parent Post that you can click to for the child post, which will automatically set the parent for that child post. See documentation below.

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

There will be a little bit more manipulation of data since the you're form will no longer be on the Parent Page itself, however you can still have it on the parent page should you so choose.

Please let me know if this helps.
Thanks,
Shane

#1666319
2020-06-17_10-05-27.png

Hi,

Again the visitor is looking at a Project post > Wants to contact the Project Post's Author.

I have a button opening on the same page in a popup a CRED Form submitting a post to another post Type I created storing Project-Messages (Similar to the Massage system module) it stores the Project ID / Message / Message-to (Author-ID) etc..

When submitting this Post-Form the notification to the Sender/Visitor shold have the link to the Project they send the message to, and the Project-Post Author's Email which is the WP Author email fioeld of the Post Author (I used [wpv-post-author format="meta" meta="user_email" item="$current_page"] but that doesn work.

I also have used [wpv-post-link] in the email notification to have the link and title of the project for future reference for hte message sender but it has the Title and link to the Massage post not the Project-Post.

So yes, I need to have the notification including the Email of the Post Author of the parent post and the link and title of the project of the parent.

The form is on aht eProject/Post Page just in a pop-up.

You can look on this page : hidden link and click [NOUS ACCOMPAGNER], then at the bottom [J'aimerai accompagner ce projet...] then you get the form.

#1667479

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Stephane,

Confirming the the [wpv-post-link] will give the link of the Parent Post in the Email sent from the child ?

Secondly if it does give the Title of the Parent Post then you can try using this [wpv-post-author format="meta" meta="user_email" item="[wpv-post-id]"]

If that doesn't work then you will need to create a generic email field to hold the authors email. For Example

[cred_generic_field type='email' field='author_email']
{
"required":0,
"validate_format":0,
"persist":1,
"default":"[wpv-post-author format="meta" meta="user_email" item="$current_page"] "
}
[/cred_generic_field]

Then when you are adding the notification try doing this.

[wpv-post-field name="author_email"]

Please try this and let me know if it helps.

Thanks,
Shane

The topic ‘[Closed] Attache Sponsors to a Post / Relationship’ is closed to new replies.