SHOW THE CREATE DATE AND YEAR OF THE VENDOR IN VENDOR PROFILE PAGE

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WC Vendors SHOW THE CREATE DATE AND YEAR OF THE VENDOR IN VENDOR PROFILE PAGE

Viewing 20 reply threads
  • Author
    Posts
    • #92254
      karl.deligero
      Participant

      Hi,

      It is possible to show the Create Date and Year of the vendor on their profile page?

      Thank You

    • #92561
      Sushobhan
      Keymaster

      You can fetch the creation date of any WordPress user, this includes vendors as well, by the following two lines

      $user_data = get_userdata(get_current_user_id());
      $registered_date = $user_data->user_registered;

      The first line is fetching the currently logged in users data and the second line extracts the registration date out of it.
      By the way, in which position of the profile page, you want to show this detail?

    • #92895
      kpetty.iccs
      Participant

      where can these two lines be added

    • #92920
      Sushobhan
      Keymaster

      At first you need to tell me where you want to show this information. Share me the vendor profile image after marking your the position. Based on that I can suggest you the appropriate hook or filter name. In that function body you will need to add those two lines.

    • #92937
      karl.deligero
      Participant

      Hi, I want to show this in my vendor profile page. See the attached image. By the way, I use my elementor to integrate my vendor page

    • #92963
      Sushobhan
      Keymaster

      You cannot add PHP code to Elementor, as it is not supported. Instead you can use shortcodes, there is an Elementor block for that. Use the following shortcode to get your desired result –
      [wcfm_store_info id='' data='register_on']

    • #93041
      karl.deligero
      Participant

      Hi,

      Thank You it’s worth by the way. But I want is not only the specific date but the term “Joined 1 month ago“see attached image.

      Note: The words Joined 1y 10 months are placeholder only.

      Attachments:
      You must be logged in to view attached files.
    • #93083
      Sushobhan
      Keymaster

      try using the following code –

      function vendor_registration_date_shortcode( $attr ) {
          global $post;
          $store_id = '';
          if ( isset( $attr['id'] ) && ! empty( $attr['id'] ) ) {
              $store_id = absint( $attr['id'] );
          }
          if ( wcfm_is_store_page() ) {
              $wcfm_store_url = get_option( 'wcfm_store_url', 'store' );
              $store_name = apply_filters( 'wcfmmp_store_query_var', get_query_var( $wcfm_store_url ) );
              $store_id = 0;
              if ( ! empty( $store_name ) ) {
                  $store_user = get_user_by( 'slug', $store_name );
                  $store_id = $store_user->ID;
              }
          }
          if ( is_product() ) {
              $store_id = $post->post_author;
          }
          if( !$store_id ) return;
          $register_on = abs( get_user_meta( $store_id, 'wcfm_register_on', true ) );
          $today = strtotime( "now" );
          $diff = abs( $today - $register_on );
          $years = floor( $diff / (365 * 24 * 60 * 60) );
          $months = floor( ($diff - $years * 365 * 24 * 60 * 60) / (30 * 24 * 60 * 60) );
          $days = floor( ($diff - $years * 365 * 24 * 60 * 60 - $months * 30 * 24 * 60 * 60) / (24 * 60 * 60) );
          $total_duration = '';
          if ( $years || $months || $days ) {
              if ( $years )
                  $total_duration .= sprintf( _n( '%s year ', '%s years ', $years ), $years );
              if ( $months )
                  $total_duration .= sprintf( _n( '%s month ', '%s months ', $months ), $months );
              if ( $days )
                  $total_duration .= sprintf( _n( '%s day ', '%s days ', $days ), $days );
              return sprintf( 'Joined %sago', $total_duration );
          }
          return 'Joined Today';
      }
      
      // register shortcode
      add_shortcode( 'vendor_registration_date', 'vendor_registration_date_shortcode' );

      Add this code to your child theme’s functions.php
      In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/

      In the Elementor code block use the following shortcode –
      [vendor_registration_date id=”]

    • #93425
      karl.deligero
      Participant

      AWESOME IT’S WORK. THANKS A LOT 🙂

    • #93429
      karl.deligero
      Participant

      Btw I have 2 more problems encounter in my Vendor Profile Page. The First thing is the “Overall Vendor Star Count Rating” of the product of the vendor. For example, Product 1 has 5-star rates and Product 2 also 5-star rated. The star rate count in the pro is the GWA or General Weighted Average? See the 1st attached image for example. The Second is the following and the followers the problem is I want to count also how many the following or followers of the Vendor see the 2nd attached image. Thanks a Lot

      Attachments:
      You must be logged in to view attached files.
    • #93870
      Sushobhan
      Keymaster

      Hello, There is no direct hook of filter to achieve this. You need to custom code it.

    • #94579
      karl.deligero
      Participant

      Hi

      I do custom code in my themes I want is the value only of the followers. See the attached image.
      Only the number that I post here.

      Thank You So Much!

      Attachments:
      You must be logged in to view attached files.
    • #95086
      Sushobhan
      Keymaster

      Hi,
      If you want only the followers count of a vendor then you can use the following snippet –

      $followers_arr = get_user_meta( $vendor_id, '_wcfm_followers_list', true ); //fetch followers data from user_meta
      if( $followers_arr && is_array( $followers_arr ) ) {
      	$followers = count( $followers_arr ); //count of the followers
      }

      Thanks!

    • #95960
      karl.deligero
      Participant

      Hi,

      Where can I put this code? and how I integrated it into my Elementor Page?

      Thanks

    • #95993
      Sushobhan
      Keymaster

      Create a shortcode like we did for vendor registration date and use it the same way.

    • #99979
      raul.flores.arenas
      Participant

      hi, i have the same problem, but im want the custom information added in the settings to vendor registration, in my case, university and years of experience, i want show this in the profile, maybe in the filtre too.

      i hope you can help me, i going to attach a few images, we are using the multivendors plugin.

      thanks a lot

      Raul Flores

      Attachments:
      You must be logged in to view attached files.
    • #101354
      Sushobhan
      Keymaster

      Hi,
      Sorry for the delayed response. You can get the custom field values using the following shortcode snippet –

      function vendor_registration_fields_shortcode( $attr ) {
          global $post;
          if ( empty( $attr['field'] ) ) return;
          $field_name = sanitize_title( $attr['field'] );
          $store_id = '';
          if ( isset( $attr['id'] ) && ! empty( $attr['id'] ) ) {
              $store_id = absint( $attr['id'] );
          }
          if ( wcfm_is_store_page() ) {
              $wcfm_store_url = get_option( 'wcfm_store_url', 'store' );
              $store_name = apply_filters( 'wcfmmp_store_query_var', get_query_var( $wcfm_store_url ) );
              $store_id = 0;
              if ( ! empty( $store_name ) ) {
                  $store_user = get_user_by( 'slug', $store_name );
                  $store_id = $store_user->ID;
              }
          }
          if ( is_product() ) {
              $store_id = $post->post_author;
          }
          if ( ! $store_id ) return;
          $custom_fields = get_user_meta( $store_id, 'wcfmvm_custom_infos', true );
          if ( empty( $custom_fields[$field_name] ) ) return;
          return $custom_fields[$field_name];
      }
      
      // register shortcode
      add_shortcode( 'vendor_registration_fields', 'vendor_registration_fields_shortcode' );

      You can use this shortcode like this-
      [vendor_registration_fields id='{vendor id/ store id}’ field=’label name of the field’]

    • #101377
      raul.flores.arenas
      Participant

      thanks a lot for the answer, with this i can filter too?, i mean i can put this in the filter of vendors?

      thank you
      Raul Flores

    • #101455
      Sushobhan
      Keymaster

      Yes, you can. But you have to custom code it. As starting point, refer to ‘wp_ajax_wcfmmp_stores_list_search’ ajax action.

    • #101557
      raul.flores.arenas
      Participant

      thanks for the anwser, i understand where and how i can use tha refer, but if you can help us with the code too will be great, because we are having problems with that.

      thank you
      Raul Flores

    • #101991
      Sushobhan
      Keymaster

      In that case, please contact us here for the purpose – https://wclovers.com/woocommerce-multivendor-customization/

Viewing 20 reply threads
  • The topic ‘SHOW THE CREATE DATE AND YEAR OF THE VENDOR IN VENDOR PROFILE PAGE’ is closed to new replies.