Created
June 12, 2012 06:55
-
-
Save BronsonQuick/2915722 to your computer and use it in GitHub Desktop.
Display data from a Gravity Forms form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Brisbane Respsonsive Lab Credits | |
Plugin URI: http://www.sennza.com.au | |
Description: A plugin to display the gravatars, names and devices of the people who have donated devices to the project | |
Version: 1.0 | |
Author: Bronson Quick | |
Author URI: http://www.sennza.com.au | |
License: GPL2 | |
*/ | |
class Sennza_Responsive_Lab_Credits { | |
function &credits($content){ | |
global $credits; | |
$form_id = 4; | |
$entries = RGFormsModel::get_leads($form_id); | |
if ($entries): | |
$credits = "<ul class='responsive-donors'>"; | |
foreach ($entries as $entry): | |
$credits .= "<li>"; | |
$name = $entry['1.3'] . " " . $entry['1.6']; | |
$credits .= get_avatar( $entry['2'], 300, '', $name ); | |
$credits .= "<p><strong>". $name ."</strong></p>"; | |
$credits .= '<p><a href="'. $entry['3'] . '" title="'. $entry['3'] .'" class="donated-link">'. $entry['3'] .'</a></p>'; | |
$device_details = unserialize($entry['4']); | |
if ($device_details): | |
$credits .= "<p>Kindly Donated:</p>"; | |
$credits .= "<ul class='responsive-designers'>"; | |
foreach( $device_details as $device): | |
$credits .= "<li>" .$device . "</li>"; | |
endforeach; | |
$credits .= "</ul>"; | |
endif; | |
$credits .= "</li>"; | |
endforeach; | |
$credits .= "</ul>"; | |
else: | |
$credits = "There are no entries"; | |
endif; | |
return $content . $credits; | |
} | |
function &css(){ | |
wp_register_style( 'responsive-lab-style', plugins_url('/css/responsive-lab-credits.css', __FILE__) ); | |
wp_enqueue_style( 'responsive-lab-style' ); | |
} | |
} | |
add_shortcode('responsivelab-credits', array('Sennza_Responsive_Lab_Credits', 'credits')); | |
add_action( 'wp_enqueue_scripts', array('Sennza_Responsive_Lab_Credits', 'css') ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment