0

I am currently developing a website which needs user input on posts. An admin will feed the data and regular visitors can notify the errors/additions to specific post. I am using a hidden login form which contains a contributor username and password to let the public login to the admin and make necessary changes. Its all working fine.

What I am looking for is, I don’t want the ‘Update’ button for the Contributor user when revising a post. Always keep it like ‘Submit for review’.

Any ideas? Thanks in advance!

0

When something is available for other people to read, it is usually called "published". This all thing sounds like an overly complex way to have posts which can be read by anyone (since the contributor user is basically public info) with a comment section.

I suggest you give some more thought about why do you want feedback to be private (nothing is perfect, and no matter how much feedback you get there there will always be more), but in case you truly think this is the way to go, than just publish the post as private and let people that are interested in reviewing it create a new user in a subscriber role, and leave their feedback as comments.

Having a public user with contributor credentials is a bad idea, giving him more capabilities than it has by default makes it even worse.

| improve this answer | |
0

You could just translate it to set it to something else, but that'd change it for all user classes, and everywhere.

If you want to change it only for contributors (and only on the editor-page in admin), you could use the gettext filter, e.g.

function change_submit_button_text($translation, $text, $domain) {
global $editing;
if($text == "Update" && $editing == true && should_change_submit_button()) {
        return "Submit for review";
    }
    return $translation;
}
add_filter("gettext", "change_submit_button_text", 10, 3);

Note that you'd have to replace should_change_submit_button() with a condition that targets those users you want to replace it for, or remove it if you want to change it for all (including admin).

| improve this answer | |
  • Thank you for your reply. However, I just dont need the translate, the functionality also needed! Thknx – Abu Bilal Nov 1 '17 at 6:56
  • I have managed to get the problem solved by this filter ` function re_aprove($data , $postarr){ global $current_user; get_currentuserinfo(); //check if current user is not admin if (!current_user_can('manage_options')){ if ($data['post_status'] == "publish"){ $data['post_status'] = "pending"; } } return $data; } ` – Abu Bilal Nov 1 '17 at 12:44
  • ` $user = wp_get_current_user(); $allowed_roles = array('editor', 'contributor'); if( array_intersect($allowed_roles, $user->roles ) ) { add_filter('status_edit_pre', 're_aprove'); } ` but the button changes only after the first edit. any filters other than 'status_edit_pre' to call on edit screen init? – Abu Bilal Nov 1 '17 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.