wordpress-bootstrap
wordpress-bootstrap copied to clipboard
allow editing post based on user level
I noticed that user_level is used to check if user can edit post, is this correct method? Does this mean that aothers of smae level can edit eachothers post and not only the ones they wrote?
I just confirmed that the edit button shows up on all articles if an author is logged in, when in the admin panel a logged in author can only edit their own articles. I consider this pretty major
I think this commit causes the issue: https://github.com/320press/wordpress-bootstrap/commit/acc7ce0c142008d5397b28695d61096e6d79c3c7#single.php
edit_post_link handles displaying the Edit link to authorized users automatically.
In order to get the nice button the <a tag needs the label, so an override for the eodt_pos_link should be made. Starangely enough the button shows only up on Chrome/linux, I did not see it on my windows machine.
You can get the custom class on edit_post_link by doing this in functions.php
/* Add class to edit button */
function my_custom_edit_post_link($output) {
$output = str_replace('class="post-edit-link"', 'class="post-edit-link btn btn-success"', $output);
return $output;
}
add_filter('edit_post_link', 'my_custom_edit_post_link');
To be more precise (to get the hover effect)
/* Add class to edit button */
function gk_edit_post_link($output) {
$output = str_replace('class="post-edit-link"', 'class="post-edit-link btn btn-success" style="display: none;"', $output);
return $output;
}
add_filter('edit_post_link','gk_edit_post_link');
My hover effect works without that extra style. If by hover effect you mean the subtle color change? In fact, your code makes my button not show at all.
I'm sorry you are right. no "display:none" needed... Oops I spoke too soon, with display:none it does Sweet FA, without it the button always shows. Might be a plugin I use (code used on devel.kuilder.net/bootstrap in the first child theme. (and I am logged in as admin.) I had it working for a bit....
And originally the button would only who when you hovered over p-arts of the article.