Forum Replies Created

Viewing 10 replies - 31 through 40 (of 40 total)
  • No error logs here and backdating has resolved the issues.

    Thanks for posting this update! ??

    Getting the same issue here, tracked it to the edd_die(); call on line 149 of discount-actions in “wp-content/plugins/easy-digital-downloads/includes/admin/discounts”

    Commenting out the edd_die() call makes discounts work successfully again.

    Please can someone look into this?

    It also gives a white screen when in downloads->reports and selecting a new report from the dropdown such as ‘last week’ and clicking ‘filter’

    This error was also traced to an edd_die() call, this time on line 958 of graphing.php in “wp-content/plugins/easy-digital-downloads/includes/admin/reporting”

    Commenting out the edd_die() call allows me to load report filters again.

    Thread Starter flashjunkie

    (@flashjunkie)

    Ok, im really close to having this work but hitting a roalblock.

    I’m hooking into the process-download and adding some customer meta which tracks their weekly downloads. The meta fields are reset to 0 for every user once per week.

    I have ammended the column in the back end customer view which is correctly displaying the customer downloads per week. However, i’ve set the column to sortable but it is defaulting to sort by customer ID when i attempt to use the value to sort.

    How can I enable sorting?

    Code I am using to add the customer meta

    $customer = new EDD_Customer( $user_info['id'], true );
    $usersCurrentDLSWeek = $customer->get_meta( "_edd_tpet_total_user_downloads_week" , true );
    
    if($usersCurrentDLSWeek == false || $usersCurrentDLSWeek == "" || $usersCurrentDLSWeek == null ) {
    
         //no meta exists
         $usersCurrentDLSWeek = 0;
         $customer->add_meta( '_edd_tpet_total_user_downloads_week' , 0, true );
    
    }
    
    $usersCurrentDLSWeek++;
    
    $customer->update_meta( '_edd_tpet_total_user_downloads_week', $usersCurrentDLSWeek );

    Code to display my column in customer view in admin
    class-customer-table.php edits

    public function get_columns() {
    	$columns = array(
    		'name'          => __( 'Name', 'easy-digital-downloads' ),
    		'email'         => __( 'Primary Email', 'easy-digital-downloads' ),
    		'num_purchases' => __( 'Purchases', 'easy-digital-downloads' ),
    		//JAYJAY track weekly downloads
    		'_edd_tpet_total_user_downloads_week' => __( 'Downloads This Week', 'easy-digital-downloads' ),
    		'amount_spent'  => __( 'Total Spent', 'easy-digital-downloads' ),
    		'date_created'  => __( 'Date Created', 'easy-digital-downloads' ),
    	);
    
    	return apply_filters( 'edd_report_customer_columns', $columns );
    
    }
    
    //...
    //...
    
    public function get_sortable_columns() {
    	return array(
    		'date_created'  => array( 'date_created', true ),
    		'name'          => array( 'name', true ),
    		'num_purchases' => array( 'purchase_count', false ),
    		'_edd_tpet_total_user_downloads_week' => array( '_edd_tpet_total_user_downloads_week', true ),
    		'amount_spent'  => array( 'purchase_value', false ),
    	);
    }
    
    public function reports_data() {
    	global $wpdb;
    
    	$data    = array();
    	$paged   = $this->get_paged();
    	$offset  = $this->per_page * ( $paged - 1 );
    	$search  = $this->get_search();
    	$order   = isset( $_GET['order'] )   ? sanitize_text_field( $_GET['order'] )   : 'DESC';
    	$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
    
    	$args    = array(
    		'number'  => $this->per_page,
    		'offset'  => $offset,
    		'order'   => $order,
    		'orderby' => $orderby
    	);
    
    	if( is_email( $search ) ) {
    		$args['email'] = $search;
    	} elseif( is_numeric( $search ) ) {
    		$args['id']    = $search;
    	} elseif( strpos( $search, 'user:' ) !== false ) {
    		$args['user_id'] = trim( str_replace( 'user:', '', $search ) );
    	} else {
    		$args['name']  = $search;
    	}
    
    	$this->args = $args;
    	$customers  = EDD()->customers->get_customers( $args );
    
    	if ( $customers ) {
    
    		foreach ( $customers as $customer ) {
    
    		$user_id = ! empty( $customer->user_id ) ? intval( $customer->user_id ) : 0;
    
    		//JAYJAY get download count
    		$mycustomer = new EDD_Customer( $user_id, true );
    		$usersCurrentDLSWeek = $mycustomer->get_meta( "_edd_tpet_total_user_downloads_week" , true );
    
    		//
    		if($usersCurrentDLSWeek == "") {
    			$usersCurrentDLSWeek = 0;
    		}
    
    		$data[] = array(
    			'id'            => $customer->id,
    			'user_id'       => $user_id,
    			'name'          => $customer->name,
    			'email'         => $customer->email,
    			'_edd_tpet_total_user_downloads_week' => $usersCurrentDLSWeek,
    			'num_purchases' => $customer->purchase_count,
    			'amount_spent'  => $customer->purchase_value,
    			'date_created'  => $customer->date_created,
    			);
    		}
    	}
    
    	return $data;
    }

    Please help!

    • This reply was modified 5 years, 6 months ago by flashjunkie.
    Thread Starter flashjunkie

    (@flashjunkie)

    Hi Pratik,

    Yes we can use this window and it’s great, but we have over 5000 members since launch on Sunday so we need an easy way of detecting account sharing, if we could see users listed in order of downloads we could then manually check their passes and see if they are using many IPS etc.

    Hope this makes sense.

    Jay

    Thread Starter flashjunkie

    (@flashjunkie)

    I’ve made the following changes to the Yoast file “inc->class-wpseo-utils.php”

    /**
    * Returns a script tag with Schema blob.
    *
    * @param array  $graph The Schema graph array to output.
    * @param string $class The (optional) class to add to the script tag.
    *
    * @return false|string A schema blob with script tags.
    */
    public static function schema_tag( $graph, $class = 'yoast-schema-graph' ) {
    	if ( ! is_array( $graph ) || empty( $graph ) ) {
    		return false;
    	}
    
    	$output = array(
    		'@context' => 'https://schema.org',
    		'@graph'   => $graph,
    	);
    	//HOTFIX Find "& #39;" and replace with a '
    	//HOTFIX Find "»" and replace with a -
    	//return "<script type='application/ld+json' class='" . esc_attr( $class ) . "'>" . self::format_json_encode( $output ) . '</script>' . "\n";
    	$return_string_json = "<script type='application/ld+json' class='" . esc_attr( $class ) . "'>" . self::format_json_encode( $output ) . '</script>' . "\n";
    	$return_string_json = str_replace("'", "'", $return_string_json);
    	$return_string_json = str_replace("&raquo;", "-", $return_string_json);
    	return $return_string_json;
    }

    This seems to have fixed the issue but obviously not an ideal fix as it will need to be copied over every time yoast updates and does not account for any other HTML entities that appear on other pages. If you can recommend a better fix for this issue it would be much appreciated.

    Many thanks.

    • This reply was modified 5 years, 8 months ago by flashjunkie.
    • This reply was modified 5 years, 8 months ago by flashjunkie.
    Thread Starter flashjunkie

    (@flashjunkie)

    Great catch! I’ll make the change.

    Thanks for looking into this for me!

    Fantastic support ??

    Thread Starter flashjunkie

    (@flashjunkie)

    Awesome thanks, more than happy to add some code to my site-specific-plugin if needed to fix this issue as I understand it’s more than likely bespoke to my site.

    For now, i’ve disabled HTML Minify.

    Many thanks.

    Thread Starter flashjunkie

    (@flashjunkie)

    I have CDN configured through AWS and W3TC but currently the CDN is disabled during development.

    No other Cache plugins are installed.

    I also use Clearfy to disable some unneeded WP options etc ( I am not using any of their ‘Minify’ options )

    Thread Starter flashjunkie

    (@flashjunkie)

    Still the same. Here is the code in its entirety.

    Minify HTML (Inline JSS & CSS) switched ON

    <script type="application/ld+json" class="yoast-schema-graph yoast-schema-graph--main">/*<![CDATA[*/{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://tpet.co.uk/#organization","name":"Teacher's Pet","url":"https://tpet.co.uk/","sameAs":["https://facebook.com/TeachersPetUK","https://instagram.com/tpetuk","https://youtube.com/TeachersPetUK","https://pinterest.com/teacherspetuk","https://twitter.com/TeachersPetUK"],"logo":{"@type":"ImageObject","@id":"https://tpet.co.uk/#logo","url":"https://tpet.co.uk/wp-content/uploads/2019/05/dexter-teachers-pet.png","width":500,"height":428,"caption":"Teacher's Pet"},"image":{"@id":"https://tpet.co.uk/#logo"}},{"@type":"WebSite","@id":"https://tpet.co.uk/#website","url":"https://tpet.co.uk/","name":"Teacher's Pet","publisher":{"@id":"https://tpet.co.uk/#organization"},"potentialAction":{"@type":"SearchAction","target":"https://tpet.co.uk/?s={search_term_string}","query-input":"required name=search_term_string"}},{"@type":"WebPage","@id":"https://tpet.co.uk/#webpage","url":"https://tpet.co.uk/","inLanguage":"en-GB","name":"Teacher's Pet » The home of high quality classroom resources for displays, activities & more!","isPartOf":{"@id":"https://tpet.co.uk/#website"},"about":{"@id":"https://tpet.co.uk/#organization"},"image":{"@type":"ImageObject","@id":"https://tpet.co.uk/#primaryimage","url":"wp-content/uploads/tpet-uploads/gary-home-1.png"},"primaryImageOfPage":{"@id":"https://tpet.co.uk/#primaryimage"},"datePublished":"2015-09-16T11:07:53+00:00","dateModified":"2019-06-10T16:20:13+00:00","description":"Welcome to Teacher's Pet your one stop shop for all of the very best in classroom resources including, posters, labels, games, activities, challenge cards, bunting and so, so much more!"}]}/*]]>*/</script>

    Minify HTML (Inline JSS & CSS) switched OFF

    <script type="application/ld+json" class="yoast-schema-graph yoast-schema-graph--main">{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://tpet.co.uk/#organization","name":"Teacher's Pet","url":"https://tpet.co.uk/","sameAs":["https://facebook.com/TeachersPetUK","https://instagram.com/tpetuk","https://youtube.com/TeachersPetUK","https://pinterest.com/teacherspetuk","https://twitter.com/TeachersPetUK"],"logo":{"@type":"ImageObject","@id":"https://tpet.co.uk/#logo","url":"https://tpet.co.uk/wp-content/uploads/2019/05/dexter-teachers-pet.png","width":500,"height":428,"caption":"Teacher's Pet"},"image":{"@id":"https://tpet.co.uk/#logo"}},{"@type":"WebSite","@id":"https://tpet.co.uk/#website","url":"https://tpet.co.uk/","name":"Teacher's Pet","publisher":{"@id":"https://tpet.co.uk/#organization"},"potentialAction":{"@type":"SearchAction","target":"https://tpet.co.uk/?s={search_term_string}","query-input":"required name=search_term_string"}},{"@type":"WebPage","@id":"https://tpet.co.uk/#webpage","url":"https://tpet.co.uk/","inLanguage":"en-GB","name":"Teacher's Pet » The home of high quality classroom resources for displays, activities & more!","isPartOf":{"@id":"https://tpet.co.uk/#website"},"about":{"@id":"https://tpet.co.uk/#organization"},"image":{"@type":"ImageObject","@id":"https://tpet.co.uk/#primaryimage","url":"wp-content/uploads/tpet-uploads/gary-home-1.png"},"primaryImageOfPage":{"@id":"https://tpet.co.uk/#primaryimage"},"datePublished":"2015-09-16T11:07:53+00:00","dateModified":"2019-06-10T16:20:13+00:00","description":"Welcome to Teacher's Pet your one stop shop for all of the very best in classroom resources including, posters, labels, games, activities, challenge cards, bunting and so, so much more!"}]}</script>

    After a more thorough look it appears minify is adding the ‘/*<![CDATA[*/’ itself…?

    Thread Starter flashjunkie

    (@flashjunkie)

    OK thanks, trying now!

    (Fast support! Thanks!)

Viewing 10 replies - 31 through 40 (of 40 total)