Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
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,

5 years, 5 months ago
Stefan van den Dungen Gronovius
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.
https://www.admincolumns.com/documentation/guides/creating-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.

5 years, 5 months ago

You must be logged in to reply to this topic.