Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
rhondaramadge

acp/editing/view_settings

I have a custom field radio button in edit user and would like this to be editable on the user list as a dropdown. I have used the following code.

/**
 * Change inline eit for a specific custom field to a prefilled drop down
 *
 * @param $data   array
 * @param $column AC_Column
 *
 * @return mixed
 */
function my_acp_custom_field_editing_selectbox( $data, $column ) {

	if ( $column instanceof ACP_Column_CustomField ) {

		if ( 'fees-paid' === $column->get_meta_key() ) {
			$data['type'] = 'select';
			$data['options'] = array(
				'yes'  => 'Yes',
				'no' => 'No',
				
			);
		}

	}

	return $data;
}

add_filter( 'acp/editing/view_settings', 'my_acp_custom_field_editing_selectbox', 10, 2 );

This is working fine on my test site but on the live site which has the latest version of your plugin it’s not working.
In the edit columns settings I have chosen the field as excerpt and inline editing as text.

4 years, 11 months ago
Stefan
Developer

In our latest version, we introduced namespaces in our code, which need some changes in your hook.
You can use the following code in your theme/plugin to make it work with the latest version of Admin Columns.

/**
 * Change inline eit for a specific custom field to a prefilled drop down
 *
 * @param $data array
 * @param $column AC\Column
 *
 * @return mixed
 */
function my_acp_custom_field_editing_selectbox( $data, $column ) {

	if ( $column instanceof ACP\Column\CustomField ) {

		if ( 'fees-paid' === $column->get_meta_key() ) {
			$data['type'] = 'select';
			$data['options'] = array(
				'yes' => 'Yes',
				'no' => 'No',

			);
		}

	}

	return $data;
}
4 years, 11 months ago
rhondaramadge

Thank you. Working fine.

4 years, 11 months ago

You must be logged in to reply to this topic.