How to close or open topic by the author ?
-
Addding close topic select box in the reply page
Only the moderate can set up open/close on topic status now.
I have plan to change the author in topic to set open/close status by yourself.The code ongoing
function my_bbp_theme_before_topic_form_submit_wrapper() { if (!current_user_can('moderate', $topic_id)) { // The all visitor can see open/close box echo '<label for="bbp_topic_status">'.esc_html_e('Topic Status:', 'bbpress').'</label><br />'; bbp_form_topic_status_dropdown(); } } add_action('bbp_theme_before_topic_form_submit_wrapper', 'my_bbp_theme_before_topic_form_submit_wrapper'); function my_bbp_get_topic_statuses($topic_statuses, $topic_id) { // The all visitor may be possible to chang the topic status,if the select box works. if (!current_user_can('moderate', $topic_id)) { $topic_statuses = array( bbp_get_public_status_id() => _x('Open', 'Open the topic', 'bbpress'), bbp_get_closed_status_id() => _x('Closed', 'Close the topic', 'bbpress') ); } return $topic_statuses; } add_filter('bbp_get_topic_statuses', 'my_bbp_get_topic_statuses', 10, 2);
Two questions
1st
The topic open/close select box is shown all visitor except for author.
So this code need to change all vistor to topic author.
But I don’t know.if (!current_user_can('moderate', $topic_id)) { // All visitor can do ↓ if(current_user_can( '//topic author//' ) ) { // Only topic author can do
2nd
The select box is shown, but it doesn’t work at all.
In short, the select box is appearance only.
So I have to add some code to work open/colse select box.
The select box does not link to topic status function.
But I don’t know how to chage the code.$topic_statuses = array( bbp_get_public_status_id() => _x('Open', 'Open the topic', 'bbpress'), bbp_get_closed_status_id() => _x('Closed', 'Close the topic', 'bbpress') )
- You must be logged in to reply to this topic.