Skip to content

Instantly share code, notes, and snippets.

@Alimir
Created December 12, 2020 20:34
Show Gist options
  • Save Alimir/d7fe834c88f17610b2922f46a3460381 to your computer and use it in GitHub Desktop.
Save Alimir/d7fe834c88f17610b2922f46a3460381 to your computer and use it in GitHub Desktop.
wp ulike restrict user cookie
<?php
function wp_ulike_pro_custom_restrict_user( $args ){
$settings_type = new wp_ulike_setting_type( $args['type'] );
if( isset( $_COOKIE ) ){
foreach( $_COOKIE as $key => $val ){
if( strpos( $key, $settings_type->getCookieName() ) !== false) {
throw new \Exception( WP_Ulike_Pro_Options::getNoticeMessage( 'invalid_permission', 'sample permission message' ) );
}
}
}
}
add_action( 'wp_ulike_before_process', 'wp_ulike_pro_custom_restrict_user', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment