This repository has been archived by the owner on Jul 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #135 from JMAConsulting/5.0
Merge 5.0 changes to master
- Loading branch information
Showing
3 changed files
with
45 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,11 @@ | |
<author>JMA Consulting</author> | ||
<email>[email protected]</email> | ||
</maintainer> | ||
<releaseDate>2016-03-30</releaseDate> | ||
<version>1.5</version> | ||
<releaseDate>2018-04-25</releaseDate> | ||
<version>1.6</version> | ||
<develStage>stable</develStage> | ||
<compatibility> | ||
<ver>4.7</ver> | ||
<ver>5.0</ver> | ||
</compatibility> | ||
<comments/> | ||
<civix> | ||
|
42 changes: 42 additions & 0 deletions
42
plugins/grant_application_shortcode/grant_application_shortcode.php
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/* | ||
Plugin Name: Grant Application Shortcode | ||
Plugin URI: https://github.com/JMAConsulting/biz.jmaconsulting.grantapplications | ||
Description: Allow grant application profiles to be used as shortcodes in Wordpress pages and posts | ||
Version: 1.0 | ||
Author: JMA Consulting | ||
Author URI: http://jmaconsulting.biz | ||
License: AGPL3 | ||
*/ | ||
add_filter('civicrm_shortcode_preprocess_atts', array('CiviCRM_For_WordPress_Shortcodes_Grant', 'civicrm_shortcode_preprocess_atts'), 10, 2); | ||
|
||
// FIXME: Uncomment to allow support for multiple shortcodes on pages. | ||
//add_filter('civicrm_shortcode_get_data', array('CiviCRM_For_WordPress_Shortcodes_Grant', 'civicrm_shortcode_get_data'), 10, 3); | ||
|
||
/** | ||
* Define CiviCRM_For_WordPress_Shortcodes Class | ||
*/ | ||
class CiviCRM_For_WordPress_Shortcodes_Grant { | ||
|
||
function civicrm_shortcode_preprocess_atts($args, $shortcode_atts) { | ||
if ($shortcode_atts['component'] == 'grant') { | ||
$args['q'] = 'civicrm/grant/transact'; | ||
return $args; | ||
} | ||
} | ||
|
||
// FIXME: Seems like multiple shortcodes don't work on a single page. Also, | ||
function civicrm_shortcode_get_data($data, $atts, $args) { | ||
if ($atts['component'] == 'grant') { | ||
// get grant application page | ||
$sql = "SELECT title, intro_text FROM civicrm_grant_app_page WHERE id = {$params['id']}"; | ||
$dao = CRM_Core_DAO::executeQuery($sql); | ||
while ($dao->fetch()) { | ||
$data['title'] = $dao->title; | ||
$data['text'] = $dao->intro_text; | ||
} | ||
return $data; | ||
} | ||
} | ||
|
||
} |
This file contains 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