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?
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.