Home Forums Plugin Support WP User Frontend Pro Hide meta fields that are not filled

This topic is: not resolved

This topic contains 8 replies, has 3 voices, and was last updated by  David 5 years, 4 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #10231

    Ingrid
    Member
    Post count: 14

    Hi,

    Is there any way to hide meta fields that are not filled in when a user submits a form?
    I have checked the “Show custom fields on post content area” checkbox in the settings menu, so I have not added any code to template files.

    Thanks
    Ingrid

    #10261

    Ingrid
    Member
    Post count: 14

    Hi,

    did you get a chance to look at this?

    #10262

    Tareq Hasan
    Keymaster
    Post count: 2831

    Sorry for the delay.

    There is no way you can do this without changing a line in the plugin. For this, open wpuf-functions.php and in line 660, you'll see something like this: [php]$html .= sprintf( ‘<li><label>%s</label>: %s</li>', $attr[‘label'], make_clickable( implode( ‘, ‘, $value ) ) );[/php]

    Replace this with this:
    [php]
    if ( $value[0] ) {
    $html .= sprintf( ‘<li><label>%s</label>: %s</li>', $attr[‘label'], make_clickable( implode( ‘, ‘, $value ) ) );
    }
    [/php]

    It should work.

    #10265

    Ingrid
    Member
    Post count: 14

    Hi Tareq,

    Thanks for your answer.
    I applied the suggested change, but it doesn't work.
    Do you have another suggestion?

    #10273

    Tareq Hasan
    Keymaster
    Post count: 2831

    I am not sure how did you added or modified that code. If it was right, that should work.

    #10285

    Ingrid
    Member
    Post count: 14

    I added the code just like you said. In wpuf-functions.php
    Is it possible i give you acces to my site so you can see for yourself?

    #12729

    Tareq Hasan
    Keymaster
    Post count: 2831

    Hi, sorry for the delay. Feel free to give your site details in a private reply.

    #12999

    Ingrid
    Member
    Post count: 14

    Hi, I already fixed it.
    Thanks for your help!

    #15049

    David
    Member
    Post count: 12

    Hi Ingrid, how did you hide the fields if no value if inserted I tried to do what Tareq with wpuf-functions.php but is still not hiding the field if no value is inserted.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Hide meta fields that are not filled’ is closed to new replies.