Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the community forum?
All Topics
sitexpertid

Use an SQL query in a custom field

Hello,

I use your plugin (Admin Columns) on my website and it functions well.

Today, I would like to gather information from another plugin : PaidMembershipPro.
This information is stored in the database “pmpro_memberships_users” and is called “endate”.

I can view this one in the database, like in this picture below.
https://monimmeuble.com/wp-content/uploads/2019/05/database-endfield.png

How can I create a custom field with an SQL query to access to this information?

This field is not suggested in the drop-down “champ” when I add a Custom Field, like in this picture below:
https://monimmeuble.com/wp-content/uploads/2019/05/CustomField.png

Thank you for your attention.

Sincerely,

4 months, 3 weeks ago
Stefan
Developer

Hello,

In your case, I advise writing your own column instead if trying to manipulate the custom field column. Because technically, you’re not working with a ‘custom field’ if it is not stored in the post_meta table.

We do have some documentation and even a toolkit to get you started writing your own column.

Creating a new column type


This way, you have full control of how your new column behaves and even write your own logic for sorting/filtering and editing support.

You could write a column for each field you like to display, or if you want to dive into our code, you could create a setting as we did in our custom field column to select which field you want to display. Of course, this approach would require some better understanding of both our API and the API of PaidMembershipPro. So starting with a column for each field would probably the fastest way for you to start.

4 months, 2 weeks ago

You must be logged in to reply to this topic.