[DEV] phpBB Adsense Revenue Sharing Mod2

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
ehoward2
Registered User
Posts: 23
Joined: Fri Nov 25, 2005 6:10 pm

[DEV] phpBB Adsense Revenue Sharing Mod2

Post by ehoward2 » Fri Nov 25, 2005 10:21 pm

MOD Title: phpBB Adsense Revenue Sharing Mod2
MOD Description: Allow users to serve Adsense ads on threads they start
MOD Version: 0.03

MOD Download: DOWNLOAD 0.03

I am improving this MOD that is now considered abandoned.

It would not work with the current version of phpBB so I made it work.

I am not a programmer. I just played around until things worked. There may be security issues with what I changed. There may be security issues with the original code. This is not supported by me. I am just sharing it.

I have a demo forum with ADMIN access set up at:
http://demo.saturnet.net/phpbb/
Login: demo
Passwod: password
Last edited by ehoward2 on Sat Nov 26, 2005 5:37 pm, edited 6 times in total.

ehoward2
Registered User
Posts: 23
Joined: Fri Nov 25, 2005 6:10 pm

Post by ehoward2 » Fri Nov 25, 2005 10:26 pm

not needed anymore
Last edited by ehoward2 on Sat Nov 26, 2005 5:40 pm, edited 1 time in total.

User avatar
MHobbit
Former Team Member
Posts: 4761
Joined: Thu Mar 18, 2004 5:32 pm
Location: There and Back Again

Post by MHobbit » Fri Nov 25, 2005 10:26 pm

I, in the other thread wrote: It looks like the original author has abandoned this MOD... ThinkBling, the author, hasn't posted here since October 4, 2004. As such, I'm considering this MOD abandoned, and locking this topic.

ThinkBling, if you come back and wish to continue development of this MOD, don't hesitate to contact me regarding this.


That was the reason I locked it, obvious as it was.

Note that you really shouldn't take over this MOD without first attempting to consult the original MOD author.

Also, you need to add a topic prefix, in accordance with the MODs in Development forum rules here. In addition, you should remove the MOD install script from your post and offer it as a separate textfile download; you should also follow our MOD Template, and utilize the "MOD Author:" line rather than your custom "REVISIONS BY:" line.
Former phpBB MOD Team member
No private support is offered.
"There’s too many things to get done, and I’m running out of days..."

ehoward2
Registered User
Posts: 23
Joined: Fri Nov 25, 2005 6:10 pm

Post by ehoward2 » Fri Nov 25, 2005 10:28 pm

I have an actual working forum at http://forums.saturnet.net/phpbb/index.php

I am thinking about adding some stuff like stats, an easier way to change the percentage of userads shown and any other good ideas, on to this package and re-rolling it if there is interest.
Last edited by ehoward2 on Sat Nov 26, 2005 5:41 pm, edited 2 times in total.

ehoward2
Registered User
Posts: 23
Joined: Fri Nov 25, 2005 6:10 pm

Post by ehoward2 » Fri Nov 25, 2005 10:30 pm

I was just trying to help other people trying to get this to work.

If you want to lock or delete this, feel free to.
MennoniteHobbit wrote:
I, in the other thread wrote:It looks like the original author has abandoned this MOD... ThinkBling, the author, hasn't posted here since October 4, 2004. As such, I'm considering this MOD abandoned, and locking this topic.

ThinkBling, if you come back and wish to continue development of this MOD, don't hesitate to contact me regarding this.


That was the reason I locked it, obvious as it was.

Note that you really shouldn't take over this MOD without first attempting to consult the original MOD author.

Also, you need to add a topic prefix, in accordance with the MODs in Development forum rules here. In addition, you should remove the MOD install script from your post and offer it as a separate textfile download; you should also follow our MOD Template, and utilize the "MOD Author:" line rather than your custom "REVISIONS BY:" line.

User avatar
MHobbit
Former Team Member
Posts: 4761
Joined: Thu Mar 18, 2004 5:32 pm
Location: There and Back Again

Post by MHobbit » Fri Nov 25, 2005 10:35 pm

No, I'm not saying I want to lock this or anything. Please note what I said previously, since you intend to take over this MOD and update it for 2.0.18. :wink:
Former phpBB MOD Team member
No private support is offered.
"There’s too many things to get done, and I’m running out of days..."

Hac
Registered User
Posts: 12
Joined: Fri Nov 25, 2005 2:23 pm

Post by Hac » Sat Nov 26, 2005 1:18 am

Hey howard,
Why have you removed this line from the page_header file. I'm not that much programmer either but I think this is control structure tells the program to put the user ads on viewtopic only.

Code: Select all

 if ($PageName == "viewtopic.php" &&
      $board_config['ad_enabled'] == "1" &&
      rand(0, 1) == 1)
[quote]
The other thing is ad_profile_validate.php needs a line changed.

To post the correct userdata to the SQL database from the Profile page, you need change:

Code:

//Get the user ID.
$user_id = intval($HTTP_POST_VARS['id']);


to

Code:

//Get the user ID.
$user_id = intval($userdata['user_id'] );
[/quote]

I am still getting the SQL error. Plz somebody tell me the fiels I need to create in my DB.

Thanks for all the help. [/code]

ehoward2
Registered User
Posts: 23
Joined: Fri Nov 25, 2005 6:10 pm

Post by ehoward2 » Sat Nov 26, 2005 1:44 am

I did remove it because the variable $PageName was not getting filled.

However, if $FirstPoster is zero, it runs the default ad so I don't need the page name like the original author coded the php script to.

What SQL error are you getting?
Hac wrote: Hey howard,
Why have you removed this line from the page_header file. I'm not that much programmer either but I think this is control structure tells the program to put the user ads on viewtopic only.

Code: Select all

 if ($PageName == "viewtopic.php" &&
      $board_config['ad_enabled'] == "1" &&
      rand(0, 1) == 1)
The other thing is ad_profile_validate.php needs a line changed.

To post the correct userdata to the SQL database from the Profile page, you need change:

Code:

//Get the user ID.
$user_id = intval($HTTP_POST_VARS['id']);


to

Code:

//Get the user ID.
$user_id = intval($userdata['user_id'] );
I am still getting the SQL error. Plz somebody tell me the fiels I need to create in my DB.

Thanks for all the help. [/code]

Hac
Registered User
Posts: 12
Joined: Fri Nov 25, 2005 2:23 pm

Post by Hac » Sat Nov 26, 2005 2:01 am

This is what I'm getting on clicking the setup adsense in the user profile page:

Code: Select all

Could not select default dateformat

DEBUG MODE

SQL Error : 1146 Table 'hac_buddville.phpbb_buddad_user' doesn't exist

SELECT * FROM phpbb_buddad_user WHERE user_id = 2
Line : 26
File : ad_profile.php

ehoward2
Registered User
Posts: 23
Joined: Fri Nov 25, 2005 6:10 pm

Post by ehoward2 » Sat Nov 26, 2005 2:18 am

I don't know why it's trying to get "phpbb_buddad_user" You must have changed names around.

The struct named by the SQL commands included with the original mod created phpbb_ad_user and that's what I am still going by with the code I'm sharing.

Code: Select all

CREATE TABLE `phpbb_ad_user` (
  `user_id` mediumint(9) NOT NULL default '0',
  `ad_client_id` varchar(25) default '',
  `ad_channel` varchar(25) default '',
  PRIMARY KEY  (`user_id`)
);

I think you should do a fresh phpbb 2.0.18 install and install the mod clean to it.
Hac wrote: This is what I'm getting on clicking the setup adsense in the user profile page:

Code: Select all

Could not select default dateformat

DEBUG MODE

SQL Error : 1146 Table 'hac_buddville.phpbb_buddad_user' doesn't exist

SELECT * FROM phpbb_buddad_user WHERE user_id = 2
Line : 26
File : ad_profile.php

Hac
Registered User
Posts: 12
Joined: Fri Nov 25, 2005 2:23 pm

Post by Hac » Sat Nov 26, 2005 9:10 am

Thanks a lot for the SQL query man. It worked beuatifully. Thanks a lot. And yes I did change the prefix to phpbb_budd . And I don't need a new installation anyways coz there are so many modifications I made to the code :) Thanks a lot and keep it up. Plz check this page and tell me if you see the ads: http://timemachine.frih.net/Buddville/viewtopic.php?t=4
Last edited by Hac on Sat Nov 26, 2005 11:09 am, edited 1 time in total.

Hac
Registered User
Posts: 12
Joined: Fri Nov 25, 2005 2:23 pm

Post by Hac » Sat Nov 26, 2005 9:51 am

And I'd also like to add that in these lines:

Code: Select all

$sql = "SELECT * ".
          "FROM phpbb_users ".
           "WHERE user_id = $FirstPoster";
         
    if ( !($result = $db->sql_query($sql)) )
    {
      echo($sql);
          }
    $user_row = $db->sql_fetchrow($result);
         
    if ($user_row['user_posts'] > $board_config['ad_min_posts'])
    {

      //Get the previous settings if they exist.
      $sql = "SELECT * ".
             "FROM phpbb_ad_user ".
             "WHERE user_id = $FirstPoster";
the 'phpbb_users' and 'phpbb_ad_user links work if and only if the prefix given by the user is "phpbb_" . If you give a prefix like 'phpbb_yorname' to your tables then you should change it accordinly to the above lines.

- Hac

ehoward2
Registered User
Posts: 23
Joined: Fri Nov 25, 2005 6:10 pm

Post by ehoward2 » Sat Nov 26, 2005 5:43 pm

Hey, no problem man. I've been mooching off the open source community for too long without contributing. I'm glad it works.

:D
Hac wrote: Thanks a lot for the SQL query man. It worked beuatifully. Thanks a lot. And yes I did change the prefix to phpbb_budd . And I don't need a new installation anyways coz there are so many modifications I made to the code :) Thanks a lot and keep it up. Plz check this page and tell me if you see the ads: http://timemachine.frih.net/Buddville/viewtopic.php?t=4

Hac
Registered User
Posts: 12
Joined: Fri Nov 25, 2005 2:23 pm

Post by Hac » Sun Nov 27, 2005 5:14 am

I've been mooching off the open source community for too long without contributing.


Guess the feeling is mutual :wink: . You use any IM's BTW. Can I have your id?

User avatar
yexusbeliever
Registered User
Posts: 586
Joined: Mon Dec 08, 2003 8:49 pm
Location: Olympus phpBB3

Post by yexusbeliever » Mon Nov 28, 2005 12:47 am

Can you explain to me how this mod works? I am not getting the idea of it.

Post Reply

Return to “[2.0.x] MODs in Development”