Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter cerebcortex

    (@cerebcortex)

    SOLVED:

    <?php
    
    function new_modify_user_table_send_inv( $column ) {
        $column['send_inventory'] = 'Email Inventory';
        return $column;
    }
    add_filter( 'manage_users_columns', 'new_modify_user_table_send_inv' );
    
    function new_modify_user_table_row_send_inv($value='', $column_name, $user_id ) {
        if ($column_name =='send_inventory') {
    			$posts = get_posts(array('author' => $user_id));
    			$tmpdata = array();
    			if(isset($posts) && !empty($posts))
    				foreach($posts as $post){
    					$tmpdata[] = "<li>".$post->post_title."</li>";
    			}
    						$varnew = implode("\n",$tmpdata);
            				return $varnew;
    	}
    }
    add_filter( 'manage_users_custom_column', 'new_modify_user_table_row_send_inv', 9999, 3 );
    Thread Starter cerebcortex

    (@cerebcortex)

    Okay I’ve gotten it to show the first post a specific user has for all user rows since I set it to ‘author’ => 2… but it only shows the first post and not the subsequent…

    <?php
    function new_modify_user_table_send_inv( $column ) {
        $column['send_inventory'] = 'Email Inventory';
        return $column;
    }
    add_filter( 'manage_users_columns', 'new_modify_user_table_send_inv' );
    
    function new_modify_user_table_row_send_inv($value='', $column_name, $user_id ) {
        if ($column_name =='send_inventory') {
    			$posts = get_posts(array('author' => 2));
    			$tmpdata = array();
    			if(isset($posts) && !empty($posts))
    				foreach($posts as $post){
    					$tmpdata = "<li>".$post->post_title."</li>";
                        return $tmpdata;
    			}
            			//return $print_array;
    		//$tmpdata = implode("\n",$tmpdata);
    
            //$custom_column = implode("\n",$custom_column);
            	//echo $custom_column;
    	}
    }
    add_filter( 'manage_users_custom_column', 'new_modify_user_table_row_send_inv', 9999, 3 );
    Thread Starter cerebcortex

    (@cerebcortex)

    **No row data for column is showing**

    new code:

    <?php
    function new_modify_user_table_send_inv( $column ) {
        $column['send_inventory'] = 'Email Inventory';
        return $column;
    }
    add_filter( 'manage_users_columns', 'new_modify_user_table_send_inv' );
    
    function new_modify_user_table_row_send_inv($custom_column, $column_name, $user_id ) {
    	if ($column_name=='send_inventory') {
    			$posts = get_posts(array('author' => 2));
    			$custom_column = array();
    			if(isset($posts) && !empty($posts))
    				foreach($posts as $post){
    					$custom_column[] = "<li>".$post->post_title."</li>";
    				}
    			$custom_column = implode("\n",$custom_column);
    	}
    	echo $custom_column;
    }
    add_filter( 'manage_users_custom_column', 'new_modify_user_table_row_send_inv', 10, 3 );
    Thread Starter cerebcortex

    (@cerebcortex)

    changed return $custom_column; to echo $custom_column but nothing shows for each row… I am just adding this to my custom functions.. the column head populates but now data is showing.

    I was just trying to display each posts as URLs in each user row 1st..

    The end goal is clicking a button on a specific user row in the column which would send an email to the user with their specific posts in the body…

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