• Themes & Plugins
  • BuddyForms
  • WooCommerce BuddyPress
  • Support
  • Custom Work
  • Blog
  • Get the Bundle
themekraft
  • Themes & Plugins
  • BuddyForms
  • Custom Work
themekraft
  • Themes & Plugins  
    • View All
    • Larry – WordPress Theme
    • WooCommerce BuddyPress Integration
    • TK Google Fonts
    • Starter Theme _tk
  • BuddyForms  
    • Overview
    • Pricing Options
    • Add-ons
    • Demo Site
    • Documentation
  • Support
  • Blog
  • Get the Bundle
  • Client Projects

Integration with a Post’s Metadata

metadata

Introduction 

When we are creating a form in BuddyForms, whose purpose is to create or edit entries of a Post Type, sometimes we run into the situation that the post has one or more metadata. This metadata could be related to some post functionality that we also want to integrate in our form.

In most cases, these functionalities are implemented through themes or plugins, which use metadata as persistent variables to stock information related to the process or processes involved.

It’s important to mention that not all the metadata can be successfully integrated in BuddyForms. Depending on how these are being stocked in the database, we will know whether or not we can integrate them into our form. In general, if a metadata is stored as a serialized text string, it cannot be embedded, since each metadata must be associated with an input in the BuddyForms form.

What is Metadata?

The metadata is information associated to a post, users, comments and terms, which are generally used to constitute core functionalities, themes or plugins related to that type of data. This information can usually be modifiable from the user interface in the WordPress Administrator, for example, when creating or editing the entry of a publication in the Administrator, this information is usually introduced as a set of options, also called meta- box, which can be viewed or changed at any time by the user.

Note: A post Metadata is stored as an entry in the wp_postmeta table in the WordPress database

Use cases

Below we will present a series of use cases, using popular plugins as a reference, where it might be useful to integrate metadata with a BuddyForms form.

Note: The following examples may vary depending on the time and version of the plugin or related theme, they’re also practical examples that may not be applicable in certain contexts. Relevant research and testing is recommended to determine whether a use case is applicable to you or not.

WooCommerce

Let’s suppose we want to create a BuddyForms form as simple as possible, which is able to edit or create functional WooCommerce products from the Front, with a series of predefined configurations in each product, having only the fields: Title, Content, Featured Image and Price (see Image 1).

product builder
Image 1

The solution

It’s important to mention that besides BuddyForms, we need to have the BF WooCommerce Form Elements add-on installed to be able to carry out the example.

The first thing we’ll do is create a BuddyForms form with the required fields (see Image 1), including the WooCommerce fields (special field of BF WooCommerce Form Elements with the product options) and a price type field, which will be used to establish the product price. Finally we should have something similar to this:

woocommerce
Image 2

The second thing we’ll do is to configure the WooCommerce field, so all the available options are hidden, in this way our form will be shown as in Image 1. The advantage of adding a WooCommerce type field with all the hidden options is that it allows us to predefine the setting that each product will have once it has been sent, without the need to “overload” the form with all the WooCommerce options.

As we need users to be able to set each product price created, we must configure the price type field (Regular Price) so when the product is sent, the metadata associated with the Regular Price field of that particular product is overwritten.

Note: WooCommerce uses Product as Post Type, which in conjunction with several metadata and taxonomies, defines the information for each product created.

The way to configure the Regular Price field or any other field that pretends to overwrite a metadata is very simple, we just have to set the field’s slug with a value that matches the metadata keyword (meta_key) that we want to overwrite.

Note: A way to obtain the meta_key of a metadata is by searching in the wp_postmeta table, if we know a post’s ID, we can perform a simple query to filter only the records associated with that Post. Another option is to search the documentation for the theme or plugin associated with the Post Type, generally this information is found in the section for developers. As a last option we could carry out an exhaustive inspection in the code, almost always this turns out to be the infallible option, but also the most laborious one.

Once the appropriate slug has been established for our price type field and our WooCommerce field configured, we can create or edit products from our BuddyForms form, with the price and other options specified in there.

Note: When adding new fields to overwrite a Post metadata, we must choose a field type that is consistent with the original field type used in the metadata displayed on the administrator page destined to create or edit an entry for that Post.

Events Calendar

Let’s suppose we want to create a BuddyForms form that allows us to create and edit events from the Front. Our form must have the fields: Title, Content, Start Date, End Record, Event URL. See Image 3.

form
Image 3

The solution

As in the previous example, the first thing we must do is create a BuddyForms form, which contains the necessary fields shown in Image 3. After this we must identify and set the fields that will be used to be integrated into the metadata, in our case, they will be: Start Date, End Date and Event URL.

To configure these fields we must first identify the metadata that we want to integrate, besides that, we must determine if these are compatible with the integration. Then we must configure the slug of each field according to the meta_key of the corresponding metadata (see Image 4 and 5).

Image 4
Image 5

In the case of the Start Date and End Date fields, besides slug we must also configure the date format, so it matches the format used by the plugin when storing the information. The easiest way to identify the correct format is to inspect the wp_postmeta table for records that match the meta_key _EventEndDate or _EventStartDate. In this case, the date formats must be configured in the next way:

Image 6

Note: As we mentioned above, these results may vary with time and version of the plugin, so they should be taken only as illustrative examples.

Once we have established the appropriate slugs and we have configured the date format for the Start Date and End Date fields, we’ll be ready to start creating or editing entries, if we need to add more fields, just repeat the aforementioned procedure.

Conclusion

As we have already seen, sometimes it’s beneficial to integrate the metadata of a Post Type in our BuddyForms form, we also saw how important it’s to know how the metadata is being stored in the database, to determine whether or not it’s embeddable in a BuddyForms form.

It’s important to note that each integration must be preceded by a corresponding investigation, since not in all cases an integration is applicable, sometimes a custom implementation may be necessary to complement the integration.


ThemeKraft offers the opportunity to create content for us. Guest Post

Jairo
Jairo Niño

Mechatronics Engineering student, self-taught in several areas related to technology, design and development.  Enthusiast of Audiovisual Programming and Design, with great Scientific and Humanistic vocation.

What Do You Think?

Posted in Blog, BuddyForms

  Related Blog Posts

Valuable Formulas To Enhance Your Web Development Process In WordPress

Looking to enhance your web development process in WordPress? Web development can be terrifying. Click to keep reading

  Read More

  How To, Web Design, WordPress

Why WordPress Is Best Solution For Having An Online Platform For Your Business

Most businesses are unaware of how helpful WordPress is. Here you can find why you, as an entrepreneur should use WordPress.

  Read More

  Web Design, WordPress

Guest Post Pay for Submission

It’s an already common practice to have guest posts in your blog or to be a guest author in someone else’s blog or magazine. This can have various goals, like creating a steady stream of content for your page or getting a space for your work for people to read it.

  Read More

  Blog, BuddyForms, Content Marketing, Generate Content, Useful Tools, Woocommerce

WP Fastest Cache Settings: How to Get Green Score on Google in 2021

The most cache optimization plugin I have used in my projects is WP Fastest Cache. The other is Light Speed Catch E, but I only use it on Light Speed Servers, the clients on which I have hosted Futuresol Host. This plugin is designed entirely for these servers, and I think I have no rival. […]

  Read More

  How To, Marketing, Plugins, SEO, WordPress

Related Plugins

BuddyForms BuddyPress Post in Groups

With the BuddyForms BuddyPress Post in Groups extension, we bring all the power of BuddyPress groups and BuddyForms together. Enable your group members to work on new posts together. Define create edit and delete permissions based on group member rights. Manage Post within the Group In the BuddyForms Admin Settings, you enable the post in […]

Starting at: $79.99
Starting at: $79.99

BuddyForms MailPoet

This extension integrates MailPoet and BuddyForms seamlessly and easy to use. Use MailPost lists in any form type and subscribe users during form submissions to newsletter lists. Use the MailPoet Newsletter lists in any BuddyForms Form Type With the newsletter form element, you can select any list created by MailPoet. The lists can be selected […]

Starting at: $79.99
Starting at: $79.99

BuddyForms Pay For Submissions

Enable your customers to pay for the submission of any data to your site with BuddyForms and WooCommerce and the Pay For Submissions Extension. Charge for any kind of data submitted to your site. This can be a guest post or a link. A product like in an auction or any content or file format […]

Starting at: $79.99
Starting at: $79.99

Themekraft Bundle

Get ALL the plugins & themes and save over $3,000 per year.

$239.99
$239.99

Post navigation

  • ← Amazing Ways To Speed Up Your WordPress Website
  • 5 Tips to generate content on your website →

Blog Categories

  • » All News
  • » Create content
  • » BuddyForms
  • » WooCommerce BuddyPress
  • » Useful Tools
  • » How To
  • » Extensions

WordPress Tools

BuddyForms BuddyPress Post in Groups

With the BuddyForms BuddyPress Post in Groups extension, we bring all the power of BuddyPress groups and BuddyForms together. Enable your group members to work on new posts together. Define create edit and delete permissions based on group member rights. Manage Post within the Group In the BuddyForms Admin Settings, you enable the post in […]

Annual Single Site License: $79.99
Annual Single Site License: $79.99

BuddyForms MailPoet

This extension integrates MailPoet and BuddyForms seamlessly and easy to use. Use MailPost lists in any form type and subscribe users during form submissions to newsletter lists. Use the MailPoet Newsletter lists in any BuddyForms Form Type With the newsletter form element, you can select any list created by MailPoet. The lists can be selected […]

Annual Single Site License: $79.99
Annual Single Site License: $79.99

BuddyForms Pay For Submissions

Enable your customers to pay for the submission of any data to your site with BuddyForms and WooCommerce and the Pay For Submissions Extension. Charge for any kind of data submitted to your site. This can be a guest post or a link. A product like in an auction or any content or file format […]

Annual Single Site License: $79.99
Annual Single Site License: $79.99

Themekraft Bundle

Get ALL the plugins & themes and save over $3,000 per year.

Annual Unlimited License: $239.99
Annual Unlimited License: $239.99
View All Themes & Plugins
  • Blog
  • About
  • Contact
  • Support
  • My Account
  • Recommendations
themekraft
  • Terms
  • Privacy
  • Imprint
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.Accept Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled

Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.

Non-necessary

Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.

SAVE & ACCEPT