information management

51
1 Information Management DIG 3563 – Lecture 8 Content Management Systems: Plugins for Wordpress J. Michael Moshell University of Central Florida Original image* by Moshell et al . Imagery is fromWikimedia except where marked with *.

Upload: bryar-orr

Post on 30-Dec-2015

23 views

Category:

Documents


0 download

DESCRIPTION

Information Management. DIG 3563 – Lecture 8 Content Management Systems: Plugins for Wordpress J. Michael Moshell University of Central Florida. Original image* by Moshell et al. Imagery is fromWikimedia except where marked with *. About Wordpress Modules Plugins. There are LOTS of them - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Information Management

1

Information Management

DIG 3563 – Lecture 8

Content Management Systems:

Plugins for Wordpress

J. Michael Moshell

University of Central Florida

Original image* by Moshell et al .

Imagery is fromWikimedia except where marked with *.

Page 2: Information Management

-2 -

• There are LOTS of them• Their quality varies widely

- Maturity (length of service; number of users)

- Continuing support

- Experience of the builder

How to find out? Read the posting and forums!

Page 3: Information Management

-3 -

Some Random Plugin Visits

• Petfinder Listing

Relies on the Petfinder.com API

(So you don’t have to build your own back-end).

Petfinder.com can host an entire animal-welfare

website.

Petfinder Listing allows YOUR site to get data

from a Petfinder.com – hosted website.

Page 4: Information Management

-4 -

Gpawisconsin.org

Page 5: Information Management

-5 -

Some Random

Plugin Visits

• Buddypress

Actually a COLLECTION of plugins

to support social networking

http://wordpress.org/extend/plugins/buddypress/

Example:

http://helloecoliving.com/community/

Page 6: Information Management

-6 -

How is it built? See Source!

Page 7: Information Management

-7 -

How is it built? See Source!

Page 8: Information Management

-8 -

Examples:

• BuddyMobile

“Mobile BuddyPress theme optimized for ... iPhone,

iPod touch. Will also work on Android & some

Blackberry devices.”

For BuddyPress 1.5 only.

Page 9: Information Management

-9 -

Examples:

• BuddyPress Media

“Production grade” social media hosting

“Drag and Drop” photos, audio, video between

Facebook, Flickr, YouTube ...

ecommerce capabilities

2.7 million users, 16,000 sites.

Page 10: Information Management

-10 -

Beer Ratings

• Requires a RateBeer API Key

Better not say too much about this one;

somebody might do it for a term project

and we've had TOO MANY like this!

Page 11: Information Management

-11 -

WP Survey and Quiz Tool

• Promising topic; many people need this•Maintenance via GitHub

BUT: Daunting feedback.

Page 12: Information Management

-12 -

SS Quiz

• Downloads: 5,319• Apparently a Russian product

• I decide to get it and try it.

Page 13: Information Management

-13 -

SS Quiz

• Downloads: 5,319• Apparently a Russian product

• I decide to get it and try it.

1) Download and unzip

2) Move into

wordpress/wp-content/plugins

3) In the Plugin menu, activate

Page 14: Information Management

-14 -

SS Quiz

• Downloads: 5,319• Apparently a Russian product

• I decide to get it and try it.

1) Download and unzip

2) Move into

wordpress/wp-content/plugins

3) In the Plugin menu, activate

4) A new row appears in the Dashboard

Page 15: Information Management

-15 -

SS Quiz

“To insert quiz into page, use short code

[ssquiz id=‘#’].

So I create a page and call it ‘Mikwiz’, insert

[ssquiz id=‘1’].

Quiz appeared. I took it.

Page 16: Information Management

-16 -

SS Quiz: Control Panel

Page 17: Information Management

-17 -

SS Quiz: Control Panel

Issues: (1) Why were questions 3, 4 radio buttons?

while 1,2,5 were textboxes?

(2) Is the data stored anywhere?

Answers: Exploring, I found:

Page 18: Information Management

-18 -

SS Quiz: Scores

Stores the number of correct answers; no details

Page 19: Information Management

-19 -

SS Quiz: Template

Augmented HTML, with %%TITLE%% etc.

Page 20: Information Management

-20 -

SS Quiz: Template

How do I set “Title” and other variables?

Experimenting with the user interface, I observe

the phrase “Let’s start the quiz “%%TITLE%%”!

On the quiz page, I see:

Page 21: Information Management

-21 -

SS Quiz: Template

Likewise, I observe:

Page 22: Information Management

-22 -

SS Quiz: Template

SO I conclude that these “variables” correspond

to built-in features of the SS Quiz Plugin:

TITLE

DESCRIPTION

QUESTIONS (number of questions entered)

Page 23: Information Management

-23 -

SS Quiz: Template

And likewise,

PERCENT

TOTAL

Page 24: Information Management

-24 -

SS Quiz: We Played a bit

Experiment with creation of a Quiz

and

the use of the Question Editor

Page 25: Information Management

-25 -

SS Quiz: We Play a bit

Experiment with creation of a Quiz

and

the use of the Question Editor

Identify one or more shortcomings of the Plugin:

Page 26: Information Management

-26 -

SS Quiz: We Play a bit

Experiment with creation of a Quiz

and

the use of the Question Editor

Identify one or more shortcomings of the Plugin:

•no UNDO. I delete a question, it’s gone•no actual answer storage. I can’t diagnose...

Page 27: Information Management

-27 -

Time to Build our Own

Plugin. I seek a Tutorial.

http://codex.wordpress.org/Writing_a_Plugin

I start a log (word document) to remember what I do.

Page 28: Information Management

-28 -

Step 1: Trivially modify existing code

Hello Dolly

Go to Plugins menu, activate the plugin.

Small lines of text appear in upper right

corner of the Admin screen.

Page 29: Information Management

-29 -

Step 1: Trivially modify existing code

Understand the Header Comment

It’s NOT ignored by the system. It’s essential!

Page 30: Information Management

-30 -

Step 1: Trivially modify existing code

Make a copy of hello.php, call it hello2.php

Look at plugins menu again. Wierd, huh?

Page 31: Information Management

-31 -

Step 1: Trivially modify existing code

Modify hello2 just enough to recognize it.

Change its name to dolly2

change text to refer to ‘Herman’

Note and fix the

add_action( ) function.

KEY QUESTION: WHAT ARE ‘actions’?

Page 32: Information Management

-32 -

Step 1: Trivially modify existing code

Learn about ‘actions’.

http://codex.wordpress.org/Plugin_API/Action_Reference

NOTE: You are not required to program in

this course. But you are required to understand

key concepts, and action is one of those.

Page 33: Information Management

-33 -

Step 1: Trivially modify existing code

An Action in Wordpress is called an event

in other languages.

As Wordpress runs, it will check its action lists

for functions that should be called, at various

times.

Each plugin can add functions to those lists.

Page 34: Information Management

-34 -

Page 35: Information Management

-35 -...and many more ...

Page 36: Information Management

-36 -

Step 1: Trivially modify existing code

There's a plugin that looks "Suspiciously"

like a Hello-World (starter kit) example

Page 37: Information Management

-37 -

Step 1: Trivially modify existing code

The action in this “Hello Dolly” story

is called admin_notices.

'admin_notices', which

apparently has to do with the top row of

the admin screen.

Page 38: Information Management

-38 -

Step 1: Trivially modify existing code

So, I add my OWN action to see what happens.

Page 39: Information Management

-39 -

Step 1: Trivially modify existing code

So, I add my OWN action to see what happens.

I edited hello.php as above. And the result ...

Page 40: Information Management

-40 -

Step 2: Make something more interesting

I wanted to put something into the main

data area, where PAGES appear.

It took me an hour of exploring to discover an

example. Cut to the chase ... here’s what I

found.

Page 41: Information Management

-41 -

Step 2: Make something more interesting

I wanted to put something into the main

data area, where PAGES appear.

It took me an hour of exploring to discover an

example. Cut to the chase ... here’s what I

found.

Page 42: Information Management

-42 -

Step 2: Make something more interesting

Example: A ‘filter’ to replace all the “<h1>”

tags in a page with ‘<h3>’ tags.

How was that done?

With REGULAR EXPRESSIONS!

Page 43: Information Management

-43 -

Step 2: Make something more interesting

I wanted to actually inject some copy

into a page. So I added an operator to replace

a tag ‘JMMtrigger’ with the text.

Page 44: Information Management

-44 -

Step 2: Make something more interesting

Page 45: Information Management

-45 -

And I had to find an Action to use.

The example code showed me this:

A ‘filter’ is an action that will take in the content

of a page, do stuff to it, and then send it on

to the screen.

So this filter will add the JMMexchange stuff.

Page 46: Information Management

-46 -

JMMexchange will do two things:

1) Replace H1 with H3 tags, and

2) replace the word JMMtrigger

with the data provided by my function.

Page 47: Information Management

-47 -

Then I needed a page to contain the

stuff. Edit-view:

Page 48: Information Management

-48 -

Then I needed a page to contain the

stuff. HTML-view

Page 49: Information Management

-49 -

AND the result on my front page.

Page 50: Information Management

-50 -

Things to understand about Plugin-making:

1)Making Plugins requires PHP skills

2)What is an Action

3)What is a Filter

4)What is the relationship between the code in the Plugin, and the text of a page?

How is the plugin’s activity triggered?

How can it modify the text of a page?

Page 51: Information Management

-51 -

Things to understand about Plugins:

1) Their quality and complexity varies WIDELY

2) They seldom do exactly what you want

3)You can modify ‘em, but keep a clean copy.

AND the MORAL:

Invest the effort to find a module* that actually

does what you need (or, as close as possible.)

(*: Plugin, in Wordpress-speak!)