Add Vendor Settings to admin dashboard

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 WCFM Add Vendor Settings to admin dashboard

Viewing 3 reply threads
  • Author
    Posts
    • #61356
      jan
      Participant

      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

    • #61749
      WCFM Forum
      Keymaster

      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

    • #61826
      jan
      Participant

      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 );
    • #61910
      WCFM Forum
      Keymaster

      Hi,

      Just add this line with your code –

      add_action( 'wcfmmp_admin_wcfm_vendor_settings_after', 'custom_store_settings', 20 );

      Thank You

Viewing 3 reply threads
  • The topic ‘Add Vendor Settings to admin dashboard’ is closed to new replies.