Community Support Forums — WordPress® ( Users Helping Users ) — 2011-09-22T19:23:37-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=14863 2011-09-22T19:23:37-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14863&p=38947#p38947 <![CDATA[Re: Add EOT to all users view]]>
One thing I noticed was that:

Code:
'view_eot' == $vars['orderby']


should probably be

Code:
'EOT' == $vars['orderby']


to reflect the correct value in the URL-encoded query string param. Fixing that still resulted in the rows sorting by Username instead of EOT.

Statistics: Posted by pcscweb — September 22nd, 2011, 7:23 pm


]]>
2011-09-21T12:36:44-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14863&p=38883#p38883 <![CDATA[Re: Add EOT to all users view]]>

Statistics: Posted by bitofgrace — September 21st, 2011, 12:36 pm


]]>
2011-09-21T11:19:58-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14863&p=38877#p38877 <![CDATA[Re: Add EOT to all users view]]> Statistics: Posted by Bruce C — September 21st, 2011, 11:19 am


]]>
2011-09-21T11:18:20-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14863&p=38876#p38876 <![CDATA[Re: Add EOT to all users view]]> Thanks pcsweb for posting that.

I took a look at the filters that were used the the plugin from that post, and managed to get the column sortable. Here's the code:

Code:
add_filter ('manage_users_columns', 'add_eot_column');
add_filter ('manage_users_custom_column', 'view_eot_column', 11, 3);
function add_eot_column ($eot_column)
   {
      $eot_column['view_eot'] = 'EOT';
      return $eot_column;
   }
function view_eot_column ($eot_column, $column_name, $id)
   {
      if ($column_name == 'view_eot')
         {
            if (!get_user_field ('s2member_auto_eot_time', $id) == 0)
               {
                  $eot_column = date ("M/d/Y", get_user_field ('s2member_auto_eot_time', $id));
               }
         }
      return $eot_column;
   }
function eot_sortable_columns ($columns)
   {
      $columns['view_eot'] = 'EOT';
      return $columns;
   }
add_filter ('manage_users_sortable_columns', 'eot_sortable_columns');
function eot_column_orderby ($vars)
   {
      if (isset ($vars['orderby']) && 'view_eot' == $vars['orderby'])
         {
            $vars = array_merge ($vars, array ('meta_key' => 'view_eot', 'orderby' => 'meta_value', 'order' => 'asc'));
         }
      return $vars;
   }
add_filter ('request', 'eot_column_orderby');


I'm happy we figured this out!

Statistics: Posted by Bruce C — September 21st, 2011, 11:18 am


]]>
2011-09-19T20:00:48-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14863&p=38683#p38683 <![CDATA[Re: Add EOT to all users view]]>
redliontrader wrote:
Would be even better if it were a sortable column.


From what I've read, sorting by the EOT column may not be possible because the values are stored in the wp_usermeta table: http://tech.ipstenu.org/2011/limitations-on-sortable-columns/.

Statistics: Posted by pcscweb — September 19th, 2011, 8:00 pm


]]>
2011-09-14T02:39:39-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14863&p=37172#p37172 <![CDATA[Re: Add EOT to all users view]]> s2hacks.php file would go in the /wp-content/mu-plugins/ directory. I.e.: /wp-content/mu-plugins/s2hacks.php :)

Just create the dir and file if you don't have them.

Statistics: Posted by Cristián Lávaque — September 14th, 2011, 2:39 am


]]>
2011-09-10T20:10:08-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14863&p=34533#p34533 <![CDATA[Re: Add EOT to all users view]]>
Here's the correct code

Code:
add_filter ('manage_users_columns', 'add_eot_column');
add_filter ('manage_users_custom_column', 'view_eot_column', 11, 3);
function add_eot_column ($eot_column)
   {
      $eot_column['view_eot'] = 'EOT';
      return $eot_column;
   }
function view_eot_column ($eot_column, $column_name, $id)
   {
      if ($column_name == 'view_eot')
         {
            if (!get_user_field ('s2member_auto_eot_time', $id) == 0)
               {
                  $eot_column = date ("M/d/Y", get_user_field ('s2member_auto_eot_time', $id));
               }
         }
      return $eot_column;
   }

Statistics: Posted by Bruce C — September 10th, 2011, 8:10 pm


]]>
2011-09-10T19:44:03-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14863&p=34529#p34529 <![CDATA[Re: Add EOT to all users view]]> Statistics: Posted by Bruce C — September 10th, 2011, 7:44 pm


]]>
2011-09-10T08:39:51-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14863&p=34488#p34488 <![CDATA[Re: Add EOT to all users view]]>
If I add it to functions.php it breaks the other columns (num of logins for example don't appear).

Where does s2hacks.php go? In my theme folder? I was going to try it there

Statistics: Posted by redliontrader — September 10th, 2011, 8:39 am


]]>
2011-09-04T16:45:11-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14863&p=33993#p33993 <![CDATA[Re: Add EOT to all users view]]>
Code:
<?php
add_filter ('manage_users_columns', 'add_eot_column');
add_filter ('manage_users_custom_column', 'view_eot_column', 10, 3);
function add_eot_column ($columns)
   {
      $columns['view_eot'] = 'EOT';
      return $columns;
   }
function view_eot_column ($empty = '', $column_name, $id)
   {
      if ($column_name == 'view_eot')
         {
            if (!get_user_field ('s2member_auto_eot_time', $id) == 0)
               {
                  return date ("M/d/Y", get_user_field ('s2member_auto_eot_time', $id));
               }
            else
               {
                  return "No EOT Set";
               }
         }
   }
?>


This should go either in your theme's functions.php file, the s2hacks.php file, OR a plugin file you create yourself.

Cheers!

Statistics: Posted by Bruce C — September 4th, 2011, 4:45 pm


]]>
2011-09-04T15:55:13-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14863&p=33990#p33990 <![CDATA[Re: Add EOT to all users view]]>
Code:
<?php
//Two main filters,
add_filter('manage_users_columns', 'add_eot_column');
add_filter('manage_users_custom_column', 'view_eot_column', 10, 3);

function add_eot_column($columns) {
          $columns['current_eot'] = 'EOT';
   return $columns;

}

function view_eot_column($empty='', $column_name, $id) {
   if( $column_name == 'current_eot' ) {
                //The return below is what is shown.
      return  ;

       }
}
?>


This, as it is, only creates the column with the name of EOT.

I'll look at it a bit more.


BTW, found the original code here:
http://wordpress.org/support/topic/mana ... ?replies=6

Statistics: Posted by Bruce C — September 4th, 2011, 3:55 pm


]]>
2011-09-04T12:45:41-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14863&p=33984#p33984 <![CDATA[Add EOT to all users view]]>
Thanks

Statistics: Posted by redliontrader — September 4th, 2011, 12:45 pm


]]>