Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter se.srikanth

    (@sesrikanth)

    I did manage to display new column with data, but no luck with existing columns. my final code looks like below. I am displaying ‘institute’ and ‘phoneno’ meta fields as ‘Contact Details’ column. I wish i could append and display ‘Contact Details’ data to existing column Name data.

    add_filter('manage_users_columns', 'add_user_columns', 15, 1);
    add_action('manage_users_custom_column', 'add_custom_user_columns', 15, 3);
    
    function add_user_columns( $defaults ) {
    	$defaults['details'] = __('Contact Details', 'user-column');
        return $defaults;
    }
    function add_custom_user_columns($value='', $column_name, $id) {
          if( $column_name == 'details' ) {
    		$tmpdata = get_the_author_meta( 'institute', $id );
    		$phoneno = get_the_author_meta( 'phoneno', $id );
    		if ($phoneno)
    			$tmpdata .= ($tmpdata ? '<br/>Ph: ': 'Ph: '). $phoneno;
    		return $tmpdata;
          }
    }
    Thread Starter se.srikanth

    (@sesrikanth)

    Sorry, I was confused and my previous reply was confused.
    a. get_user_meta($user_id,’city’,true) in the new column City gets displayed. But do not affect the existing name column. Name column gets affected to the extent the column heading can be set to whatever you like but not the column data.
    b. get_the_author_meta(‘city’, $user_id) also behaves same way but the exiting Name column data do not get affected.

    c. iam looking at a way to modify/append existing column data in users list.

    d. the modifications are done in a the trhema function file and not in a plugin file. Is that the reason it do not get reflected ?

    I will be grateful for any pointers to a solution. thanks.

    Thread Starter se.srikanth

    (@sesrikanth)

    @dfunkydog,

    I tried with and without the third parameter as true. no improvement. with get_the_author_meta in place of get_user_meta displays content atleast in the city column. but Name column remains unchanged. here is my updated code.

    add_filter('manage_users_columns', 'manage_users_lstcolumns');
    function manage_users_lstcolumns($columns) {
    	$columns['name'] = 'Name';
    	$columns['city'] = 'City';
    	return $columns;
    }
    
    add_action('manage_users_custom_column',  'manage_users_lstdisplay', 10, 3);
    function manage_users_lstdisplay($value, $column_name, $user_id) {
    	if ( 'name' == $column_name )
    		return $value . '<br/>'. get_the_author_meta('city', $user_id);
    	if ( 'city' == $column_name )
    		return get_the_author_meta('city', $user_id, true);
        	return $value;
    }

    @adamtoth you saved my day. PBCI Mailer plugin all of sudden stopped dequeing mails. after adding define('ALTERNATE_WP_CRON', true); to wp-config.php, it started working.

    Thanks a ton.

Viewing 4 replies - 1 through 4 (of 4 total)