Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter derlockecom

    (@derlockecom)

    Hello again,

    Thank you, for your great answer. It helped a lot and I ended up with this code:

    
    <?php
     function extractEmails($tabledata) {
        $emails = [];
    	$tabledata = array_slice($tabledata, 1);
        foreach ($tabledata as &$entry){
            $emails[] = $entry[2];  # check id in table
        }
        return implode(", ", array_unique($emails));
     }
    
     function extractData($table_id) {
        $table = TablePress::$model_table->load( $table_id, true, false );
        return extractEmails($table['data']);
     }
    
      function grab_mails_user(){
     	return extractData('1');
     }
     add_shortcode("grabbed_mails_user", "grab_mails_user");
    
     function grab_mails_intern(){
        return extractData('2');
     }
     add_shortcode("grabbed_mails_intern", "grab_mails_intern");
    
     ?>

    I hope someone else can use it, too.

    Kind regards,
    derlocke

    • This reply was modified 3 years, 11 months ago by derlockecom.
Viewing 1 replies (of 1 total)