• Resolved David

    (@dvdmrnjcbssn)


    Hi, I have a registration form created with the Forminator plugin. This form has to upload a pdf file.
    Is it possible that the pdf can be seen in the users page of the WordPress backfoffice in a column next to each registered user?

    If not, what other options do I have to view the pdf?

    Thanks

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @dvdmrnjcbssn

    I hope you’re well today!

    This is currently not possible out of the box.

    There is a chance that it may be possible with a bit of additional custom code but I need to consult that with our Formiantor developers first. I’ve already asked them and I (or one of my colleagues) will update you here soon with more information.

    Though I appreciate some patience as our developers are dealing with a lot of complex tasks on daily basis and it may take them a while to respond.

    We’ll update you here once we got feedback on this.

    Best regards,
    Adam

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @dvdmrnjcbssn

    I hope you are doing well.

    Could you please try the following code?

    <?php
    
    function wpmudev_add_pdf_column( $column ) {
        $column['pdf'] = 'PDF Download';
        return $column;
    }
    add_filter( 'manage_users_columns', 'wpmudev_add_pdf_column' );
    
    function wpmudev_add_pdf_column_row( $val, $column_name, $user_id ) {
        switch ($column_name) {
            case 'pdf' :
                if ( get_the_author_meta( 'pdf', $user_id ) ) {
                    return '<a target="_blank" href='.wp_get_attachment_url( get_the_author_meta( 'pdf', $user_id ) ).'>Download PDF</a>';
                } else {
                    return '';
                }
            default:
        }
        return $val;
    }
    add_filter( 'manage_users_custom_column', 'wpmudev_add_pdf_column_row', 10, 3 );

    Add it as a mu-plugin https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    In the code get_the_author_meta( ‘pdf’, $user_id ) meta key should be replaced and on upload field show files in media library should be enabled.

    https://monosnap.com/file/nM7KUWt6KTmVv85ShuLpUxBIIl0WTN

    Let us know the result you got.
    Best Regards
    Patrick Freitas

    Thread Starter David

    (@dvdmrnjcbssn)

    Hi @wpmudevsupport12 , thanks for your quick response.

    I just tried what you have indicated, and I see the column ‘PDF Download’ on the user page, but when I upload a pdf when I register as a new user, I do not see it in that column. The column is still empty.

    Previously you commented that in the code get_the_author_meta( ‘pdf’, $user_id ) I have to replace something? maybe that’s why it doesn’t work. What do I have to replace?

    Thanks

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @dvdmrnjcbssn

    The the get_the_author_meta( ‘pdf’, $user_id ) needs to be replaced with the key you configured in the user meta mapping.

    https://monosnap.com/file/LLEfSQhZLITgaSb2sL5EqZzk6LpBbs

    In case you hadn’t defined the mapping then only new registration would output the link.

    Best Regards
    Patrick Freitas

    Thread Starter David

    (@dvdmrnjcbssn)

    Works perfectly!

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Register pdf upload’ is closed to new replies.