drupal session 3


                                                   Biginlucerne.com -
                                                   Lessons Learned
                                                   Topic: Biginlucerne.com - Lessons Learned
                                                   Date: 13.02.2012
                                                   Presenter: Slava Rys
                                                   Twitter: @merdekiti
                                                   Blog: http://www.netnode.ch/blog




http://www.netnode.ch - pure drupal - drupal development services
What we’ll know in 15min?




• How biginlucerne.com is built using Drupal
• Challanges and solutions
What is biginlucerne.com?

• Photo contest
• Social media campaign for Lucerne tourism
                                     Client
                                     www.lucerne.com



                                     Design & concept by
                                     www.cloukreativ.ch
Lets talk about key functions



• Facebook integration
• Voting mechanism
• Get next image for voting process
Facebook integrations



Problems & solutions
• Fbconnect — does not work well yet
• Fb — the best module for FB integrations
FB module functions?

• Connect FB account to user
• Development tools
• Views integrations
• Rules integrations
• Example module
• And lot of other functions...
Why is this cool?



• No problem with instalations and setup (all works
  from the box)
• Easy UI
• Good documantation
The FB module hook

hook_fb_user ($op, $data, &$return) {}

$op:

•   FB_USER_OP_PRE_USER- Before account creation, fb_user.module

•   FB_USER_OP_POST_USER - After account creation, fb_user.module

•   FB_USER_OP_POST_EXTERNAL_LOGIN - user map has changed global user.

•   FB_USER_OP_POST_USER_CONNECT - Connected local account to FB account,
    fb_user.module

•   FB_USER_OP_POST_USER_DISCONNECT - Disconnected local account from FB
    account, fb_user.module
Lets talk about the voting process



Problems & solutions
• The flag module was skipped
• Voting API & rate modules — the best solution for
  voiting process
Drupal Voting API module is cool!

The Voting API does four key jobs for module developers:
•   CRUD: Create/Retrieve/Update/Delete operations for voting data.

•   Calculation: Every time a user creates a vote, VotingAPI calculates the results
    and caches them for you.

•   Workflow: By integrating with Actions.module, VotingAPI can trigger workflow
    steps (like promoting a node to the front page, hiding a comment that's been
    flagged as spam, or emailing an administrator) when votes are cast and results
    are tallied.

•   Display: VotingAPI integrates with Views.module, allowing you to slice and dice
    your site's content based on user consensus.
Drupal rate module is cool!

•   This module provides flexible voting widgets for
    nodes and comments.
•   Administrators can add multiple widgets. By default,
    there are 8 widget types
•   By using "custom" you can customize the rating
    buttons and Voting API mode. Widget types can be
    extended by other modules.
•   Flexible API
The Rate module hooks

•   hook_rate_templates() {}

•   hook_rate_widget_alter(&$widget, $context) {}

•   hook_rate_widget_insert(&$widget, $values) {}

•   hook_rate_widget_update(&$widget, $values) {}

•   hook_rate_widget_delete(&$widget) {

•   hook_rate_vote_alter($vote, $context) {}
Code example
Get next image


Performance trick
•   The views module was skipped
•   Get next image using db_select()
Code example
Biggest problem



 • Voting process
 • Facebook Open Graph
 • Facebook integrations
Discussion




 • Questions?
drupal pur
  www.net node.ch

Drupal session 3 - biginlucerne.com - lessons learned

  • 1.
    drupal session 3 Biginlucerne.com - Lessons Learned Topic: Biginlucerne.com - Lessons Learned Date: 13.02.2012 Presenter: Slava Rys Twitter: @merdekiti Blog: http://www.netnode.ch/blog http://www.netnode.ch - pure drupal - drupal development services
  • 2.
    What we’ll knowin 15min? • How biginlucerne.com is built using Drupal • Challanges and solutions
  • 3.
    What is biginlucerne.com? •Photo contest • Social media campaign for Lucerne tourism Client www.lucerne.com Design & concept by www.cloukreativ.ch
  • 4.
    Lets talk aboutkey functions • Facebook integration • Voting mechanism • Get next image for voting process
  • 5.
    Facebook integrations Problems &solutions • Fbconnect — does not work well yet • Fb — the best module for FB integrations
  • 6.
    FB module functions? •Connect FB account to user • Development tools • Views integrations • Rules integrations • Example module • And lot of other functions...
  • 7.
    Why is thiscool? • No problem with instalations and setup (all works from the box) • Easy UI • Good documantation
  • 8.
    The FB modulehook hook_fb_user ($op, $data, &$return) {} $op: • FB_USER_OP_PRE_USER- Before account creation, fb_user.module • FB_USER_OP_POST_USER - After account creation, fb_user.module • FB_USER_OP_POST_EXTERNAL_LOGIN - user map has changed global user. • FB_USER_OP_POST_USER_CONNECT - Connected local account to FB account, fb_user.module • FB_USER_OP_POST_USER_DISCONNECT - Disconnected local account from FB account, fb_user.module
  • 9.
    Lets talk aboutthe voting process Problems & solutions • The flag module was skipped • Voting API & rate modules — the best solution for voiting process
  • 10.
    Drupal Voting APImodule is cool! The Voting API does four key jobs for module developers: • CRUD: Create/Retrieve/Update/Delete operations for voting data. • Calculation: Every time a user creates a vote, VotingAPI calculates the results and caches them for you. • Workflow: By integrating with Actions.module, VotingAPI can trigger workflow steps (like promoting a node to the front page, hiding a comment that's been flagged as spam, or emailing an administrator) when votes are cast and results are tallied. • Display: VotingAPI integrates with Views.module, allowing you to slice and dice your site's content based on user consensus.
  • 11.
    Drupal rate moduleis cool! • This module provides flexible voting widgets for nodes and comments. • Administrators can add multiple widgets. By default, there are 8 widget types • By using "custom" you can customize the rating buttons and Voting API mode. Widget types can be extended by other modules. • Flexible API
  • 12.
    The Rate modulehooks • hook_rate_templates() {} • hook_rate_widget_alter(&$widget, $context) {} • hook_rate_widget_insert(&$widget, $values) {} • hook_rate_widget_update(&$widget, $values) {} • hook_rate_widget_delete(&$widget) { • hook_rate_vote_alter($vote, $context) {}
  • 13.
  • 14.
    Get next image Performancetrick • The views module was skipped • Get next image using db_select()
  • 15.
  • 16.
    Biggest problem •Voting process • Facebook Open Graph • Facebook integrations
  • 17.
  • 18.
    drupal pur www.net node.ch