Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to administrator that show different help pages for each role of user #8

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add flag only if it is a help page
  • Loading branch information
Chan Shing Fai committed Jun 28, 2013
commit 54622b0117ebab46a9804b4e7eb654fefd25e777
21 changes: 11 additions & 10 deletions wp-help.php
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,9 @@ public function submitbox_actions() {
foreach ($key as $role_name){
if ($role_name != 'administrator'){
echo '<input type="checkbox" name="help-'.$role_name.'" id="help-'.$role_name. '"';
echo $data[0][$role_name] ? 'checked' : '';
echo '> '.$role[$role_name]['name'].'<br>';
if ( count($data) > 0 )
echo $data[0][$role_name] ? 'checked' : '';
echo '> '. ucfirst($role_name) .'<br>';
}
}
?>
Expand All @@ -612,15 +613,15 @@ public function submitbox_actions() {
}

public function save_post( $post_id ) {
$role = $this->get_editable_roles();
$key = array_keys($role);
foreach ($key as $role_name){
if ($role_name != 'administrator'){
$stack[$role_name] = isset($_POST['help-'.$role_name] ) ? true:false;
}
}
update_post_meta( $post_id, '_cws_wp_help_permission', $stack);
if ( isset( $_POST['_cws_wp_help_nonce'] ) && wp_verify_nonce( $_POST['_cws_wp_help_nonce'], 'cws-wp-help-save' ) ) {
$role = $this->get_editable_roles();
$key = array_keys($role);
foreach ($key as $role_name){
if ($role_name != 'administrator'){
$stack[$role_name] = isset($_POST['help-'.$role_name] ) ? true:false;
}
}
update_post_meta( $post_id, '_cws_wp_help_permission', $stack);
if ( isset( $_POST['cws_wp_help_make_default_doc'] ) ) {
// Make it the default_doc
update_option( self::default_doc, absint( $post_id ) );
Expand Down