Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM › Add Vendor Settings to admin dashboard
- This topic has 3 replies, 2 voices, and was last updated 5 years, 7 months ago by WCFM Forum.
- AuthorPosts
- May 9, 2019 at 12:37 pm #61356janParticipant
Hey,
just a quick one today:
I’ve added quite a few settings to the Vendor Store Setup with
add_action( ‘end_wcfm_vendor_settings’, ‘…..’, 20 );
add_action( ‘wcfm_vendor_settings_update’, ‘…..’, 20, 2 );
functions.How can I add those to the admin dashboard as well? I can’t log in as every user every time when I add a new setting to add a default value for them.
Thanks!
Jan - May 10, 2019 at 6:51 pm #61749WCFM ForumMember
HI,
Use this hook to add those fields at Vendor Manager -> Store Setting –
do_action( 'wcfmmp_admin_wcfm_vendor_settings_after', $vendor_id );
NO extra code require for save.
Thank You
- May 11, 2019 at 1:44 pm #61826janParticipant
Thanks, but I’m not sure where / how to add that line in my custom plugin.
If I add it into the actual function being called, it doesn’t seem to do anything, if I add it outside, $vendor_id is not defined. This is what I have now:function custom_store_settings( $vendor_id ) { global $WCFM, $WCFMu; $wcfm_vendor_custom_options = (array) get_user_meta( $vendor_id, 'wcfm_vendor_custom_options', true ); $wcfm_vendor_desc_website = isset( $wcfm_vendor_custom_options['website'] ) ? $wcfm_vendor_custom_options['website'] : ''; // some more fields here ?> <!-- collapsible --> <div class="page_collapsible" id="wcfm_settings_form_vendor_custom_head"> <label class="fa fa-file-image-o"></label> <?php _e('Winery Images', 'wc-frontend-manager-ultimate'); ?><span></span> </div> <div class="wcfm-container"> <div id="wcfm_settings_form_vendor_desc_expander" class="wcfm-content"> <?php $WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( 'wcfmu_settings_fields_vendor_store_invoice', array( "wcfm_vendor_descr_website" => array('label' => __('Website', 'wc-frontend-manager-ultimate'), 'type' => 'text', 'name' => 'wcfm_vendor_custom_options[website]', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $wcfm_vendor_desc_website, 'hints' => __( 'Your website URL', 'wc-frontend-manager-ultimate' ) ), // more fields here ) ) ); ?> </div> </div> <div class="wcfm_clearfix"></div> // More containers and fields here <!-- end collapsible --> <?php } add_action( 'end_wcfm_vendor_settings', 'custom_store_settings', 20 ); function custom_store_settings_update( $user_id, $wcfm_settings_form ) { global $WCFM, $WCFMu, $_POST; if( isset( $wcfm_settings_form['wcfm_vendor_custom_options'] ) ) { $wcfm_vendor_custom_options = $wcfm_settings_form['wcfm_vendor_custom_options']; update_user_meta( $user_id, 'wcfm_vendor_custom_options', $wcfm_vendor_custom_options ); } } add_action( 'wcfm_vendor_settings_update', 'custom_store_settings_update', 20, 2 );
- May 12, 2019 at 10:19 am #61910WCFM ForumMember
Hi,
Just add this line with your code –
add_action( 'wcfmmp_admin_wcfm_vendor_settings_after', 'custom_store_settings', 20 );
Thank You
- AuthorPosts
- The topic ‘Add Vendor Settings to admin dashboard’ is closed to new replies.