NEXT craftinamerica.org. Base setup for headless wordpress https://www.craftinamerica.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. class P2P_Dropdown_User extends P2P_Dropdown_Post {
  3. function __construct( $directed, $title ) {
  4. parent::__construct( $directed, $title );
  5. add_action( 'pre_user_query', array( __CLASS__, 'massage_query' ), 9 );
  6. add_action( 'restrict_manage_users', array( $this, 'show_dropdown' ) );
  7. }
  8. static function massage_query( $query ) {
  9. if ( isset( $query->_p2p_capture ) )
  10. return;
  11. // Don't overwrite existing P2P query
  12. if ( isset( $query->query_vars['connected_type'] ) )
  13. return;
  14. _p2p_append( $query->query_vars, self::get_qv() );
  15. }
  16. protected function render_dropdown() {
  17. return html( 'div', array(
  18. 'style' => 'float: right; margin-left: 16px'
  19. ),
  20. parent::render_dropdown(),
  21. html( 'input', array(
  22. 'type' => 'submit',
  23. 'class' => 'button',
  24. 'value' => __( 'Filter', P2P_TEXTDOMAIN )
  25. ) )
  26. );
  27. }
  28. }