Elgg 1.8 social networking : create, customize, and deploy your very ...

10 downloads 52 Views 325KB Size Report
Preface. 1. Chapter 1: Social Networking and Elgg. 7. Social features. 8. Profiles. 8. Relationships. 8. Content sharing. 8. Activity and notifications. 8. Groups. 8.
Elgg 1.8 Social Networking

Create, customize, and deploy your very

networking site

with

Elgg

Cash Costello

open

PACKT PUBLISHING

BIRMINGHAM

source*

community experience distilled

-

MUMBAI

own

social

Table of Contents Preface

1

Chapter 1: Social Networking and Elgg

7

Social features

8

Profiles

8

Relationships Content sharing Activity and notifications Groups

8

Communication

9

What is The

8

8 8 9

Elgg?

10

Elgg engine

11

User management

11

controls

Privacy Theming Commenting Tagging Widgets

12

Internationalization

13

Feeds

13

Web services

14

11 12 12

The power of plugins Bundled plugins

14

Third-party plugins

14

Themes

15

Building

your

own

14

plugins

Case studies Niche social network Designing and building the Deploying the site

15 15

16 site

16 16

Table of Contents 17

Plugins mentioned Corporate intranet

17

Designing and building the site Deploying the site Plugins mentioned Educational collaboration Designing and building the site Deploying the site

17 18 18

18 19 19

Plugins mentioned

19

Elgg resources Elgg community

20

20

Elgg wiki

Developer

20

20

resources

A few words of advice

20

Take notes

20

Save

21

resources

Be methodical

21

Finding help Summary Chapter 2: Installing Elgg

21

21 23

Preparing the server Checking requirements Downloading the latest version Extracting the files files to your web Configuring the server

Moving

server

23

24 24

25

directory

Create the database

Run

25

27 28

Elgg's installer Loading the database Configure Elgg Creating the admin account

29

All done!

34

Summary Chapter 3: A Tour of Your First Elgg Site

31 32

33 35 37

Getting around Registering users

38

User

40

profiles

and avatars

39

Profile information

41

Avatar

42

Profile

widgets

43

Table of Contents Friends

45

Activity stream

47

Tools

48

Blogs

48

Bookmarks

49

Files

50

Groups Pages Messages

50

The wire

53

User

52 53 54

settings

Your

settings

54

Tools

55

Notifications

55

Administration

56

Activating plugins Site categories Custom profile fields Default widgets

58

Site pages Reported content

60

58 59

59 61

Customizing your site User registration and authentication

61

62

Widgets Friendship model

62

Roles

62

62

and support

Help Summary Chapter 4: Sharing Content Blogs Creating

63

65 66

a

67

blog post

Embedding photos and Publishing Finding and viewing Search Lists of

63

files

68

69

69 70

blog posts

70

RSS feeds

71

Widget

72

Commenting

72

Use

cases

73

Customizations

73

Table

of Contents 74

Bookmarks

Adding

a

bookmark

74 76

Bookmarklet

Viewing

77

Use

78

cases

79

File

Uploading Viewing

a

file

79 80

cases

83

Customizations

83

Use

83

The wire

Posting Viewing

84

Twitter

86

integration

85

cases

89

Customizations

90

Use

Summary Chapter 5: Communities, Collaboration, and Conversation Groups Creating a group Group profile



91 92

92 94

Membership

95

Discussion forum

96

Group tools Finding groups

98

99

cases

100

Customizations

100

Pages Creating pages Viewing

101

Use

Use cases

Customizations

102 103 104

104

Messages

104

Inbox

104

Composing

105

Customizations

106

Message board Customizations

Summary

106 108

108

Table of Contents

Chapter 6: Finding and Using Plugins Plugin administration Filtering and sorting Plugin dependencies Plugin settings Finding plugins Browsing the repository Searching Evaluating before downloading Look at the

plugin

overview

Read the comments Check the

history

Custom

plugins Installing plugins Test server

Invalid

and

109 109

110 113

113 115 115 115 115

115 116

116

116 117

the code

Copying Activating

109

configuring

plugin?

Troubleshooting Themes

Finding and installing themes Free themes

117 117 118

118 118

119 119

Commercial themes

120

Custom themes

120

Installing themes

121

Major community plugins Tidypics Plugin profile

122 122 122

Administration

123

Uploading photos Viewing photos Tagging photos

124

Event calendar

124 126

126

Plugin profile

127

Administration

127

Site calendar

127

Group calendar Profile Manager Plugin profile Adding profile fields Configuring the profile fields Plugin settings

Summary

128

128 128 129 130 130

131

Table

of Contents

Chapter

7:

Creating Your First Plugin

133

What you need to know

134

Elgg developer resources Setting up your development environment Editing code Configuring your site Hello, World! Plugin skeleton

135

Create your plugin directory

Plugin manifest Start script Activating the hello world plugin Register for the init, system event

136

136 137 138 138 138 139 139 140

140

Adding a new route Creating a web page Update routing

141

Add to the site

144

142 143

menu

Extending the page handler Add a sidebar menu

145

Language support

148

Personalizing

the content

Organizing your content into views A

greeting

view

149 150 151

A stats view

153

Review

155

Debugging Debugging to the log Debugging to the screen Debugging PHP through an IDE Firebug and other browser development tools Elgg developer tools Inspect Theming sandbox

155 156 157 158 159 161 161 162

Summary

162

Chapter 8: Customization through Plugins Lesson 1:

146

Changing wording

163 164

Problem

164

Solution

164

Example Step Step

164

1: Create the 2: Find the

Step 3: Override

plugin

structure

165

language strings

166

the

166

language string

Table

Exercise Lesson 2:

of Contents 167

Modifying

a

section of

a

page

167

Problem

167

Solution

168

Example

168

Step 1: Find the view to override Step 2: Create the plugin structure Step 3: Edit the logo view Step 4: Style the header Exercise Lesson 3:

Adding

new

168 170 170 172

173

content to

a

page

173

Problem

173

Solution

173

Example

174

Step 1: Find the view to extend Step 2: Create the plugin structure Step 3: Build our view Step 4: Make the tips random Exercise Lesson 4:

175 175 175 176

177

Doing something when

X

happens

178

Problem

178

Solution

178

Example

178

Step 1: Find the event Step 2: Create the plugin structure Step 3: Write the function that sends Exercise Lesson 5:

Creating

a

custom

178 179 the e-mail

widget

180

180 181

Problem

181

Solution

181

181

Example Step Step

1: Create the 2: Create the 3: Create the

Step Exercise Lesson 6:

plugin structure widget edit view widget content view

182 182 184

186

Giving

your

users

options

186

Problem

186

Solution

187 187

Example Step 1: Step 2: Step 3: Step 4:

Create the Add

user

plugin settings

structure

187 188

Create the toolbar view

190

Add CSS

191

Table of Contents

Exercise

192

Lesson 7:

Adding JavaScript

193

Problem

193

Solution

193

Example

193

Step 1: Create the plugin structure Step 2: Load the JavaScript file Step 3: Add CSS and JavaScript initialization Exercise

194

196

Lesson 8: Changing how Elgg does X

197

194 195

Problem

197

Solution

197

Example

197

Step 1: Create the plugin structure Step 2: Create the index page Step 3: Define the views Step 4: Add the CSS Step 5: Add a plugin setting Exercise Lesson 9:

Collecting

and

storing data

198 199 201

203 204

206 207

Problem

207

Solution

207

Example

207

Overview

Step 1: Create the plugin structure Step 2: Create the main help page Step 3: Create the categories Step 4: Add an administration page Step 5: Create the form body Step 6: Create the save action Step 7: Create the help category page Step 8: Create the help object view Step 9: Add the help sidebar Step 10: Add CSS for the topic listing page Step 11: Finish the main help page Exercise

Summary

208 208

209 211 212 213 215 217 219 221 222 223

225 226

Chapter 9: Theming Elgg

227

What you need to know

228

Theming basics Elgg's default theme

228 228

HTML

229

CSS

231

JavaScript Graphics

232

233

-

Table of Contents

Views system What is

a

233

view?

233

Extending a view Overriding a view Template language Caching The viewtype

234 234 234 235 235

Tools

235

CSS framework

236

Creating abstractions of common visual patterns Customizing objects through extension classes Adding external JavaScript and CSS

238

Menu

238

system

Registering a menu Rendering a menu

item

Comparing theming Building a theme Plugin structure

236 237

239 240

in WordPress to

Elgg

240

241 242

244

Layout Default

layout

244

Page header

244

Page body layout Page footer

244 245

Moving the search box

246

Styling

the sidebar module

Moving

the site

menu

to the

247

topbar

Creating a mobile theme Plugin structure Layout

251 252 253

CSS

253

Summary

256

Chapter 10: Moving to Production

Selecting

248

Performance considerations

Competing

for resources

Usage patterns General guidelines

257 258

a server

258 258 259

for

server

selection

260

Hosting options

260

Shared hosting

261

Virtual Private Server

261

Dedicated

262

server

Cloud

hosting Hosting company selection

Configuring Apache

a server

262

262

263 263

Table

of Contents

PHP

264

MySQL

266

Cron

267

E-mail

268

Managing the site Backup

268 269

Code

269

Database

269

Files

270

Server configuration

270 270

Restoring Log rotation

270

Spam

271 271

Registration Detecting spammers Web analytics

Daily

272

273

273

tasks

Monitoring user registration Reviewing reported content Responding to feedback Community management Testing, upgrading, and moving

273 273 273 274 a

site

274

274

Testing Mirroring the production site Test plan

274 275

276

Upgrading Moving a site

277

Performance

278 278

Benchmarking Monitoring and data collection Stress testing

278 279

Easy performance gains

280

Advanced

281

performance tuning and scaling

281

Caching Multiple servers

282

Resources

282

Reporting bugs Steps to reproduce the problem Elgg or plugin? Reporting the bug Summary Appendix A: Developer's Quick Start Guide Overview of What is

Elgg Elgg?

as a

framework

283 283 284 284

284 285 285 286

Table of Contents

Object-oriented Does it

use

Convention

or

286

procedural?

the Model-View-Controller or

pattern?

286

configuration?

Is it extensible? What

286

template engine is used?

A Model-View-Controller

286

perspective

287 of

Elgg

287

Overview

287

Controllers

287

Model

288

Views

289

Routing

290

Code location Actions

290

290

Code location

290

Page handlers

291

Code location

291

Framework

booting

Code location

291 292

Data model

292

Entities

292

Type

and

subtype

293

GUID

293

Owner

293

Container

293

Access

293

Database

294

Relationships

294

Extenders

294

Database

295

Retrieval functions

296

Code location

296

Views View

297

templates

297

Page shells and layout type Overriding and extending views Special views

298

Code location

299

View

Events and hooks

298 299 299 300

Elgg events Plugin hooks

300

Code location

301

300

Table of Contents

301

Plugins Initialization

302

Plugin order

302

Conventions

302

Themes

303

Code location

303

stream

304

Code location

304

Activity

Notifications Code location Internationalization and localization Code location

Lightning

round

304 304 305 305 305

Authentication

306

Caching Configuration Debugging and logging JavaScript

306

Menus

307

Private

settings

306 306

307 307

Search

307

Security

308

Session

handling

308

Unit tests

308

Web services

308

Widgets Summary Appendix B: Views Catalog Using views Page structure Shells

308

309

311^ 311 312

312

Layouts

313

Elements

313

Topbar

314

Header

314

Sidebar

314

Footer

315

Owner block

316

Status messages

316

Comments

317

Search box

317

Components

318

Table

of Contents

Gallery Image block

318

List

319

Module

320

319

Navigation

321

Breadcrumbs

321

Pagination

321

Menus

321

Topbar Site

322

menu

322

menu

Page

322

menu

Footer menu

323

User hover

323

Entity

menu

menu

323

Tabs

324

Forms

324

Input

324

Access

325

Buttons

325

Checkboxes

325

Date

326

Drop-down selector File upload

327

Hidden

input

327

textarea

328

Large

327

Password

328

Radio buttons

328

Textbox

329

User

pickers

329

Output

330

Date

330

E-mail address

330

Link

330

Tag cloud Tags

331 331

Text

331

The form

331

Users, groups, and objects

Activity

332

stream

332

Likes

333

Like this

333

List

333

users

Widgets

334

Administration

335

Summary

336

Index

337 [

xiii

]