Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WC Vendors › SHOW THE CREATE DATE AND YEAR OF THE VENDOR IN VENDOR PROFILE PAGE
- This topic has 20 replies, 4 voices, and was last updated 4 years, 11 months ago by Sushobhan.
- AuthorPosts
- November 14, 2019 at 1:57 pm #92254karl.deligeroParticipant
Hi,
It is possible to show the Create Date and Year of the vendor on their profile page?
Thank You
- November 16, 2019 at 5:58 pm #92561SushobhanKeymaster
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? - November 19, 2019 at 9:10 am #92895kpetty.iccsParticipant
where can these two lines be added
- November 19, 2019 at 1:15 pm #92920SushobhanKeymaster
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.
- November 19, 2019 at 2:54 pm #92937karl.deligeroParticipant
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
- November 19, 2019 at 5:16 pm #92963SushobhanKeymaster
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']
- November 20, 2019 at 8:13 am #93041karl.deligeroParticipant
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. - November 20, 2019 at 12:43 pm #93083SushobhanKeymaster
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=”] - November 22, 2019 at 2:07 pm #93425karl.deligeroParticipant
AWESOME IT’S WORK. THANKS A LOT 🙂
- November 22, 2019 at 2:21 pm #93429karl.deligeroParticipant
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. - November 25, 2019 at 5:35 pm #93870SushobhanKeymaster
Hello, There is no direct hook of filter to achieve this. You need to custom code it.
- November 29, 2019 at 8:15 am #94579karl.deligeroParticipant
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. - November 30, 2019 at 10:11 pm #95086SushobhanKeymaster
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!
- December 4, 2019 at 7:27 am #95960karl.deligeroParticipant
Hi,
Where can I put this code? and how I integrated it into my Elementor Page?
Thanks
- December 4, 2019 at 1:47 pm #95993SushobhanKeymaster
Create a shortcode like we did for vendor registration date and use it the same way.
- December 30, 2019 at 8:28 am #99979raul.flores.arenasParticipant
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. - January 8, 2020 at 3:59 pm #101354SushobhanKeymaster
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’] - January 8, 2020 at 6:42 pm #101377raul.flores.arenasParticipant
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 - January 9, 2020 at 12:56 pm #101455SushobhanKeymaster
Yes, you can. But you have to custom code it. As starting point, refer to ‘wp_ajax_wcfmmp_stores_list_search’ ajax action.
- January 10, 2020 at 8:54 am #101557raul.flores.arenasParticipant
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 - January 14, 2020 at 12:38 pm #101991SushobhanKeymaster
In that case, please contact us here for the purpose – https://wclovers.com/woocommerce-multivendor-customization/
- AuthorPosts
- The topic ‘SHOW THE CREATE DATE AND YEAR OF THE VENDOR IN VENDOR PROFILE PAGE’ is closed to new replies.