Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Remove Spesific Menu in Account Page */
- function remove_spesific_menu_account_page( $endpoint ) {
- $user = wp_get_current_user();
- if ( in_array( 'customer', $user->roles ) ) { /* For Role Customer */
- unset( $endpoint['edit_account'] ); /* Remove Menu Edit Account */
- unset( $endpoint['post_view_stats'] ); /* Remove Menu Post View Stats */
- unset( $endpoint['change_password'] ); /* Remove Menu Change Password, because already in WooCommerce Account Page */
- }
- return $endpoint;
- }
- add_filter( 'jnews_account_page_endpoint', 'remove_spesific_menu_account_page' );
- /* Change Account Menu Dropdown */
- function change_dropdown_link_account_menu( $dropdown ) {
- $user = wp_get_current_user();
- if ( in_array( 'customer', $user->roles ) ) { /* For Role Customer */
- if ( isset( $dropdown['account'] ) ) {
- $endpoint = \JNews\AccountPage::getInstance()->get_endpoint();
- $dropdown['account'] = array(
- 'text' => jnews_return_translation($endpoint['account']['title'], 'jnews', $endpoint['account']['label']),
- 'url' => esc_url( home_url_multilang( $endpoint['account']['slug'] . '/' . $endpoint['jnews_paywall_sub']['slug'] ) ), /* Change URL of My Account */
- );
- }
- }
- return $dropdown;
- }
- add_filter( 'jnews_dropdown_link', 'change_dropdown_link_account_menu', 99 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement