Forum Replies Created

Viewing 15 replies - 1 through 15 (of 43 total)
  • Thread Starter 8bit7

    (@8bit7)

    Yes, wonderful! Thanks!! It did not work right out of the box, but clicking the “Attempt block recovery” button on each one fixed it no problem. Thanks for your quick work fixing it, I was in desperate need to make some changes to the page lol.

    Thread Starter 8bit7

    (@8bit7)

    Thanks! I see the update came through last night, however now there is a much larger issue.

    Warning: include_once(.../wp-content/plugins/price-table-block/dist/modules.asset.php): failed to open stream: No such file or directory in .../wp-content/plugins/price-table-block/includes/helpers.php on line 49
    
    Warning: include_once(): Failed opening '.../wp-content/plugins/price-table-block/dist/modules.asset.php' for inclusion (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear') in .../wp-content/plugins/price-table-block/includes/helpers.php on line 49
    
    Warning: array_merge(): Expected parameter 1 to be an array, null given in .../wp-content/plugins/price-table-block/includes/helpers.php on line 54

    When I load the editor for a page with the page blocks it crashes with these fatal errors. Looking through the files I indeed do not have a modules.asset.php in /dist/

    EDIT: I checked the helpers.php file and it’s calling for several files I do not have.

    None of these exist:

    • /dist/modules.asset.php
    • /dist/modules.js
    • /dist/style-modules.css
    • /dist/modules.css

    The only files inside /dist/ are:

    • index.asset.php
    • index.js
    • style.css
    Thread Starter 8bit7

    (@8bit7)

    I rolled back my database and it’s working now. Odd indeed.

    Thread Starter 8bit7

    (@8bit7)

    My apologies if I didn’t explain myself clearly. I’m afraid I haven’t explained myself well, but thank you for that code! Unfortunately that’s not what I was aiming to do.

    I’m trying to change the link to gravatar in the line below

    <a class="kt-link-to-gravatar"  target...
    				

    to something like this…

    <a class="kt-link-to-gravatar"  target...

    I have UserWP that provides a neat profile area for the user and I want to link the avatar kadence displays on the woocommerce account dashboard to that page. I’ve already managed to change and sync up the actual avatar images using get_avatar thankfully, but changing the surrounding link from gravatar.com to mysite.com/profile without editing the core theme file has proved beyond me.

    I do have a kadence-child theme if there is some way to copy over the file, edit it, and make it use my custom file instead? I’ve experimented with this but found no solution. I was hoping it would be as simple as copying the files and adding a snippet to functions.php.

    Thread Starter 8bit7

    (@8bit7)

    Are you referring to the avatar on the My Account page that uses the?[woocommerce_my_account]?shortcode?

    Yes, I am

    If so, the component uses the?get_avatar()?function. You can edit the avatar HTML using the?get_avatar?filter. The linked filter documentation provides an example to help you change the avatar to something else.

    So I’ve been frustrated with this for a couple of days but I still can’t get it to work. Mind showing me an example code for functions.php that could change the link?

    Here’s the relevant code:
    /wp-content/themes/kadence/inc/components/woocommerce/component.php

    /**
    	 * Avatar for myaccount page.
    	 */
    	public function myaccount_nav_avatar() {
    		$current_user = wp_get_current_user();
    		if ( kadence()->option( 'woo_account_navigation_avatar' ) && 0 !== $current_user->ID ) {
    			?>
    			<div class="kadence-account-avatar">
    				<div class="kadence-customer-image">
    				<a class="kt-link-to-gravatar"  target="_blank" rel="no" title="<?php echo esc_attr__( 'Update Profile Photo', 'kadence' ); ?>">
    					<?php echo get_avatar( $current_user->ID, 60 ); ?>
    				</a>
    				</div>
    				<div class="kadence-customer-name">
    					<?php echo esc_html( $current_user->display_name ); ?>
    				</div> 
    			</div>
    			<?php
    		}
    	}

    Thread Starter 8bit7

    (@8bit7)

    Thanks for the detailed reply. After some testing to get the info you needed I discovered it was the “Disable WP API JSON” setting in WP Hardening plugin. With it turned off (i.e. can use JSON) it works fine now.

    Thanks for the help!

    Thread Starter 8bit7

    (@8bit7)

    oh cool, thanks!

    Thread Starter 8bit7

    (@8bit7)

    So, got it working in functions.php, but still would be awesome to have it in the plugin. Here’s the code for future googlers.

    // Redirect logged out users who visit the profile page
    function login_redirect() {
    
        // Get current page 
        global $pagenow;
    
        // Check to see if user in not logged in and also on the profile page
        if(!is_user_logged_in() && $pagenow = is_page('profile'))
              // If user is, redirect to login form.
              auth_redirect();
    }
    
    add_action( 'wp', 'login_redirect' );
    Thread Starter 8bit7

    (@8bit7)

    I added the code below to functions.php to try to force it, but it’s still not redirecting.

    function add_login_redirect() {
        if ( is_page('profile')  &&  !is_user_logged_in() ){
            wp_redirect( site_url( '/login' ) );
        }
    }
    
    add_action('template_redirect', 'add_login_redirect');
    
    Thread Starter 8bit7

    (@8bit7)

    big sad ?? I hope it gets brought back into the queue soon. Appreciate the help either way.

    For now I figured out I could use a radio button with no default set. This will only show no result until a user selects an answer in the profile, but if they ever choose yes or no it’ll never go away. Not ideal, but it’s something. Hopefully my users always only hit yes if it’s true >.<

    Thread Starter 8bit7

    (@8bit7)

    I must have it turned off because it annoys the users and it’s a live production site with marketing efforts so I am not allowed to turn it back on. But the url is NodeBux.com

    Thread Starter 8bit7

    (@8bit7)

    Thanks for the info, both of you. Appreciate the update and I’m following the ticket now. Marking as resolved since it’s not a theme issue.

    Thread Starter 8bit7

    (@8bit7)

    Hey, it does not seem to be the shortcode block causing the issue though, as it works in other themes and in other areas of your theme just fine. Seems to be a bug between the latest wp update and your implementation of something in the “body” of the full site editor (as it works in the header and footer).

    My initial guess would be it’s because the “body” area uses the <div> tag as a wrapper instead of the <header>, etc. and something in that div wrapper is breaking it. That or it’s a change in how the php gets served in wp_body_open thats bugging with an unique implementation of your theme.

    I rolled back to before the wp update overnight and it did indeed fix it, so it is for sure related to something wp changed during the update.

    • This reply was modified 1 year, 6 months ago by 8bit7.
    Thread Starter 8bit7

    (@8bit7)

    Hello, it’s fully up to date and it started with the update about 4-5 days ago. I do know that the pop was not happening before the update and immediately after the update it began popping up.

    However, please realize that if the update turned on the ad blocker automatically it is possible that is why I started seeing it after the update as I do not know if I had it on or off beforehand to be honest because I adjusted all the settings quite a long time ago and haven’t needed to change them in a very long time.

    Thread Starter 8bit7

    (@8bit7)

    Awesome Thanks. The problem is actually incredibly simple so perhaps it could be a quick priority if your schedule allows?

    The problem is in the file /wp-content/plugins/wp-optin-wheel/code/services/class-mailchimp-service.php

    On line 18 it says ‘status’ => ‘subscribed’ but a simple admin option to set it to ‘status’ => ‘pending’ is all it takes to allow mailchimp to double optin. Since this is a serious privacy concern for users and actually is required by governmental laws in some places perhaps it could be done soon.

    Below I have copied the entire fixed code for you. I am already running this and it works great.

    <?php
    
    namespace MABEL_WOF_LITE\Code\Services
    {
    
    	use MABEL_WOF_LITE\Core\Common\Linq\Enumerable;
    	use MABEL_WOF_LITE\Core\Common\Managers\Settings_Manager;
    
    	class MailChimp_Service
    	{
    		public static function add_to_list($list_id, $email, $fields) {
    
    			if(self::is_in_list($email,$list_id))
    				return "This email address is already used.";
    
    			$data = [
    				'email_address' => $email,
    				'status' =>  'pending' /* CHANGED THIS LINE FROM 'status' =>  'subscribed' TO 'status' =>  'pending' */
    			];
    
    			if(!empty($fields)){
    				$merge_fields = [];
    				foreach($fields as $field){
    					$merge_fields[$field->id] = $field->value;
    				}
    				$data['merge_fields'] = $merge_fields;
    			}
    
    			$response = self::request('lists/'.$list_id.'/members/'.md5(strtolower($email)),$data);
    
    			if(isset($response->status) && $response->status == 400)
    				return $response->detail;
    
    			return true;
    		}
    
    		public static function get_email_lists() {
    			$payload = self::request('lists?count=100', null, 'get');
    			if($payload === null) return [];
    			$list_objects = Enumerable::from($payload->lists)->select(function($x){
    				return  ['id' => $x->id, 'name' => $x->name];
    			})->toArray();
    
    			$lists = [];
    
    			foreach($list_objects as $list) {
    				array_push($lists, [ 'id' => $list['id'], 'title' => $list['name'] ] );
    			}
    
    			return $lists;
    		}
    
    		public static function is_in_list($email,$listId) {
    			$hash = md5(strtolower($email));
    			$response = self::request('lists/'.$listId.'/members/'.$hash,null,'get');
    			if($response->status === 'subscribed' || $response->status === 'pending') return true;
    			return false;
    		}
    
    		public static function get_fields_from_list($listId){
    			$response = self::request('lists/'.$listId.'/merge-fields',null,'get');
    			return Enumerable::from($response->merge_fields)->where(function($x){return $x->type === 'text';})->select(function($x){
    				return [ 'id' => $x->tag, 'title' => $x->name ];
    			})->toArray();
    		}
    
    		private static function request($type, array $body = null, $method = 'post') {
    			$api_key = Settings_Manager::get_setting('mailchimp_api');
    			if($api_key === null) return null;
    
    			$data_center = explode('-',$api_key)[1];
    			$url = 'https://' . $data_center . '.api.mailchimp.com/3.0/'.$type.'/';
    
    			$headers = [
    				'Authorization' => 'Basic ' . base64_encode( 'user:' . $api_key ),
    				'Content-Type' => 'application/json'
    			];
    
    			$options = [
    				'timeout' => 15,
    				'headers' => $headers
    			];
    
    			if($body != null) {
    				$options['body'] = json_encode( $body );
    				$options['method'] = 'PUT';
    			}
    
    			$response = $method === 'post' ? wp_remote_post( $url, $options) : wp_remote_get($url,$options);
    
    			if(is_wp_error($response)) return null;
    
    			return json_decode(wp_remote_retrieve_body($response ));
    		}
    
    	}
    }
Viewing 15 replies - 1 through 15 (of 43 total)