Jump to content

Check if data in members custom profile field


IEvo

Recommended Posts

Posted

Hi all, I was hoping someone might be able to help.

I would like to make a check in php if basically the user had put some text in a custom field.

The plan is to make a video section on the profile, add a custom user field for the user to enter the url and then add a check in the theme if member has added something to the field display block else don't. I've been experimenting and can do everything apart from the if statement.

If you have any ideas please let me know!

Posted

Still need help with this! Just need a line of php to get the value of the field or check if there is any data in the field!

Posted

Back in IPS3.x I used to know how to do this. I'm sure it's changed since then, but maybe this can give you a starting point for IPS4.

You can put the custom field into a php variable like:

$varX= substr("{$post['author']['custom_fields']['profile_info']['customField5']}");

or

$varX = {$this->memberData['field_17']}

Than use an if test:
 

<if test="$varX != ''"> //tests is there was any text in the customField5 or field_17

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...