Seemingly after changing the relationship settings one needs to "refresh" all the dependent views for the changes to take affect.
Yes, I'm sorry I didn't warn you explicitly about this, but I recommend never changing relationship settings after you have already created posts and linked them in the relationship. The system isn't designed to support this type of change retroactively. A warning is displayed in the relationship editor screen to try to prevent this (see the screenshot), because once it's done it's not easy to revert. You would have to re-connect all the posts in the new relationship, and modify any View filters, Forms, or shortcode attributes that relied on this relationship. Also any custom code that uses the relationship slug, or requires parent and child post IDs in some specific order. Other unexpected problems could occur, so it might be a good idea to start with a new relationship.
I managed to get the add to report going. Yet how do I make the whole reports details page reload to show the newly added member after I have submitted the new member creation form!?
Similar to my last question how do I make the details page reload after assigning a member to a report listing out all assigned reports!?
You can use the Forms API and the following custom code template to trigger a page reload after submitting a Form:
add_filter('cred_success_redirect', 'tssupp_reload_member_form_page', 10, 3);
function tssupp_reload_member_form_page($url, $post_id, $form_data) {
if (in_array($form_data['id'], array(12345))) { //Edit the member form ID
if (isset($_REQUEST['_cred_cred_prefix_cred_container_id'])) {
$url = get_permalink($_REQUEST['_cred_cred_prefix_cred_container_id']);
}
}
return $url;
}
add_filter('cred_success_redirect', 'tssupp_reload_details_form_page', 10, 3);
function tssupp_reload_details_form_page($url, $post_id, $form_data) {
if (in_array($form_data['id'], array(12345))) { //Edit the details form ID
if (isset($_REQUEST['_cred_cred_prefix_cred_container_id'])) {
$url = get_permalink($_REQUEST['_cred_cred_prefix_cred_container_id']);
}
}
return $url;
}
Change 12345 to match each form's numeric ID, and add this code to your child theme's functions.php file or a new code snippet in Toolset > Settings > Custom Code. You must set both Forms to redirect to some page or post in the Form editor. It doesn't really matter which one you choose, because it will be overridden with this custom code, but it is required to select something.
Also I am seeing now by default the success message "Relationship Saved" on the Assign to existing relationship form "astro-report-members-relationship"!?
I don't understand the problem, can you clarify for me? Are you saying the success message is shown before the Form is submitted? Or the success message is shown but the relationship is not saved? Or you want to change the message text to something else?
And how do you prevent duplicate relationship assignment to a report visible in the report back-end?
I don't understand the problem, can you clarify for me? How would a duplicate relationship assignment occur? In the example we were discussing, a Report can have many Members, and many Members can be linked to the same Report. However, you cannot link the same Member to one Report multiple times in the same relationship.
How can I prevent a certain user role from having access to the WordPress back-end still providing that role with all required rights to use the front-end forms?
Here's a ticket that discusses some options: https://toolset.com/forums/topic/block-completely-backend-access-to-a-user-role/
If you need more detailed instructions, let's split this question into a separate ticket.