Forum Replies Created
-
Author
-
verlorenParticipant
Instead of removing the action, it’s better to add a filter which hooks into “prevent_admin_access”.
Here an example:COPY CODEadd_filter(‘woocommerce_prevent_admin_access’, ‘preventAdminAccess’); function preventAdminAccess() { $prevent = false; if (userShouldNotSeeDashboard()) { $prevent = true; } return $prevent; }
Best regards.
verlorenParticipantInstead of removing the action, it’s better to add a filter which hooks into “prevent_admin_access”.
Here an example:`
add_filter(‘woocommerce_prevent_admin_access’, ‘preventAdminAccess’);function preventAdminAccess() {
$prevent = false;if (userShouldNotSeeDashboard()) {
$prevent = true;
}return $prevent;
}Best regards.
verlorenParticipantHi all,
found it.
In /wp-content/plugins/woocommerce/includes/admin/class-wc-admin.php is function “prevent_admin_access”. Here the docblock:
COPY CODE/** * Prevent any user who cannot 'edit_posts' (subscribers, customers etc) from accessing admin. */
Within class-wc-admin.php constructor, the action is added:
COPY CODEpublic function __construct() { ... add_action( 'admin_init', array( $this, 'prevent_admin_access' ) ); }
So from here it’s easy to remove the action and add an own action.
Best regards.
February 6, 2016 at 03:12 in reply to: WooCommerce Checkout Country, State and City field not working as expected #102385verlorenParticipantSorry for third post….
Tried to deactivate state field with Booster Plus for WooCommerce. Deactivating the field has no effect. Trying to remove the required attribute (with this plugin) has no effect, too.
State field is not my friend….February 6, 2016 at 03:09 in reply to: WooCommerce Checkout Country, State and City field not working as expected #102384verlorenParticipantI forgot to mention that sometimes it is impossible to order because of that. When i try to order without seeing preloaded data, there is no chance to submit a fully filled form.
When changing country, state hides. So no way to fill it out.
When trying to submit form, it gets reloaded with warning that state is a required field. But all other fields are empty now, too.
Trying to fill it again ends up in a hidden state field. -
AuthorPosts