Display a notice to members without custom profile field September 02, 2016, 03:14:07 am Hi all, I recently changed some custom profile fields and I added 2 new dropdown fields. Is there a way to show a notice only to registered members which didn't fill those 2 custom fields? something like: "It looks that your profile is not fully completed, click here to edit your profile. Once completed you won't see this notice anymore"I could use simple portal for this without editing the core filesThank you in advance
Re: Display a notice to members without custom profile field Reply #1 – September 02, 2016, 07:36:11 am There is no very easy way, it requires some code, mainly because custom fields are not loaded unless there is a reason to (e.g. show them in the topic/profile/registration), so there is to query the database to find out if the user has a value or not.In general the code should look like:Code: [Select] global $user_info; $db = database(); $req = $db->query('', ' SELECT value FROM {db_prefix}custom_fields_data WHERE id_member = {int:member} AND variable = {string:field_name} LIMIT 1', array( 'member' => $user_info['id'], 'field_name' => 'cust_abcdef' ) ); if ($db->num_rows($req) == 0) { // show message }The only thing you have to change is the name of the field:Code: [Select]'field_name' => 'cust_abcdef'the "abcdef" part.Currently you have two ways to discover it:1) guess it, it is usually built picking the first 6 letters (from a to z including specials), numbers, underscores (_) or minus signs (-) of the name of the field,2) open phpmyadmin and find the field in elkarte_custom_fields table and picking the value of col_name column.
Re: Display a notice to members without custom profile field Reply #2 – September 02, 2016, 08:55:38 am Thanks for the input Emanuele, I'll try it