Firstly thanks a lot for making this great module.
I think the problem is am reporting is a bug and all webmasters use Drupal 7 will face it if they install this module.
I installed the Adsense module, All parts of module work fine but only Revenue sharing part doesn't work. I enabled profile module and defined a single-line textfield block for members to define their adsense code and i named this block, profile_google_adsense_client_id
I also made it private. But when i go to revenue sharing basic page in my admin panel, i get a red error page with below content. Please help me to solve this problem.

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database_drpl2.profile_fields' doesn't exist: SELECT fid, title FROM {profile_fields} ORDER BY fid; Array ( ) in revenue_sharing_basic_get_profile_fields() (line 147 of /home/...../sites/all/modules/adsense/old/revenue_sharing_basic/revenue_sharing_basic.admin.inc).

Please help me to fix this problem or write a patch for it.

Comments

monil-dupe’s picture

Issue summary: View changes

i changed some names for security reasons/

monil-dupe’s picture

Issue summary: View changes

I edited some parameters.

monil-dupe’s picture

Issue summary: View changes

I answered the question with more details now.

pfrenssen’s picture

I quickly checked this. This is probably because the D7 port of the Revenue Sharing module is not complete. In D7 the Profile module has renamed the database tables:

modules/profile/profile.install

/**
 * Rename {profile_fields} table to {profile_field} and {profile_values} to {profile_value}.
 */
function profile_update_7001() {
  db_rename_table('profile_fields', 'profile_field');
  db_rename_table('profile_values', 'profile_value');
}

So the first step in solving this would be to rename the tables.

pfrenssen’s picture

Title: I have problem with revenue sharing » D7 version of Revenue Sharing module still uses D6 table names
Assigned: » Unassigned
Status: Needs review » Active
StatusFileSize
new1.98 KB

Here is a very simple patch that just corrects the table names. This should make the error message "base table not found" error go away, but it will probably be replaced by another error. The code of the Revenue Sharing module still uses the D6 database model.

I have not had the time to test this so feedback is welcome.

monil-dupe’s picture

Title: D7 version of Revenue Sharing module still uses D6 table names » I have problem with revenue sharing
Assigned: Unassigned »
Status: Active » Needs review

Thanks a lot pfrenssen for your help. Only in one case in revenue_sharing_basic.module it was needed that i change the code to the new one you said. But after doing that, i get another error which is:

Fatal error: Call to undefined function db_fetch_object() in /home/public_html/sites/all/modules/adsense/old/revenue_sharing_basic/revenue_sharing_basic.admin.inc on line 148

Whats your suggestion for fixing it?

monil-dupe’s picture

I didn't apply patch yet as i don't know how to do this :) I only changed the php code to the style you said and i got an error on line 145 as i said :(

pfrenssen’s picture

Yes that was to be expected. The module needs to be ported to the new database model in D7. The instructions for this are here: A completely new database API has been added.

The error you are receiving can be solved by following the instructions under "Iterating a result set from db_query()":

// Drupal 6
while ($record = db_fetch_object($result)) {
  // Do stuff with $record, which is an object
}

// Drupal 7
foreach ($result as $record) {

  // Do stuff with $record, which is an object
}
pfrenssen’s picture

Like this :) Patch untested.

monil-dupe’s picture

Thanks a lot for this patch. Unfortunately i can't apply the patch because i don't have the required program for applying patch. You helped a lot for fixing this module.
I faced another problem and it should be moved to Drupal 7 structure but i can't do it even using the guide page you linked. Please have a look at this code and share how to move this Drupal 6 code to Drupal 7 please if you have time:

$types = node_get_types();
  foreach ($types as $type => $name) {
    $form['content_types']['revenue_sharing_basic_node_type_'. $type] = array(
      '#type'          => 'checkbox',
      '#title'         => $name->name,
      '#default_value' => variable_get('revenue_sharing_basic_node_type_'. $type, REVENUE_SHARING_BASIC_NODE_TYPE_DEFAULT),
    );
  }
monil-dupe’s picture

I changed this line :
$types = node_get_types();
To this one:

node_type_clear();
$types = node_type_get_types();

But it give errors.
Also i changed that to this one too:
$name = node_type_get_name($node);
or even to:
$name = node_type_get_name();
And i get 500 internal error.
I am confused.

monil-dupe’s picture

I get one error on reports too on this line of code:
$profile_list[$row->fid] = $row->title;

jcnventura’s picture

Status: Needs review » Fixed

I've just committed to dev the initial port of revenue sharing in D7. I'd appreciate if you could test it.

Status: Fixed » Closed (fixed)

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

Enes’s picture

Revenue sharing does not work. I did all what was said.
But adsense earnings reports do not appear.

The authors reflected in earnings.

>>>>>>>>>>>HELP

jcnventura’s picture

Is there a URL to this site?

Enes’s picture

Ok
Site: ankaakademi.com

Please help.

Thanks;

jcnventura’s picture

You seem to be using managed ads only. As specified in the description of the "revenue sharing option":

DOES NOT WORK with new code ad units, such as "Managed Ads" or "Custom Search"

Also, edit your email in the above post, unless you're interested in receiving more spam.

Enes’s picture

Viewing Ads.
But not a revenue-sharing among authors.

Image: http://g1205.hizliresim.com/x/r/6kfx5.png

How do revenue sharing?

jcnventura’s picture

Revenue sharing only works with the "old" ad formats.. You have to enable and configure those modules, and replace your current ads with the ones using the old format.

Enes’s picture

How could you tell me what to do painting?
I work for a week. But could not.
https://code.google.com/apis/console/ # project: 741036191298: access
There is also such a thing.

jcnventura’s picture

The adsense API is only for large accounts.. I don't have access to that API to test it.

jcnventura’s picture

Issue summary: View changes

I mentioned in text that its a bug and should be fixed.