Support » Plugin: Admin Columns » [Plugin: Codepress Admin Columns] Request: add format filter to CPAC_Values::get_column_value_custom

  • Resolved lukewarmmizer

    (@lukewarmmizer)


    Hi,

    I noticed that you have included a filter in Codepress_Admin_Columns->get_box_options_customfields()

    $fieldtypes = apply_filters('cpac-field-types', $fieldtypes );

    However there isn’t a way that I can see to add a new format to this new field type. In CPAC_Values::get_column_value_custom_field() I added the following code on line 299

    $meta = apply_filters('get_column_value_custom_field', $meta, $fieldtype );

    In my case it lets me show a username when a user id is being save, like so:

    function admin_column_user_filter($fieldtypes){
    	$fieldtypes['user_by_id'] = 'User (by UserId)';
    	return $fieldtypes;
    }
    add_filter('cpac-field-types', 'admin_column_user_filter');
    function get_column_value_custom_field($meta, $type) {
    	if ($type=="user_by_id"){
    		$userdata= get_userdata($meta);
    		if ( $userdata )
    			$meta = $userdata->user_login;
    	}
    	return $meta;
    }
    add_filter( 'get_column_value_custom_field','get_column_value_custom_field', 10, 2 );

    It would be great to have this filter added if possible so that it isn’t just a hack on my side, thanks!

    http://wordpress.org/extend/plugins/codepress-admin-columns/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Any word on implementing filter per field type?

    Plugin Author Codepress

    (@codepress)

    Hi,

    Nice to see you are making use of the added filters 🙂

    You example is very clear and it makes a good point. I will be adding your suggested filter (with a prefix) to the next release (1.4.5 and up).

    Cheers,

    Tobias

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Codepress Admin Columns] Request: add format filter to CPAC_Values::get_column_value_custom’ is closed to new replies.