Hi. Thanks for working on this. I see now that I need to move this into a repeating field. I left your "My Select" field on the page (fo now) but added "Talent Name Select" select field into the repeating Group "Talent". When you go to the project page for example:
hidden link
I added a link called "Add new talent" to the "Add talent" section near the bottom of the page that takes you to a page to view and edit the repeating field group.
I duplicated the functions.php code you provided and changed the case statement to:
case 'Talent Name Select'
--
1.
the select field says "not set" as predicted. i would like to get this working.
2.
also, for some reason, the "My select" code you made has reverted from linking to the person's profile page again, and links to mine instead. we don't need that to work on the "my select" statement since we are moving to a repeating field but i wanted to point out the problem and hoped you can help me understand how to fix that issue so i don't have to contact support when this happens in the future.
thanks.
Q1) the select field says "not set" as predicted
I have done below modifications in your website:
Edit your theme file "functions.php", replace line 133, from:
add_filter( 'wpt_field_options2', 'add_some_options2', 10, 3);
To:
add_filter( 'wpt_field_options', 'add_some_options2', 10, 3);
The correct filter name is "wpt_field_options", see the document I mentioned in your previous thread:
https://toolset.com/documentation/programmer-reference/types-api-filters/#wpt_field_options
Q2) The problem occurs when using nested shortcode within Blocks editor, I have done below modifications in your website:
1)Create a content template "My select code", edit with classic editor, copy and paste the same codes
2) Edit the content template "Content template for Projects", replace the shortcode block with Toolset content template block, select above content template "My select code"
Test it in front-end, it works fine:
hidden link
this keeps getting closer and closer but not quite there.
as an example, on this page:
hidden link
the repeating field group version of the subscriber user name select field is:
1.
Not displaying the "display name" for a user (its showing the login name)
2.
is not linking to their profile page
3.
is not using their display name when a user is actually selecting the user in the select statement (it shouldn't use the login name since sometimes they are not similar to their real name.)
thanks.
I assume we are talking about the repeatable field groups "Talent" in below URL:
hidden link
If it is, it needs a post view, you need to follow our document to setup this post view:
https://toolset.com/course-lesson/creating-and-displaying-repeatable-field-groups/#displaying-repeatable-field-groups-in-custom-order
Section "Displaying Repeatable Field Groups in Custom Order"
And I have setup a demo in your website:
1) Edit the content template
hidden link
At the bottom, replace the content template block with a view block "Related Talents":
- Query Talents posts
- Filter by post type relationship:
Filter based on the current content selection.
- In view's loop, display the content template "Talents information"
2) Edit content template "Talents information", setup codes as below
<a href="[wpv-bloginfo show="wpurl"]/user/[wpv-user field='user_login' id='[wpv-post-field name="wpcf-talent-member-name-select"]']/">[wpv-user id="[wpv-post-field name="wpcf-talent-member-name-select"]"]</a>
And I have changed the PHP codes as below:
add_filter( 'wpt_field_options', 'add_some_options2', 10, 3);
//dynamically populate select field from Types
function add_some_options2( $options, $title, $type ){
switch( $title ){
case 'Talent Name Select':
$options = array(
array('#value'=>'', '#title'=>'Choose user')
);
$speakers = get_users(array( 'role' => 'Subscriber' ));
foreach ($speakers as $user) {
$options[] = array(
'#value' => $user->ID,
'#title' => $user->display_name,
);
}
break;
}
return $options;
}
Please test again
Thank you. This is all working well now. I have one request. When the site goes live, the list of users (subscribers) will grow long. So the select statement will likely get out of hand. Is there someway we could make choosing the user easier?
1.
could there be a search for a user name to choose or a way to start typing their name into the box instead of opening a giant select list?
2.
could we narrow the list of users to those subscribers who have "liked" the project. We have the plugin WP ULike installed and working. So if 2 users have liked the project, then only 2 users would appear on the list.
Thank you.
I assume the original questions of this thread is resolved, for the other new questions, please check the new thread here:
https://toolset.com/forums/topic/i-have-two-more-requests/