public function is_user_role_excluded( $user_id, $option ) { $user = get_user_by( 'id', $user_id ); if ( empty( $user ) || ! $option ) { return false; } $roles = (array) $user->roles; if ( ! empty( $roles ) ) { foreach ( $roles as $role ) { if ( in_array( $role, $option, true ) ) { return true; } } } return false; } /** * Method mega_frontend_builder * * @return void */ public function mega_frontend_builder() { if ( get_post_type() === 'custom-mega-menu' && ! $this->rendered ) { $this->rendered = true; echo "'; } } /** * Method render_style * * @param string $output $output. * @param int $page_id $page_id. * * @return string */ public function render_style( $output, $page_id ) { if ( 'custom-mega-menu' === get_post_type( $page_id ) ) { $style = $this->add_page_custom_css( $page_id ); $style .= $this->get_shortcode_custom_css( $page_id ); $output = $style . $output; } return $output; } /** * Method single_row_action * * @param array $actions $actions. * @param object $post $post. * * @return array */ public function single_row_action( $actions, $post ) { if ( 'custom-mega-menu' === $post->post_type ) { unset( $actions['view'] ); unset( $actions['inline hide-if-no-js'] ); } return $actions; } }