• Resolved egh9

    (@egh9)


    how to display number Products by user
    and how to display list Products by user in profile user

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi @egh9

    Can you please elaborate your query a little more so I can understand it properly and provide you better support.

    “how to display number Products by user” means you want to display “User Purchased Product”?

    Thread Starter egh9

    (@egh9)

    @pratik-jain

    display count The number of Product add by the user not Purchased Product

    and list archive Product add by the user

    • This reply was modified 5 years, 6 months ago by egh9.

    Hi @egh9

    For your query,

    1) Display count The number of Product add by the user not Purchased Product.
    Ans – Are you using EDD FES add-on to submit the product in your store from front-end?

    OR different users logged into your website and add the EDD product from WP admin?

    Thread Starter egh9

    (@egh9)

    @pratik-jain
    i use WP User Frontend Pro to submit form front-end

    Hi @egh9

    Thanks for the details. I think It surly store the product author name from which it is submitted. Please refer below screenshot.

    https://prnt.sc/p0na2f

    If product author is stored correctly then simply you can WP_Query with author ID for EDD products.

    Thread Starter egh9

    (@egh9)

    hi @pratik-jain

    I want to add in list products and count products in user profile
    Can you give the appropriate code?

    Thread Starter egh9

    (@egh9)

    @pratik-jain there Is anything new?

    Hi @egh9

    Sorry for delay response.

    Please try below code which will give you EDD products by particular user.

    $args = array ( 
    		'post_type'      => 'download',
    		'post_status'    => array( 'publish' ),
    		'orderby'        => 'date', 
    		'order'          => 'desc',
    		'posts_per_page' => 10,
    		'paged' 	 => 1,
    		'author'         => 1, // Pass User ID Here
    	);
    
    $query = new WP_Query( $args );
    $total_post = $query->found_posts; // Total Product

    Now you can use this query, loop it and use it as you want.

    Thread Starter egh9

    (@egh9)

    @pratik-jain Thank you the problem was solved

    Thread Starter egh9

    (@egh9)

    number product user in post

    <?php
    if ( ! defined( 'ABSPATH' ) ) {
        exit; // Exit if accessed directly.
    }
    global $post;
    $author = get_user_by( 'id', get_query_var( 'author' ) );
    
    ?>
     <?php
                                $authordownload =get_the_author_meta( 'ID',$author->ID );
                                ?>
    <?php echo count_user_posts($authordownload,'download'); ?>
    • This reply was modified 5 years, 6 months ago by egh9.
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘how to display number Products by user’ is closed to new replies.