When updating profile fields in groups [example http://site/user/1/edit/MyBusinessProfile]
values in table creativecommons_user are reset to null

Comments

afagioli’s picture

my quick fix in creativecommons.module:2217

only update record when arg(3) is null

    case 'update':
    case 'insert':
      if (!arg(3))  {
	// Delete old entry from database
	db_query("DELETE FROM {creativecommons_user} WHERE uid = %d", $account->uid);

	// Load fields for query
	$fields = array('uid', 'license_type', 'jurisdiction');
	$values = array('%d', "'%s'", "'%s'");
	$args = array($account->uid, $edit['license_type'], $edit['jurisdiction']);

	// Load available user specific metadata fields
	foreach (array('attributionName', 'attributionURL') as $key) {
	  if (creativecommons_metadata_is_available($key)) {
	    $fields[] = $key;
	    $values[] = "'%s'";
	    $args[] = $edit[$key];
	  }
	}
	// Build query
	$query = 'INSERT INTO {creativecommons_user} ('. implode(', ', $fields) .') VALUES ('. implode(', ', $values) .')';
	$args = array_merge(array($query), $args);
	$result = call_user_func_array('db_query', $args);  //augusto
      }
      break;


hope will helps

afagioli’s picture

my quick fix in creativecommons.module:2217

only update record when arg(3) is null

    case 'update':
    case 'insert':
      if (!arg(3))  {
	// Delete old entry from database
	db_query("DELETE FROM {creativecommons_user} WHERE uid = %d", $account->uid);

	// Load fields for query
	$fields = array('uid', 'license_type', 'jurisdiction');
	$values = array('%d', "'%s'", "'%s'");
	$args = array($account->uid, $edit['license_type'], $edit['jurisdiction']);

	// Load available user specific metadata fields
	foreach (array('attributionName', 'attributionURL') as $key) {
	  if (creativecommons_metadata_is_available($key)) {
	    $fields[] = $key;
	    $values[] = "'%s'";
	    $args[] = $edit[$key];
	  }
	}
	// Build query
	$query = 'INSERT INTO {creativecommons_user} ('. implode(', ', $fields) .') VALUES ('. implode(', ', $values) .')';
	$args = array_merge(array($query), $args);
	$result = call_user_func_array('db_query', $args);  //augusto
      }
      break;


hope will help

afagioli’s picture

Issue summary: View changes
Status: Active » Closed (outdated)