Skip Navigation

[Resolved] Conditional logic

This support ticket is created 2 years, 7 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 14 replies, has 2 voices.

Last updated by TomW5440 2 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#2335917
member-comments.jpg

I've been working on a demo site trying to get to grips with Toolset. I'm trying to create a basic member site.

There may be a better way of achieving this and I'm open to suggestions but this is what I have come up with -

Post types: Members and Comments
Relationship one to many for Members(parent) > Comments(child)

To become a Member customers buy via woocommerce and once a customer has paid they can -

Create 1 Member post type and be able to edit it
Edit comments made to their member post

Free customers cannot create or edit a member post, but they can -
Edit their own user profile
Add new comment to member post
Edit their own comment

I've started experimenting with demo site and have a a good handle on custom fields but there are a few things I'm having trouble with -

(1) Conditional logic when displaying content (please see mock up image)
I have looked at the conditional block settings but can't see how I can use it for these conditions.

Member post
- edit comment links - only owning member or owner of comment allowed
- delete comment links - only owning member allowed
- edit member profile links - only owning member allowed
- add comment form - only non member allowed
- content from specific member fields - only visible to the owning member

Create new member post
- Only allow paid users to create 1 member post
After signing up only users who have paid are allowed to create 1 member post

(2) Dynamically assigning member to comment post form
I need to do this via a hidden field. The comments are then looped onto that member post

If anybody could offer me assistance I'd be most grateful.
Thank you
Tom

#2335973

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

We will have to use either conditional block or conditional shortcode to display content conditionally.

If you have your page ready, can you please share problem URL and admin access details and let me check how we can setup the conditions.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2337021

https://toolset.com/course-lesson/creating-the-lost-password-page/

Am I suppose to create these as a template or using the pages? It seems if I create lost password and reset password as template both forms appear. It's still not working though as no email with code is sent when entering filling out lost password field?

#2337027

Okay so email reset is working now. In your documentation it's not clear whether pages or templates are use here. So when I created the templates using same as pages it worked. So I then wondered if pages weren't needed and removed the content from them but then the nothing showed on these pages. So I then restored the pages and removed the templates but not it works. That's very odd.

#2337031

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

The "lost password" page should not be part of "Logged-in users only" post group you created using access so I removed those "lost" and "reset" password pages from that group.

I can see now form is available and when I submit the form with my registered email address for lost password.
- hidden link

I do get email in my inbox, please check spam box if you do not receive email:
Screenshot: - hidden link

#2337881
toolset2.png
toolset1.png

OK I understand things a bit more now thank you. I really appreciate your support in getting started too!

So I've taking things a little further now and have got stuck with the Member > Comments relationship.

On the member view template I'm now displaying all the member content which seems to be working well. At the bottom of the member content I need to:

Display comments made by any logged in user that relates to the member
Display comment form for any logged in users with basic or admin role (excluding member role premium)
Loop comments related to the member

I'm stuck at the first hurdle as I can't get the comment form to work. I am using a relationship form but it asks the user for input in assigning the comment or member (Please see screen print 1 and 2).

If you could please help me with this that would be awesome!

Thank you!

#2338247

Just to update this ticket. I tried adding a child post link to member loop. This linked to a new comment page which housed the new comment form. It's still not working though as member is never assigned to the comment. I've made two further test comments and they need to be manually assigned a member in admin. Not sure how to get this bit working?

#2338599

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

As per our support policy, we entertain only one question per ticket. This will help other users searching on the forum as well as help us to write correct problem resolution summery for the original issue reported.

You are adding here multiple issue and we are at least confused that where exactly you will require help.

Can we please go step by step to resolve your issue. Can you please share problem URL and mention what exactly you want to fix there.

#2338663

I'm sorry I didn't realise. I will create separate tickets in future.

I'm customising the Member template.
It displays custom fields data from the member post type.

I now want to add a comment form. To do this I have created a post type Comment and setup parent child one to many relationship between Member and Comment. The problem is that the comment form is never assigned to the member.

I wondered if it was not possible with the comment form on the Member template so instead I created a New comment template and then in the Member template added post child link and set it to Set the parent according to the currently displayed content. This still doesn't assign the parent member to the comment form. How can I do this please?

I already sent my full login details privately and the url in question is mydomain/member/tom1.

Thank you.

#2338801

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

So I've added the member-comment post relationship filed to your form, you can add/remove other fields as required with the following comment form.
=> hidden link

I can see now member comment post relationship field value will be automatically selected:
=> hidden link

Now, when you try to submit the comment, it will be automatically attached to (automatically) selected parent.

#2338895

Thank you so much but it's not working. I leave a comment and it's not assigned to the member. If I edit comment in admin I see option to 'connect to existing member'.

Also how can I make the member comments field hidden? It's showing as a populated select, I really need it hidden. Thank you.

#2338933

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

If you do not want to display the parent field, I've removed the parent field and instead I've added the hidden field as you can see with the following screenshot: hidden link

Can you please confirm it's working as expected.

#2338935

Okay so you used a generic hidden field, I understand now. Oddly new comments are now being assigned parent members thank you so much! I'll create separate tickets for future issues. Thanks again!

#2338939

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Glad to help. You are welcome to mark resolve this ticket.

#2338965
edit.png

My issue is resolved now. Thank you!