CVS edit link for blisstering

We have created a module which allows users to earn UserPoints by taking surveys and offers provided by Peanutlabsmedia. Facebook uses this feature for various gaming applications like TexasHolde'm Poker to earn virtual currency by taking surveys and offers.

This module provides a way to integrate with Peanutlabsmedia.The Peanut Labs Media Monetization Platform is designed specifically to work with virtual currencies and goods in the new digital economy - be they social applications on Facebook, Myspace or Linkedin, or leading Games and Gaming communities.

You can learn more about Peanut Labs at http://www.peanutlabsmedia.com/.

* You can see this module in action at http://bliss-dev.com/drupalcontributions/take-survey/get-points

* The Administrator can configure the settings from here http://bliss-dev.com/drupalcontributions/admin/settings/peanutlabsmedia

Please Login with Username: demo Password:demo

The module is ready, verified with coder and tested for functionality.

We plan to contribute a number of modules back to the community -- this is just the start. A few details about us can be found in the attached presentation. You can also read about the modules at www.blisstering.com/blog .

Thank you.

PS. We had applied for a CVS account earlier to start this process of contributing modules to the community. Specifically, we had started with the autocreategroup module. We had assigned the task to a newbie as part of his Drupal training process. That individual is no longer with the company. We will ensure that all subsequent modules will be managed by seasoned Drupalers at Blisstering.

Comments

blisstering’s picture

StatusFileSize
new326.5 KB
new2.86 KB

Uploaded the zip format of the module and Blisstering Company Overview.

blisstering’s picture

Status: Postponed (maintainer needs more info) » Needs review

Changing status to needs review.

avpaderno’s picture

Issue tags: +Module review

Hello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review the code of the proposed project.

blisstering’s picture

Hi kiamlaluno,

This is just a gentle nudge to remind you to review our CVS application. If you find some time can you please tell us the status of this application, so that it will help us to contribute this proposed project to drupal.org community as soon as possible. Once we figure the mechanics of doing this once, we have several more modules to contribute (you can learn more at blisstering.com/blog).

Thank you.

avpaderno’s picture

Status: Needs review » Needs work
  1. /**
     * Install the initial schema.
     */
    function peanutlabsmedia_install() {
      variable_set('peanutlabsmedia_userid', 0);
      variable_set('peanutlabsmedia_appkey', 0);
      variable_set('peanutlabsmedia_frame_height', 0);
      variable_set('peanutlabsmedia_frame_width', 0);
    }
    
    /**
     * Implementation of hook_uninstall().
     */
    function peanutlabsmedia_uninstall() {
      db_query("DELETE FROM {variable} WHERE name LIKE 'peanutlabsmedia_%'");
      cache_clear_all('variables', 'cache');
    }
    

    There is no need to set Drupal variables on hook_install(); the second argument of variable_get() is the value that will be returned when the variable has not been set before. As Drupal variables are loaded in memory each times Drupal bootstraps, if every module would initialize its persistent variables in that way, the used memory would increase.
    Deleting variables as done in hook_uninstall() is not suggested. The code could delete variables used by other modules. There is nothing that forbids to a developer to create a module called peanutlabsmedia_services, in example, and the code would deleted the variables of that module too.

  2. function peanutlabsmedia_perm() {
      return array(
        'Administer Peanutlabsmedia',  
      );
    } 
    

    Permission string should use the verb in lower case (administer nodes, administer users, etc).

  3.     'title' => 'Peanutlabs Media Settings',
    

    Strings used as titles should be in sentence case (Peanutlags Media settings).

  4.   $items['take-survey/get-points'] = array(
        'page callback' => '_peanutlab_take_survey',
        'type' => MENU_CALLBACK,
        'title' => t('Take a Survey'),
        'access arguments' => array('access content')
      );
    

    To avoid conflict with other modules, the menu path should include the module short name.

  5. /**
     * Include all peanutlabmedia include files.
     */
    function _peanutlabsmedia_include() {
      $peanutlabsmedia_path = drupal_get_path('module', 'peanutlabsmedia');
      require_once("$peanutlabsmedia_path/peanutlabsmedia.admin.inc");
    }
    

    There is a Drupal function with the same purpose; the module should use Drupal functions, where there are functions suitable for the purpose.

blisstering’s picture

Status: Needs work » Needs review
StatusFileSize
new4.35 KB

Hi Kiamlaluno,

Thank You for your valuable review. I done the following changes as per your previous post. Please find the attached module for further review.

* Removed the code that sets the drupal variable on hook_uninstall(); as per your first point.
* Changed the code in hook_uninstall which deletes the variables on hook_uninstall(); as per your first point.
* Permission string is in lower case now as per your second point.
* Changed the title to sentence case as per your third point.
* Changed the menu path as per your fourth point first section.
* Changed the code which include files using the drupal api function module_load_include($type, $module, $name = NULL); as per your fourth point second section.

Changing the status to needs review.

Thank You.

avpaderno’s picture

Status: Needs review » Needs work
  1.   $items['admin/settings/peanutlabsmedia'] = array(
        'title' => t('Peanutlabs media settings'),
        'page callback' => 'drupal_get_form',
        'page arguments' => array('peanutlabsmedia_settings'),
        'access callback' => 'user_access',
        'access arguments' => array('Administer Peanutlabsmedia'),
        'type' => MENU_LOCAL_TASK,
        'weight' => 10,
        'file' => 'peanutlabsmedia.admin.inc',
      );
    

    Menu titles, and descriptions should not be passed to t() as that is already done by Drupal core code.

  2.   return "You are not authorized to take a survey. Please " . l('login', 'user/login', array('query' => array('destination' => $_GET['q']))) . " or " . l('Register', 'user/register') . "."; 
    
      if ($oid_hash === $oid_ver && $cmd == "transactionComplete" && $status == "C") { 
        $params = array(
          'uid' => $uid,
          'points' => $miles,
          'description' => 'You earned ' . $miles . ' miles by completing a survey with offerId' . $offer_id,
          'display' => FALSE
        );
    

    Except for what reported in the previous point, strings used in the user interface should be translated. l() should not be used together t(); the first fragment needs to be changed to use url() instead of l().

  3. /**
     * Implementation of hook_uninstall().
     */
    function peanutlabsmedia_uninstall() {
      db_query("DELETE FROM {variable} WHERE name = 'peanutlabsmedia_userid'");
      db_query("DELETE FROM {variable} WHERE name = 'peanutlabsmedia_appkey'");
      db_query("DELETE FROM {variable} WHERE name = 'peanutlabsmedia_frame_height'");
      db_query("DELETE FROM {variable} WHERE name = 'peanutlabsmedia_frame_width'");
      cache_clear_all('variables', 'cache');
    }
    

    The code should use variable_del().

blisstering’s picture

Status: Needs work » Needs review
StatusFileSize
new2.81 KB

Hi kiamlaluno,

Once again thank you for your valuable review. Here is the update module with the changes mentioned in the previous post. Please find the below changes in the attached module.

* Removed t() function from menu titles and description as per your first point.

* As per your second point first fragment url() is used with t() function.

* As per you second point second fragment all the user interface strings except menu titles are wrapped inside t() function.

* As per your third point variable_del() is used instead of db_query().

Changing the status to needs review.

Thank You

avpaderno’s picture

Status: Needs review » Fixed
  cache_clear_all('variables', 'cache');

That call is already done by variable_del().

      'points' => $miles,
      'description' => t('You earned ' . $miles . ' miles by completing a survey with offerId' . $offer_id),
      'display' => FALSE

The first argument of t() must be a literal string; differently, the script that extracts the string to translate to create the translation template will not be able to extract the string, which would not be translatable (if not in the case another module uses the same exact string, but it's rather difficult it happens, when the string is dynamically changed).
The correct code should use t()-placeholders.

Thank you for your contribution! I am going to update your account.
These are some recommended readings to help with excellent maintainership:

You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

I thank all the dedicated reviewers as well.

blisstering’s picture

Hi Kiamlaluno,

We are glad to hear from you and thank you for giving access to CVS account. We are excited to on board with Drupal Community and looking forward to maintain and contribute many modules in near by future.

We will make the changes mentioned in the above post and will follow all the necessary coding practices for the upcoming projects.

Thank You.

Status: Fixed » Closed (fixed)
Issue tags: -Module review

Automatically closed -- issue fixed for 2 weeks with no activity.

avpaderno’s picture

Component: Miscellaneous » new project application
Assigned: Unassigned » avpaderno
Issue summary: View changes