How to add a new Column Header inside WPUF Dashboard Table

In this post, I’m going to serve how to add a new Column Header on your WP User Front-end Dashboard Table.

Before stepping tell me why/when do you need this?

Okay, imagine you are working on a site where you will get information alongside any File/Media info. So by default, in WPUF dashboard it won’t let you add all of your custom fields meta.

In this case, you will need to customize the table dashboard to place any custom fields meta info. In most cases, showing custom fields with WordPress get_post_meta() is easy to manipulate but it’s getting a bit complicated once you are going to show the File/Media direct URL/Link.

So I will show you how you can get and show the File/Media link on your dashboard table.

Process

This is a default view of the WPUF Dashboard Table.

As you can see, the Dashboard is consist with 04 Heading Element- Title, Status, Payment, Options

image

And after the final touch of our work-around, it will be looks like this.

image

Things to do

Don’t forget that the associated Download File Link is coming from the post meta so first you need to assure that the File Upload field is predefined on the Post/Form.

So to make this whole process well decorated, let’s say I don’t have any WPUF Post Form or associated Field so first I’m creating a post form with File Upload field and creating a post so that it populated the associated File Upload field’s link on the Dashboard Table.

Code-base

This below code snippet will add a column header on the Dashboard Table.

/**
* @Add a new column header in dashboard table
* @param array $args dashboard query arguments
* @return void
*/
function wpufe_dashboard_change_head( $args ) {
printf( '<th>%s</th>', __( 'Download File', 'wpuf' ) );
}
add_action( 'wpuf_dashboard_head_col', 'wpufe_dashboard_change_head', 10, 2 );

This below code snippet will add a column header on the Dashboard Table.

image

Now, we need to call & retrieve the Download File to make it appear on the Frontend DashboardNow, the above code will make the Downloadable file appear on the front-end dashboard

image

Side Note

  1. Make sure the custom field meta_key name is according to your custom field’s meta name (like this).
  2. And you call the file attachment link of the file with wp_get_attachment_link otherwise it will let the user download the file throughout the link.

Wrapping-up

So this is fair enough to push the brain harder for today! 

I hope this will help you to make the file download link appear on the front-end dashboard.

Default image
MM Aurangajeb
Support Engineer, Blogger. Learning Web Design & Developing, Tech & WordPress Enthusiast, WordPress Lover. Always try to learn new things, new hacks, new techs.
Articles: 13

Newsletter Updates

Enter your email address below to subscribe to our newsletter

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Start building your dream

Are you still strugling wiht the setup and configuration? For any consultation or micro-task feel free to PING ME


↡↡↡

Get maximum result with less work