user-roles

Hide specific shipping methods for a specific user roles in Woocommerce

痞子三分冷 提交于 2019-12-11 14:23:34
问题 In Woocommerce I am using WooCommerce Wholesale Pro Suite (from IgniteWoo) and Flat Rate Box Shipping plugins to add B2B to our eshop. I am trying to disable the Flat Rate Box Shipping for specific user roles, guests and customers. I found this code after searching online: add_filter( 'woocommerce_package_rates', 'hide_shipping_for_user_role', 10, 2 ); function hide_shipping_for_user_role( $rates, $package ) { // Role ID to be excluded $excluded_role = "wholesale_customer"; // Shipping rate

Keycloak : unable to map user roles when creating user for api

◇◆丶佛笑我妖孽 提交于 2019-12-11 11:58:53
问题 I am new to Keycloak. I want create user using Keycloak admin REST API. I have managed to create a user. But the problem is I also want to assign admin role to the user. Attached is my JSON body. Can someone tell me what am I doing wrong here? { "username": "username", "email": "user@gmail.com", "firstName": "name1", "lastName": "name2", "realmRoles": [ "admin" ], "enabled": true, "credentials": [{ "type": "password", "value": "default", "temporary": false }] } Thank you in advance 来源: https:

Adding Identity 2.0 Roles to custom Identity

馋奶兔 提交于 2019-12-11 11:19:02
问题 I recently started work on a new application using MVC 5 and Identity 2.0, in order to use a different password hashing algorithm I implemented the custom identity detailed in this guide (https://code.msdn.microsoft.com/ASPNET-45-MVC5-Custom-1a94ab26#content). I have looked at various ways of incorporating roles into this identity implementation but so far have not found a way of making them work with this new identity implementation. Does anyone now of a guide on how to go about adding roles

Wordpress: Hide specific categories from User Role on the Add New page

你离开我真会死。 提交于 2019-12-11 07:35:51
问题 Just as title says really; How can i hide specific categories from specified User Roles in Wordpress on the Add New Post page? So that users of a specific role cannot see the hidden categories (therefore, not post in them either). I used to do this via a plugin but they havnt been updated in years and i dont seem able to find a replacement. So any help would be appreciated. Cheers 回答1: Answer converted to comment. Apply this code to your own and should work. add_filter('list_terms_exclusions'

Role Based Access Control in AngularJS Blur-Admin template

蹲街弑〆低调 提交于 2019-12-11 07:00:52
问题 How to implement Role Based Access Control in Blur-Admin template for angularJS? Where to define roles? Which files are concerned? 回答1: Perfect and Working Solution! This solution basically provides restricted access to the roles allowed for that component. define params in all of your main modules in this way - (for example) - (function() { 'use strict'; angular.module('BlurAdmin.pages.components', [ 'BlurAdmin.pages.components.mail', // 'BlurAdmin.pages.components.timeline', // 'BlurAdmin

Show WooCommerce products only to multiple authorized user roles

不问归期 提交于 2019-12-11 05:22:28
问题 I'm trying to adapt "Completely hide products from unauthorized users in WooCommerce" answer code to also allow several custom user roles to view this products. I believe the best way to accomplish this is to expand the authorized user function to include this user roles. This is the changes that I have tried to implement with no success. Can someone shine a light on how to proceed? // Conditional function checking for authorized users function is_authorized_user() { if ( is_user_logged_in()

Disable Shortcode usage for certain user roles

你说的曾经没有我的故事 提交于 2019-12-11 05:15:26
问题 I have a guest posting plugin on my Wordpress site and want to disable usage of shortcodes for certain users roles (subscribers for example). I need this for security reasons mostly. 回答1: Assume that you have shortcode, function myshortcode(){ $user = wp_get_current_user(); if ( !in_array( 'author', (array) $user->roles ) ) { //Run shortcode } } add_shortcode('myshortcode','myshortcode'); 回答2: You can use the strip_shortcodes() function, you can use it as a filter to strip shortcodes from

Wolkenkit: ACLs for authorization and user roles

心已入冬 提交于 2019-12-11 00:15:44
问题 I am trying to understand on how to extend the wolkenkit auth layer. Say i want users with different roles: normal, moderator and admin. normal users can see and modify their own content, but aren't allowed to modify content from other users. moderator users are allowed to modify all entries, but don't have permission to delete anything than their own content. admin users can modify and delete everything. There are also unauthenticated guest users who can read everything but modify nothing.

Changing user role after purchasing a products in WooCommerce

痞子三分冷 提交于 2019-12-08 08:12:00
问题 I have a need to build two plans (paid) on my site. If the user buys Gold Plan it should create a user (role) Gold and give him 20% discount on travel packages. If user buys platinum wp should create 'Platinum' user role for that customer. Now I have found the code online but it does not work: add_action( 'woocommerce_order_status_completed', 'wpglorify_change_role_on_purchase' ); function wpglorify_change_role_on_purchase( $order_id ) { // get order object and items $order = new WC_Order(

Replace product image by a placeholder based on user roles in WooCommerce

╄→尐↘猪︶ㄣ 提交于 2019-12-08 05:44:29
问题 In WooCommerce I am using user roles to define what each user role can see. If the user is "customer" or "administrator", he is able to see the product image, otherwise he see WooCommerce default placeholder image. For that I use the code below: function woocommerce_product_get_image_id_callback( $value ) { global $current_user; if ( in_array( 'customer', (array) $current_user->roles )|| in_array( 'administrator', (array) $current_user->roles )) { return $value; } else { return false; } } add