Skip Navigation

[Resolved] Possible to create a Polls with Toolset?

This support ticket is created 5 years, 10 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 5 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#1199537

I am trying to prepare Custom post type called Movies for regular movie parties.

Every post will be one party.

I created repeatable custom field group, which contains:

Text line - as a movie name
URL - as a IMDB link

It should work in this scheme:

1) Admin adds movies and create the post with information about the movie party
2) Movies are visible there (it is a repeatable field view)
3) People see button "log in to Vote"
4) They log in and "somehow" vote for their favourite.
5) On the front-end is visible who voted for which movie (their Nicknames)

Is it possible with toolset? I need to make it easy to use and clear to understand for user. Propably with CRED (forms)?

Can you help me?

#1199652

Hello,

There isn't such a built-in feature within Toolset, it needs some custom codes, here are my suggestions:

1) setup one post types: Party

2) setup a repeatable field group "Movie", and register it to post type "Party", with below custom fields:
- Movie title
- IMDB link (URL field)
- Vote count (number field)
- Voter Nicknames (single line field)

3) In a single "Party" post, create a post view, display related "Movie" posts:
https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/#displaying-repeatable-field-groups
in the loop of above post view's loop, use Access shortcode [toolset_access] to check if it a guest user, then display the login page link
https://toolset.com/documentation/user-guides/access-control-texts-inside-page-content/

If it is a logged in user, then display below post form

4) Create a post form for editing "Movie" post, in this form display only a submit button,

5) After user submit the post form for editing "Movie" post, use action hook "cred_save_data" to trigger a custom PHP function,
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

in this function do these:
a) Update the vote field value +1
b) Append the Voter Nicknamess field value with current logged-in user's nickname
https://codex.wordpress.org/Function_Reference/update_post_meta
https://codex.wordpress.org/Function_Reference/wp_get_current_user

For your reference.