function my_new_toolbar_item($wp_admin_bar)
{
    $args = array('id' => 'eal_logo', 'title' => '<div style="width:10em"><a href="' . site_url() . '/wp-admin/"><img style="display:block; margin-top:1em; margin-left:-1em; width:11em"  src="' . plugin_dir_url(__FILE__) . 'Logo_EAs.LiT.png"></a></div>');
    $wp_admin_bar->add_node($args);
    // 	$wp_admin_bar->remove_menu ('user-actions');
    $wp_admin_bar->remove_menu('updates');
    $wp_admin_bar->remove_menu('comments');
    $wp_admin_bar->remove_menu('new-content');
    $wp_admin_bar->remove_menu('wp-logo');
    $wp_admin_bar->remove_menu('site-name');
    // 	$title  = "<div>";
    // 	$title .= sprintf ("<div class='dashicons-before %s' style='display:inline'>&nbsp;", (RoleTaxonomy::getCurrentRoleType()=="author") ? "dashicons-admin-users" :  "dashicons-groups");
    $title .= sprintf("%s %s", site_url(), RoleTaxonomy::getCurrentRoleDomain()["label"]);
    // 	$title .= sprintf ("<a class='ab-item' href='%s/wp-admin/profile.php'>%s</a></div>", site_url(), RoleTaxonomy::getCurrentRoleDomain()["label"]);
    // 	$wp_admin_bar->add_menu (array ("id" => "eal_currentRole", "title" => $title, "meta" => array ("class" => sprintf ("dashicons-before %s", (RoleTaxonomy::getCurrentRoleType()=="author") ? "dashicons-admin-users" :  "dashicons-groups"))));
    $wp_admin_bar->add_menu(array("id" => "eal_currentRole", "href" => sprintf('%s/wp-admin/profile.php', site_url()), "title" => sprintf("<div class='wp-menu-image dashicons-before %s'>&nbsp;%s</div>", RoleTaxonomy::getCurrentRoleType() == "author" ? "dashicons-admin-users" : "dashicons-groups", RoleTaxonomy::getCurrentRoleDomain()["label"])));
}
Exemple #2
0
 public function WPCB_posts_where($where, $checktype = TRUE)
 {
     global $wp_query, $wpdb;
     if ($wp_query->query["post_type"] == $this->type || !$checktype) {
         // if all items are considered --> consider all type starting with "item"
         if ($this->type == "item") {
             $where = str_replace("{$wpdb->posts}.post_type = 'item'", "{$wpdb->posts}.post_type LIKE 'item%'", $where);
         }
         // if current role type = author --> show all items except drafts from others
         if (RoleTaxonomy::getCurrentRoleType() == "author") {
             $where .= "AND ({$wpdb->posts}.post_status != 'draft' OR {$wpdb->posts}.post_author = " . get_current_user_id() . ")";
         }
         if (isset($_REQUEST["item_type"]) && $_REQUEST['item_type'] != "0") {
             $where .= " AND I.type = '{$_REQUEST['item_type']}'";
         }
         if (isset($_REQUEST["post_status"]) && $_REQUEST['post_status'] != "0") {
             $where .= " AND {$wpdb->posts}.post_status = '" . $_REQUEST['post_status'] . "'";
         }
         if (isset($_REQUEST["learnout_id"])) {
             $where .= " AND L.id = {$_REQUEST['learnout_id']}";
         }
         if (isset($_REQUEST['item_author'])) {
             $where .= " AND {$wpdb->posts}.post_author \t\t\t= " . $_REQUEST['item_author'];
         }
         if (isset($_REQUEST['item_points'])) {
             $where .= " AND I.points  \t= " . $_REQUEST['item_points'];
         }
         if (isset($_REQUEST['level_FW']) && $_REQUEST['level_FW'] > 0) {
             $where .= " AND I.level_FW \t= " . $_REQUEST['level_FW'];
         }
         if (isset($_REQUEST['level_PW']) && $_REQUEST['level_PW'] > 0) {
             $where .= " AND I.level_PW \t= " . $_REQUEST['level_PW'];
         }
         if (isset($_REQUEST['level_KW']) && $_REQUEST['level_KW'] > 0) {
             $where .= " AND I.level_KW\t= " . $_REQUEST['level_KW'];
         }
         if (isset($_REQUEST['learnout_id'])) {
             $where .= " AND I.learnout_id = " . $_REQUEST['learnout_id'];
         }
         if (isset($_REQUEST['flag'])) {
             if ($_REQUEST['flag'] == 1) {
                 $where .= " AND I.flag = 1";
             }
             if ($_REQUEST['flag'] == 2) {
                 $where .= " AND (I.flag != 1 OR I.flag IS NULL)";
             }
         }
         if (isset($_REQUEST['taxonomy']) && $_REQUEST['taxonomy'] > 0) {
             $children = get_term_children($_REQUEST['taxonomy'], RoleTaxonomy::getCurrentRoleDomain()["name"]);
             array_push($children, $_REQUEST['taxonomy']);
             $where .= sprintf(' AND %1$s.ID IN (SELECT TR.object_id FROM %2$s TT JOIN %3$s TR ON (TT.term_taxonomy_id = TR.term_taxonomy_id) WHERE TT.term_id IN ( %4$s ))', $wpdb->posts, $wpdb->term_taxonomy, $wpdb->term_relationships, implode(', ', $children));
         }
         if ($this->type == "itembasket") {
             $where = str_replace("{$wpdb->posts}.post_type = 'itembasket'", "{$wpdb->posts}.post_type LIKE 'item%'", $where);
             $basket = RoleTaxonomy::getCurrentBasket();
             // get_user_meta(get_current_user_id(), 'itembasket', true);
             if (is_array($basket) && count($basket) > 0) {
                 $where .= " AND I.ID IN (" . implode(",", $basket) . ") ";
             } else {
                 $where .= " AND (1=2) ";
             }
         }
     }
     return $where;
 }