php - contact form 7 - wordpress - user listing -


im trying make simple user listing in dropdown select box using contact form 7 see im doing wrong? trying obtain users , display them in selection box. im running trouble when trying work contact form 7 plugin.

wpcf7_add_shortcode('postdropdown', 'createbox', true);    function createbox(){      global = $wpdb;      $blogusers = get_users( array( 'fields' => array( 'display_name' ) ) );      $output = "          <select name='cursus' id='cursus' onchange='document.getelementbyid(\"cursus\").value=this.value;'>              <option></option>";      foreach ( $blogusers $user );  	    $output .= "<option value='$user'> $user </option>";      endforeach;      $output .= "</select>";      return $output;  }

any great! brook

to display name need use $user->display_name show in wordpress codex get_users

also there not need $wpdb , not declared correctly. don't add = sign, check variable scope in php


Comments