This topic contains 7 reply and 2 voices, and was last updated by Tareq Hasan 6 years, 4 months ago
Viewing 7 Posts - 1 through 7 (of 7 total)
Author Posts
May 27, 2013 at 6:36 pm 4248
Tareq Hasan Hi there, I have created several posts on the site, but the edit link shows up only for the Admin, not for the user, who created the post. Can you help with this please? Thanks, Adrian
May 28, 2013 at 1:54 am 4255
Tareq Hasan Tareq Hasan

Hello Adrian,

By default, WordPress doesn’t give subscribers and contributors the capability to edit a post. They even don’t give subscribers for posting, only contributors can submit a post but can’t edit them. So it’s a permission or capability problem.

So for this problem, you could change the user roles or you could change/replace the default WP’s edit link with yours. If you want to use a custom edit link only for WP User Frontend, use this snippet, it’ll give you a edit link for current post.
[php]
if ( current_user_can( ‘delete_others_posts’ ) || $post->post_author == get_current_user_id() ) {
$edit_page = (int) wpuf_get_option( ‘edit_page_id’, ‘wpuf_general’ );
$url = add_query_arg( array(‘pid’ => $post->ID), get_permalink( $edit_page ) );

printf( ‘<a href="%s">%s</a>’, wp_nonce_url( $url, ‘wpuf_edit’ ), __( ‘Edit’, ‘wpuf’ ) );
}
[/php]

May 28, 2013 at 2:44 pm 4279
csapoa csapoa

I see. Thank you for the reply!

Can I place the above code to the single.php or somewhere else to have the edit available for all the posts for the user, who created it?

Thanks,
Adrian

May 28, 2013 at 3:42 pm 4280
Tareq Hasan Tareq Hasan

Yeah, replace the edit_link code with this code.

June 4, 2013 at 4:42 pm 4547
csapoa csapoa

I cannot find this edit_link code, could you tell me where is it? (file and line)

Thanks very much!

Adrian

June 4, 2013 at 10:33 pm 4553
Tareq Hasan Tareq Hasan

the edit_link is in your theme, not in the plugin. That code is responsible for displaying the post edit link. If you don’t find it, insert the code where you want to show your edit link.

June 16, 2013 at 5:50 pm 4935
csapoa csapoa

Hi Tareq,

I’ve put the code in the functions.php, but doesn’t work. Is this the file that I have to edit? Or should this code be inserted in a different file?

Thanks,
Adrian

June 16, 2013 at 6:29 pm 4939
Tareq Hasan Tareq Hasan

I’ve already mentioned it’s your theme and look into single.php.

Viewing 7 Posts - 1 through 7 (of 7 total)