• Im trying to make a simple user listing in a dropdown select box using contact form 7 Anyone see what im doing wrong? Just trying to simply obtain all the users and display them in the selection box. But im running into trouble when trying to work this into my contact form 7 plugin.

    See below from what i have:

    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 as $user );
    	    $output .= "<option value='$user'> $user </option>";
        endforeach;
        $output .= "</select>";
        return $output;
    }
    ? Run code snippetCopy snippet to answer
  • The topic ‘contact form 7 – dropdown userlist’ is closed to new replies.