IMPLEMENTING AND DEVELOPING FOR WORDPRESS IN CIVICRM 4.6 AND BEYOND - - PowerPoint PPT Presentation

implementing and developing for wordpress in civicrm 4 6
SMART_READER_LITE
LIVE PREVIEW

IMPLEMENTING AND DEVELOPING FOR WORDPRESS IN CIVICRM 4.6 AND BEYOND - - PowerPoint PPT Presentation

IMPLEMENTING AND DEVELOPING FOR WORDPRESS IN CIVICRM 4.6 AND BEYOND Kevin Cristiano kcristiano@tadpole.cc April 2015 Tadpole Collective @kcristiano Overview: CiviCRM and WordPress BasePage for WordPress Shortcodes Hooks for


slide-1
SLIDE 1

IMPLEMENTING AND DEVELOPING FOR WORDPRESS IN CIVICRM 4.6 AND BEYOND

Kevin Cristiano kcristiano@tadpole.cc April 2015 Tadpole Collective @kcristiano

slide-2
SLIDE 2
  • CiviCRM and WordPress
  • BasePage for WordPress
  • Shortcodes
  • Hooks for WordPress
  • What’s Next

Overview:

slide-3
SLIDE 3
  • Christian Wach
  • https://civicrm.org/blogs/haystack/

working-civicrm-46-wordpress

  • https://github.com/civicrm/civicrm-

wordpress/pull/63

  • https://github.com/civicrm/civicrm-

core/pull/4360

References for 4.6 improvements

slide-4
SLIDE 4
  • 4.1 – The Beginning
  • Shortcodes
  • 4.2 - Extensions
  • 4.3 – ACL
  • 4.4 – Petition Shortcodes
  • 4.5 – wp-cli

CiviCRM and WordPress

slide-5
SLIDE 5
  • 4.6 – Major Step Forward
  • CiviCRM Basepage Auto Setup
  • Shortcodes
  • WordPress hooks

CiviCRM and WordPress

slide-6
SLIDE 6

WP BASEPAGE

What is this basepage issue anyway?

Drupal URLs vs WordPress URLs Drupal -- http://drupal.dev/civicrm/event/register? reset=1&id=3 WordPress – http://wpcv45.dev/?page=CiviCRM&q=civicrm/event/ register&reset=1&id=3

?page=CiviCRM&q=

slide-7
SLIDE 7
slide-8
SLIDE 8
slide-9
SLIDE 9

One small Change: BasePage

slide-10
SLIDE 10

Create a WordPress Page

slide-11
SLIDE 11

http://wpcv45.dev/civicrm/? page=CiviCRM&q=civicrm/event/ register&reset=1&id=3 civicrm/?page=CiviCRM&q=

Automated in 4.6

slide-12
SLIDE 12

End Result: /includes/civicrm.basepage.php

BasePage now have its own class CiviCRM_For_WordPress_Basepage

slide-13
SLIDE 13
slide-14
SLIDE 14

Shortcodes

Allow CiviCRM content to be added to WordPress content types example: [civicrm component="contribution" id="1" mode="live" hijack="0"] All WordPress shortcodes are added to a post, page or Custom Post Type

slide-15
SLIDE 15
slide-16
SLIDE 16
slide-17
SLIDE 17
slide-18
SLIDE 18

Result : http://wpcivi46.dev/donate-now/ Instead of http://wpcivi46.dev/civicrm/? page=CiviCRM&q=civicrm/contribute/ transact&reset=1&id=1

slide-19
SLIDE 19

16

slide-20
SLIDE 20

Shortcode issues before 4.6:

  • Multiple shortcodes on one ‘page’
  • Fail
  • Shortcodes and WordPress Content
  • Fail
  • Archive Page (eg. /events) where each

page has a CiviCRM shortcode

  • Fail

slide-21
SLIDE 21

Shortcodes in 4.6 : Allow multiple shortcodes on a page. This can be a ‘single’ page or an ‘archive’ page

slide-22
SLIDE 22
slide-23
SLIDE 23

End Result: /includes/civicrm.shortcodes.php

Shortcodes now have their own class CiviCRM_For_WordPress_Shortcodes

slide-24
SLIDE 24

Before 4.6:

slide-25
SLIDE 25

4.6:

slide-26
SLIDE 26

Coexist – CiviCRM shortcodes with WordPress Content

slide-27
SLIDE 27
slide-28
SLIDE 28

[civicrm component="event" id="3" action="info" mode="live" hijack="1"]

slide-29
SLIDE 29
slide-30
SLIDE 30

Hooks

WordPress Hooks Action Hooks

Filter Hooks

In WordPress Action Hooks ‘do stuff’, Filter Hooks ‘take input, modify it and return it’

slide-31
SLIDE 31

WordPress Hooks in CiviCRM Before 4.6 all Hooks had to be named: wordpress_civicrm_hookname

slide-32
SLIDE 32
slide-33
SLIDE 33

Challenges:

In Drupal this was not an issue as the hooks were: modulename_civicrm_hookname But in WordPress this did not work. To use hooks in WP plugins all hooks had to start with ‘wordpress_’ not the plugin name (equivalent of Module Name) So if you wanted to use the same hook more than once it would fail. Hooks used by different plugins could also clash as there was no proper naming convention

slide-34
SLIDE 34

In 4.6 we can now hook into CiviCRM properly

How: https://github.com/civicrm/civicrm-core/pull/4360 CRM_Utils_Hook_WordPress

slide-35
SLIDE 35
slide-36
SLIDE 36

Examples:

slide-37
SLIDE 37
slide-38
SLIDE 38

What’s Next?

  • Still work to be done on WP-CiviCRM
  • Webforms?
  • CiviCRM native Webforms
  • Gravity Forms Interation – Nate Porter
  • Parity with Drupal and Joomla!
  • Would like to see CiviCRM be truly CMS agnostic
  • Sustainability
  • By creating parity the market potential for CiviCRM is

much greater

  • The fact is CiviCRM currently is more feature rich on

Drupal

slide-39
SLIDE 39

Resources – WP Plugins

  • CiviCRM Admin Utilities
  • https://wordpress.org/plugins/civicrm-admin-utilities/
  • https://github.com/christianwach/civicrm-admin-utilities
  • CiviCRM WP Profile Sync
  • https://wordpress.org/plugins/civicrm-wp-profile-sync/
  • https://github.com/christianwach/civicrm-wp-profile-sync
  • CiviCRM Member Sync
  • https://wordpress.org/plugins/civicrm-wp-member-sync/
  • https://github.com/christianwach/civicrm-wp-member-

sync

slide-40
SLIDE 40

Resources

  • Override CiviCRM Shortcode Button by Post Type
  • https://gist.github.com/christianwach/

291e646c1306a6652a4a

  • WordPress Issues
  • http://tdpl.cc/wpcvissues
  • URL issue
  • https://issues.civicrm.org/jira/browse/CRM-16235
  • Bootstrapping WP Issue
  • http://tdpl.cc/wpcvbootstrap
slide-41
SLIDE 41

QUESTIONS?

slide-42
SLIDE 42

IMPLEMENTING AND DEVELOPING FOR WORDPRESS IN CIVICRM 4.6 AND BEYOND

Kevin Cristiano kcristiano@tadpole.cc April 2015 Tadpole Collective @kcristiano