Skip Navigation

[Resolved] author not showing on custom post type

This support ticket is created 3 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: Africa/Casablanca (GMT+01:00)

This topic contains 8 replies, has 2 voices.

Last updated by Jamal 3 years, 9 months ago.

Assisted by: Jamal.

Author
Posts
#2142265
Screen Shot 2021-08-13 at 3.29.50 PM.png

my site allows user to create a community profile and fill out a form, then when they come back it should show them their post when they are logged in. It is not assigning the author of the post when they first fill out the form. I am not sure what I am missing

#2142569

Hello and thank you for contacting Toolset support.

Can you please paste your Toolset Debug information in the Debug information field? That way, I can know what plugins you are using. Are you using Toolset Access?
- https://toolset.com/faq/provide-debug-information-faster-support/

Based on the screenshot, the posts are created through a Toolset Form, right?
What is the role of the users that are not automatically assigned as authors of their posts?
Does it happen for the administrator user?

#2144023

It is a new user I created that should have rights thought access to manage edit and take care of their post. It shows author for the admin user

{"core":{"Wordpress":{"Multisite":"No","SiteURL":"https:\/\/mychoiceseniorliving.com","HomeURL":"https:\/\/mychoiceseniorliving.com","Version":"5.8","PermalinkStructure":"\/%postname%\/","PostTypes":"post, page, attachment, revision, nav_menu_item, custom_css, customize_changeset, oembed_cache, user_request, wp_block, wp_template, wpforms, cred-form, cred-user-form, wp-types-group, wp-types-user-group, wp-types-term-group, acf-field-group, acf-field, view, view-template, communities, families, wpa-helper, cred_rel_form","PostSatus":"publish, future, draft, pending, private, trash, auto-draft, inherit, request-pending, request-confirmed, request-failed, request-completed, acf-disabled, hidden"},"Server":{"jQueryVersion":"3.6.0","PHPVersion":"7.4.22","MySQLVersion":"5.7.32","ServerSoftware":"Apache"},"PHP":{"MemoryLimit":"768M","UploadMax":"256M","PostMax":"256M","TimeLimit":"120","MaxInputVars":"3000"}},"plugins":{"active_plugins":{"advanced-custom-fields\/acf.php":{"Name":"Advanced Custom Fields","PluginURI":"https:\/\/www.advancedcustomfields.com","Version":"5.9.9","Author":"Delicious Brains","AuthorURI":"https:\/\/www.advancedcustomfields.com","TextDomain":"acf","DomainPath":"\/lang","Network":false,"RequiresWP":"","RequiresPHP":"","UpdateURI":"","Title":"Advanced Custom Fields","AuthorName":"Delicious Brains"},"cred-frontend-editor\/plugin.php":{"Name":"Toolset Forms","PluginURI":"https:\/\/toolset.com\/home\/toolset-components\/?utm_source=plugin\u0026utm_medium=gui\u0026utm_campaign=forms#forms","Version":"2.6.9","Author":"OnTheGoSystems","AuthorURI":"http:\/\/www.onthegosystems.com\/","TextDomain":"cred-frontend-editor","DomainPath":"","Network":false,"RequiresWP":"","RequiresPHP":"","UpdateURI":"","Title":"Toolset Forms","AuthorName":"OnTheGoSystems"},"favorites\/favorites.php":{"Name":"Favorites","PluginURI":"http:\/\/favoriteposts.com","Version":"2.3.2","Author":"Kyle Phillips","AuthorURI":"https:\/\/github.com\/kylephillips","TextDomain":"favorites","DomainPath":"\/languages\/","Network":false,"RequiresWP":"","RequiresPHP":"","UpdateURI":"","Title":"Favorites","AuthorName":"Kyle Phillips"},"peters-login-redirect\/wplogin_redirect.php":{"Name":"Peter\u0027s Login Redirect","PluginURI":"http:\/\/www.theblog.ca\/wplogin-redirect","Version":"2.9.9","Author":"Peter Keung","AuthorURI":"https:\/\/www.theblog.ca","TextDomain":"peters-login-redirect","DomainPath":"\/languages\/","Network":false,"RequiresWP":"","RequiresPHP":"","UpdateURI":"","Title":"Peter\u0027s Login Redirect","AuthorName":"Peter Keung"},"recent-posts-widget-with-thumbnails\/recent-posts-widget-with-thumbnails.php":{"Name":"Recent Posts Widget With Thumbnails","PluginURI":"https:\/\/wordpress.org\/plugins\/recent-posts-widget-with-thumbnails\/","Version":"7.1.1","Author":"Kybernetik Services","AuthorURI":"https:\/\/www.kybernetik-services.com\/?utm_source=wordpress_org\u0026utm_medium=plugin\u0026utm_campaign=recent-posts-widget-with-thumbnails\u0026utm_content=author","TextDomain":"recent-posts-widget-with-thumbnails","DomainPath":"","Network":false,"RequiresWP":"4.6","RequiresPHP":"5.2","UpdateURI":"","Title":"Recent Posts Widget With Thumbnails","AuthorName":"Kybernetik Services"},"sg-cachepress\/sg-cachepress.php":{"Name":"SiteGround Optimizer","PluginURI":"https:\/\/siteground.com","Version":"5.8.3","Author":"SiteGround","AuthorURI":"https:\/\/www.siteground.com","TextDomain":"sg-cachepress","DomainPath":"\/languages","Network":false,"RequiresWP":"","RequiresPHP":"","UpdateURI":"","Title":"SiteGround Optimizer","AuthorName":"SiteGround"},"toolset-blocks\/wp-views.php":{"Name":"Toolset Blocks","PluginURI":"https:\/\/toolset.com\/?utm_source=viewsplugin\u0026utm_campaign=views\u0026utm_medium=plugins-list-full-version\u0026utm_term=Visit plugin site","Version":"1.5.3","Author":"OnTheGoSystems","AuthorURI":"https:\/\/toolset.com","TextDomain":"toolset-blocks","DomainPath":"","Network":false,"RequiresWP":"","RequiresPHP":"","UpdateURI":"","Title":"Toolset Blocks","AuthorName":"OnTheGoSystems"},"toolset-maps\/toolset-maps-loader.php":{"Name":"Toolset Maps","PluginURI":"https:\/\/toolset.com\/documentation\/user-guides\/display-on-google-maps\/","Version":"2.0.8","Author":"OnTheGoSystems","AuthorURI":"http:\/\/www.onthegosystems.com","TextDomain":"toolset-maps","DomainPath":"\/languages","Network":false,"RequiresWP":"3.4","RequiresPHP":"5.6","UpdateURI":"","Title":"Toolset Maps","AuthorName":"OnTheGoSystems"},"types-access\/types-access.php":{"Name":"Toolset Access","PluginURI":"http:\/\/toolset.com\/home\/types-access\/?utm_source=accessplugin\u0026utm_campaign=access\u0026utm_medium=release-notes-plugins-list\u0026utm_term=Visit plugin site","Version":"2.8.11","Author":"OnTheGoSystems","AuthorURI":"http:\/\/www.onthegosystems.com\/","TextDomain":"types-access","DomainPath":"","Network":false,"RequiresWP":"","RequiresPHP":"","UpdateURI":"","Title":"Toolset Access","AuthorName":"OnTheGoSystems"},"types\/wpcf.php":{"Name":"Toolset Types","PluginURI":"https:\/\/toolset.com\/?utm_source=typesplugin\u0026utm_campaign=types\u0026utm_medium=plugins-list-full-version\u0026utm_term=Visit plugin site","Version":"3.4.10","Author":"OnTheGoSystems","AuthorURI":"http:\/\/www.onthegosystems.com","TextDomain":"types","DomainPath":"","Network":false,"RequiresWP":"","RequiresPHP":"","UpdateURI":"","Title":"Toolset Types","AuthorName":"OnTheGoSystems"},"user-menus\/user-menus.php":{"Name":"User Menus","PluginURI":"https:\/\/wordpress.org\/plugins\/user-menus\/","Version":"1.2.7","Author":"Code Atlantic","AuthorURI":"https:\/\/code-atlantic.com\/","TextDomain":"user-menus","DomainPath":"","Network":false,"RequiresWP":"","RequiresPHP":"","UpdateURI":"","Title":"User Menus","AuthorName":"Code Atlantic"},"wpforms\/wpforms.php":{"Name":"WPForms","PluginURI":"https:\/\/wpforms.com","Version":"1.6.7.3","Author":"WPForms","AuthorURI":"https:\/\/wpforms.com","TextDomain":"wpforms-lite","DomainPath":"assets\/languages","Network":false,"RequiresWP":"4.9","RequiresPHP":"5.5","UpdateURI":"","Title":"WPForms","AuthorName":"WPForms"}},"mu_plugins":[],"dropins":[]},"theme":{"Name":"Astra","ThemeURI":null,"Author":"\u003Ca href=\u0022https:\/\/wpastra.com\/about\/\u0022\u003EBrainstorm Force\u003C\/a\u003E","AuthorURI":null,"Template":"astra","Version":"3.6.8","TextDomain":null,"DomainPath":null},"extra-debug":{"access":{"rules":[],"settings":{"types":{"post":{"mode":"permissions","permissions":{"publish":{"roles":["administrator"]},"delete_any":{"roles":["administrator"]},"edit_any":{"roles":["administrator"]},"delete_own":{"roles":["administrator"]},"edit_own":{"roles":["administrator"]},"read_private":{"roles":["administrator"]},"read":{"roles":["administrator"]}}},"page":{"mode":"permissions","permissions":{"publish":{"roles":["administrator"]},"delete_any":{"roles":["administrator"]},"edit_any":{"roles":["administrator"]},"delete_own":{"roles":["administrator"]},"edit_own":{"roles":["administrator"]},"read_private":{"roles":["administrator"]},"read":{"roles":["administrator"]}}},"attachment":{"mode":"not_managed"},"oembed_cache":{"mode":"not_managed"},"user_request":{"mode":"not_managed"},"project":{"mode":"not_managed"},"acf-field":{"mode":"not_managed"},"et_theme_builder":{"mode":"not_managed"},"et_template":{"mode":"not_managed"},"et_header_layout":{"mode":"not_managed"},"et_body_layout":{"mode":"not_managed"},"et_footer_layout":{"mode":"not_managed"},"et_pb_layout":{"mode":"not_managed"},"bp-email":{"mode":"not_managed"},"um_form":{"mode":"permissions","permissions":{"publish":{"roles":[]},"delete_any":{"roles":[]},"edit_any":{"roles":[]},"delete_own":{"roles":[]},"edit_own":{"roles":[]},"read":{"roles":[]},"read_private":{"roles":[]}}},"um_directory":{"mode":"not_managed"},"al":{"mode":"not_managed"},"living":{"mode":"not_managed"},"all":{"mode":"permissions","permissions":{"publish":{"roles":[]},"delete_any":{"roles":[]},"edit_any":{"roles":[]},"delete_own":{"roles":[]},"edit_own":{"roles":[]},"read":{"roles":[]},"read_private":{"roles":[]}}},"um_profile_tabs":{"mode":"not_managed"},"wpcf-custom-group-6c3041cc446c2ad34ba6d942be555bbd":{"permissions":{"delete_any":{"roles":["administrator"]},"edit_any":{"roles":["administrator"]},"read":{"roles":["administrator"]}},"mode":"not_managed","title":"Logged-in users"},"communities":{"mode":"permissions","permissions":{"publish":{"roles":["administrator"]},"delete_any":{"roles":["administrator"]},"edit_any":{"roles":["administrator"]},"delete_own":{"roles":["administrator"]},"edit_own":{"roles":["administrator"]},"read_private":{"roles":["administrator"]},"read":{"roles":["administrator"]}}},"families":{"mode":"permissions","permissions":{"publish":{"roles":["administrator"]},"delete_any":{"roles":["administrator"]},"edit_any":{"roles":["administrator"]},"delete_own":{"roles":["administrator"]},"edit_own":{"roles":["administrator"]},"read_private":{"roles":["administrator"]},"read":{"roles":["administrator"]}}},"elementor_snippet":{"mode":"not_managed"},"elementor_font":{"mode":"not_managed"},"elementor_icons":{"mode":"not_managed"},"e-landing-page":{"mode":"not_managed"},"wp_template":{"mode":"not_managed"},"scheduled-action":{"mode":"not_managed"},"wpforms":{"mode":"not_managed"}},"tax":[],"third_party":{"__CRED_CRED_USER":{"__CRED_CRED_USER_GROUP":{"permissions":{"use_any_attachment_with_cred_user_forms":{"roles":["administrator","editor","author","community","users"]},"edit_other_users_with_cred_516":{"roles":["administrator"]},"edit_own_user_with_cred_516":{"roles":["administrator","community","users"]},"create_users_with_cred_510":{"roles":["administrator","community","users","guest"]},"create_users_with_cred_493":{"roles":["administrator","community","users","guest"]}},"mode":"permissions"}},"__CRED_CRED":{"__CRED_CRED_GROUP":{"permissions":{"use_any_attachment_with_cred_post_forms":{"roles":["administrator","editor","author","community","users"]},"delete_other_posts_with_cred":{"roles":["administrator","editor","author"]},"delete_own_posts_with_cred":{"roles":["administrator","editor","author"]},"edit_other_posts_with_cred_678":{"roles":["administrator","editor","author"]},"edit_own_posts_with_cred_678":{"roles":["administrator","editor","author"]},"create_posts_with_cred_692":{"roles":["administrator","editor","author","users","guest"]},"create_posts_with_cred_659":{"roles":["administrator","editor","author","community","guest"]}},"mode":"permissions"}},"__CRED_CRED_REL":{"__CRED_CRED_REL_GROUP":{"permissions":{"use_any_attachment_with_cred_rel_forms":{"roles":["administrator","editor","author","users"]}},"mode":"permissions"}},"__FIELDS":{"__FIELDS_GROUP_assisted-living":{"permissions":{"modify_fields_in_edit_page_assisted-living":{"roles":["administrator","editor","author","community"]},"view_fields_in_edit_page_assisted-living":{"roles":["administrator","editor","author","agent","contributor","community","pending_user","subscriber","suspended","users","guest"]}},"mode":"permissions"},"__FIELDS_GROUP_field-group-for-assisted-livings":{"permissions":{"modify_fields_in_edit_page_field-group-for-assisted-livings":{"roles":["administrator","editor","author","community"]},"view_fields_in_edit_page_field-group-for-assisted-livings":{"roles":["administrator","editor","author","agent","contributor","community","pending_user","subscriber","suspended","users","guest"]}},"mode":"permissions"},"__FIELDS_GROUP_fam":{"permissions":{"modify_fields_in_edit_page_fam":{"roles":["administrator","editor","author","users"]},"view_fields_in_edit_page_fam":{"roles":["administrator","editor","author","agent","contributor","community","pending_user","subscriber","suspended","users","guest"]}},"mode":"permissions"}}}}},"types":{"add_resized_images_to_library":0,"images_remote":0,"images_remote_cache_time":"36","help_box":"by_types","hide_standard_custom_fields_metabox":"show","postmeta_unfiltered_html":"on","usermeta_unfiltered_html":"on"},"CRED":{"wizard":false,"cache_notice":1,"export_settings":1,"export_custom_fields":1,"autogeneration_email":{"subject":"Welcome new user","body":"[username]Your username is: %cuf_username%[\/username]\\n[nickname]Your nickname is: %cuf_nickname%[\/nickname]\\n[password]Your password is: %cuf_password%[\/password]"},"dont_load_cred_css":1},"views":{"views_template_loop_blog":0,"wpv_bootstrap_version":1,"wpv_custom_conditional_functions":["wpv_contains"],"wpv_custom_inner_shortcodes":[],"wpv_debug_mode":1,"wpv_debug_mode_type":"full","wpv_map_plugin":0,"wpv_show_hidden_fields":"","wpv_saved_auto_detected_framework":"","wpv_codemirror_autoresize":"","wpv_enable_pagination_manage_history":0,"wpv_enable_parametric_search_manage_history":0,"support_spaces_in_meta_filters":0,"allow_views_wp_widgets_in_elementor":0,"default_user_editor":"gutenberg","default_wpa_editor":"gutenberg","manage_meta_transient_method":"cron","editing_experience":"blocks","views_template_conditions_for_all":[],"view_cpt_all":650,"views_template_for_communities":656,"views_template_for_all":656,"views_template_conditions_for_communities":[],"views_template_for_families":706,"views_template_conditions_for_families":[],"view_cpt_communities":"994"},"installer":{"version":"2.6.1","repositories":{"wpml":{"api-url":"https:\/\/api.wpml.org\/","bucket-url":"not assigned","subscription":"","last-successful-subscription-fetch":"none"},"toolset":{"api-url":"https:\/\/api.toolset.com\/","bucket-url":"https:\/\/wptypes.s3.amazonaws.com\/toolset-bucket-32.json","subscription":{"key":"Typz0QO0Zp","data":{"subscription_type":7526,"expires":"2022-04-20","status":"1","notes":""},"registered_by":1,"site_url":"http:\/\/mychoiceseniorliving.com"},"last-successful-subscription-fetch":"2021-08-16 01:10:21"}},"instances":{"\/home\/customer\/www\/mychoiceseniorliving.com\/public_html\/wp-content\/plugins\/types\/vendor\/otgs\/installer\/installer.php":{"bootfile":"\/home\/customer\/www\/mychoiceseniorliving.com\/public_html\/wp-content\/plugins\/types\/vendor\/otgs\/installer\/installer.php","version":"2.6.1","args":{"plugins_install_tab":"1","repositories_include":["toolset","wpml"],"site_key_nags":[{"repository_id":"toolset","product_name":"Toolset"}]},"delegated":true}}}}}
#2144519

Is the screenshot from your initial message taken by the administrator, or by that user? What is this user?
Can I log into your website and check this closely?
Where the form is being used, so I can test it during my debugging?
Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#2148815

Thank you for the credentials and my apologies for the late reply.

Because the user has a custom role that is not mirroring the author or editor role, they cannot be added in the authors dropdown. There are two solutions to overcome that:
- Either add a secondary role(author or editor) to the selected user. I have created an example user(Community Toolset #32). But, that will make the user available in the author dropdown for other post types too(posts, pages).
- Programmatically change the arguments for the authors dropdown. I added the following custom code to a Toolset snippet and it made it work for the "Communities" custom post type:

function wpdocs_add_community_to_dropdown( $query_args, $r ) {
  global $post;

  //Doing it only for the custom post type
  if($post->post_type == 'communities') {
    $query_args['role'] = array('Community');
 
    // Unset the 'who' as this defaults to the 'author' role
    unset( $query_args['who'] );
  }
  return $query_args;
}
add_filter( 'wp_dropdown_users_args', 'wpdocs_add_community_to_dropdown', 10, 2 );

Check it here hidden link

I hope this helps. Let me know if you have any questions.

#2152905

Is their a way to make it automatically find the author and Assign it when they fill out the form? the community should have the same permissions as an author.

#2153467

Use the following code and change the ID in line 3 (1234) to the actual form ID.

add_action('cred_submit_complete', 'my_save_data_action2',10,2);
function my_save_data_action2 ($post_id, $form_data) {
    if ($form_data['id']==1234) { 
        $post= array(
            'ID'            => $post_id,
            'post_author'   => get_current_user_id(),
        );

        wp_update_post( $post );
    }
}
#2155797

I posted that code into custom code and changed the id to my form id but it still does not assign the author automatically as it should

#2155987

You have added the snippet, but you have configured it to run for the backend, whereas the Toolset forms are run in the frontend, you need to activate the snippet for the frontend, and for AJAX calls. Check this screenshot hidden link