I am trying to: create a front-end form for normal post submission with CRED
I've followed your tutorial on how to create a membership site and it is absolutely great.
The new member - Business - has now the capability to create a post and I'd like to avoid sending the user to the wp admin area.
Is there a way to create a CRED front-end form for normal wordpress posts?
Something really basic like:
Title
Content
Featured image
WYSIWYG editor
Category
Thank you in advance!
Marco
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Marco,
Thank you for contacting our support forum.
Yes this is actually possible all you need to do is to create the CRED form for a Post and then add the CRED form to a page.
Please let me know if this helps.
Thanks,
Shane
Hi Shane,
thank you for your swift reply, I've seen the tutorial to create a front-end submission CRED form and then add the form to a PAGE for general display.
What I'm asking is: is it possible to create a front-end submission CRED form and then add the relevant content in a standard WP post?
Looking forward to your reply,
Regards
Marco
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Marco,
Yes this is possible. See screenshot
From the settings you should be able to select the default post type of wordpress.
Please let me know if this helps.
Thanks,
Shane
Hi Shane,
thank you for putting me on the right path!
There are a few bugs that need to be solved.
- I've enabled the Add Media button, however if I try to upload an image into the content, I get the "You don't have permission to attach files to this post" message
- Similar issue happens when trying to set a Featured Image to the post: "Featured image upload failed."
I suspect the problem has to do with the user permission level: I've created a Role called Business set at level 2, with only upload_files/Allows access to Administration Panel: Media (Add New) set to true.
Any suggestion?
Thanks in advance!
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Marco,
Thank you for the insight.
The custom role, does it have Publish capabilities for Media ?
Could you provide me with a screenshot for the Media permissions for the custom role?
Thanks,
Shane
Hi Shane,
Thank you for your reply!
Hopefully these screenshot will help you to pinpoint the issue.
Crossing fingers 🙂
Regards,
Marco
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Marco,
I noticed you are running older versions of our plugins.
We have recently released our new versions of our plugins that will help with access permissions.
I suggest performing this update as a few changes were made to our access plugin.
Thanks,
Shane
Hi Shane,
I've updated the toolset components as suggested.
- Featured image uploads fine, however is not rendered in front end
this is the relevant CRED code
[credform class='cred-form cred-keep-original']
<p>Dear Member, please note your post will be screened by our staff and published according to our policies.
<h3>Title</h3>[cred_field field='post_title' post='post' value='' urlparam='']
<h3>Content</h3>[cred_field field='post_content' post='post' value='' urlparam='']
<h3>Choose a category:</h3>
[cred_field field='category' display='checkbox']
<h3>Tags:</h3>
[cred_field field='post_tag']
<h3>Featured image:</h3>[cred_field field='_featured_image' value='' urlparam='']
[cred_field field='form_submit' value='Submit Post' urlparam='']
[/credform]
- Upload of image in the post body is still generating the same error.
Waiting to hear from you,
Marco
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Marco,
Could you check on the backend if the featured image was actually uploaded through the CRED form ?
Thanks,
Shane
Hi Shane,
picture is present in the Media library and is linked to the correct post (second screenshot) but not visible yet even if logged as admin (first screenshot)
Keeping my fingers crossed,
Regards,
Marco
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Marco,
So this is a bug that we are already aware of and we are working on a fix for this.
In the meantime we have a workaround that should resolve this issue for you.
Please add the following to your functions.php file
/**
* Custom code to force add thumbnail meta
* to add announcement CRED form post
*/
function force_thumbnail( $post_id, $form_data ) {
if ( $form_data['id'] == 1564 && !empty( $_POST['_featured_image'] ) ) {
$args = array(
'numberposts' => 1,
'post_type' => 'attachment',
'post_parent' => $post_id
);
$thumb = get_posts( $args );
$meta_update = add_post_meta( $post_id, "_thumbnail_id", $thumb[0]->ID, true );
}
}
add_action( 'cred_submit_complete', 'force_thumbnail', 10, 2 );
Replace the 1564 with the id of your cred form and this should resolve the issue for you.
Thanks,
Shane
Hi Shane,
Thank you for the fix: it solved the featured image issue.
The "Add media in post" bug still persists, any workaround for that?
Thank you!
Marco
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Marco,
Would you mind opening a fresh thread for this issue and marking this one as resolved?
It would help to streamline the forums for other users who are having similar issues with their featured images.
You have the option of assigning me that ticket so i'll be able to handle it 🙂
Thanks,
Shane