[RC1] Thank Post by User v0.3.2

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.
teman
Registered User
Posts: 145
Joined: Fri Mar 21, 2008 5:50 pm

Re: [RC1] Thank Post by User v0.3.2

Post by teman »

sorry ,on your .txt installation guide you mentioned to find modcp.php,i can't find this file.did you mean mcp.php?
never pleased become the leader!!!
ask me for any symbian issues at
http://gsmvolt.com and see our rank here
alexi02
Registered User
Posts: 271
Joined: Fri Mar 05, 2004 2:15 am
Location: Australia
Contact:

Re: [RC1] Thank Post by User v0.3.2

Post by alexi02 »

For phpBB2 it should be modcp.php, looks like you might be using a different version though mcp.php sounds like it.
Tuning
Registered User
Posts: 11
Joined: Wed Mar 26, 2008 12:20 am

Re: Re:

Post by Tuning »

Hi
that would like would list looks in such a way

Image

Here is my Code

Code: Select all

 // 
        // Start Top 5 Thanked Users 
        // 

        $sql = "SELECT t.thanked_user, u.username 
                FROM forum_thanksmod t LEFT JOIN " . USERS_TABLE . " u 
                ON t.thanked_user = u.user_id 
                WHERE thanked_user <> " . ANONYMOUS . " 
                ORDER BY thanked_user DESC"; 

        if ( !($result = $db->sql_query($sql)) ) { 
           message_die(GENERAL_ERROR, 'Could not query users table', '', __LINE__, __FILE__, $sql); 
        } 

        $thanked_count = 1; 
        $old_user_id = 0; 
        $x = 0; 
        while ($row = mysql_fetch_array($result)) { 
           $user_id = $row['thanked_user']; 
           $username = $row['username']; 

           if ($row['thanked_user'] != $old_user_id) { 
              $thanked_count = 0; 
              $x++; 
           } 

           $old_user_id = $row['thanked_user']; 
           $thanked_count++; 

           $thankslist[$x]['count'] = $thanked_count; 
           $thankslist[$x]['user_id'] = $user_id; 
           $thankslist[$x]['username'] = $username; 
        } 

        rsort($thankslist); 


        for ($x = 0; $x < 10; $x++) { 

           if ($thankslist[$x]['user_id']) { 
              if ($x >= 1) { $top_5_thanked_users .= "<br /> "; } 

              // Add user to thanked list 
              $temp_url = "profile.$phpEx?mode=viewprofile&u=" . $thankslist[$x]['user_id']; 
              $top_5_thanked_users .= '<a href="' . $temp_url . '">' . $thankslist[$x]['username'] . '</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (' . $thankslist[$x]['count'] . ')'; 
           } 
        } 


        // 
        // End Top 5 Thanked Users 
        //
Helpme Pls
Tuning
Registered User
Posts: 11
Joined: Wed Mar 26, 2008 12:20 am

Re: [RC1] Thank Post by User v0.3.2

Post by Tuning »

Hello , Helpme PLS :oops:
Tuning
Registered User
Posts: 11
Joined: Wed Mar 26, 2008 12:20 am

Re: [RC1] Thank Post by User v0.3.2

Post by Tuning »

Hello Helpme :!: :!: :!:
james1111
Registered User
Posts: 15
Joined: Fri Jun 06, 2008 2:16 am

Re: [RC1] Thank Post by User v0.3.2

Post by james1111 »

Hi,

I noticed that you changed the sql information from:

Code: Select all

ALTER TABLE `phpbb_posts` ADD `thanks_count` MEDIUMINT( 8 ) NOT NULL DEFAULT '0';
ALTER TABLE `phpbb_posts` ADD `thanks_from_user_id` TEXT NULL;
ALTER TABLE `phpbb_users` ADD `user_thanks_received` MEDIUMINT( 8 ) NOT NULL DEFAULT '0';
ALTER TABLE `phpbb_users` ADD `user_thanks_given` MEDIUMINT( 8 ) NOT NULL DEFAULT '0';
to

Code: Select all

CREATE TABLE `phpbb_thanksmod` (
  `post_id` mediumint(8) unsigned NOT NULL default '0',
  `thanked_user` mediumint(8) NOT NULL default '0',
  `thanks_by` mediumint(8) NOT NULL default '0',
  `thanked_time` int(10) NOT NULL default '0'
);
In this post http://www.phpbb.com/community/viewtopi ... 0#p3233853 where you gave us the codes to have a list of topics who have thanked a user in their profile, you used the sql query from the old sql information.

I was wondering if you can help modify the codes from http://www.phpbb.com/community/viewtopi ... 0#p3233853 to work with the current (v0.3.2) sql information?

thank you!
alexi02
Registered User
Posts: 271
Joined: Fri Mar 05, 2004 2:15 am
Location: Australia
Contact:

Re: [RC1] Thank Post by User v0.3.2

Post by alexi02 »

Hi,

Please follow all changes which are specified in the posts you have linked to and then please open user_viewprofile.php, remove any Thank Post by User code before$avatar_img = '';

Find

Code: Select all

$avatar_img = '';
Before Add:

Code: Select all

//
// Start Thank Post by User Mod
//

// Thanks by
$sql = "SELECT COUNT(thanks_by) AS thanks_by
        FROM phpbb_thanksmod
        WHERE thanks_by = '" . $profiledata['user_id'] . "'";

if ( !($result = $db->sql_query($sql)) ) {
  message_die(GENERAL_ERROR, "Could not obtain thanks information", '', __LINE__, __FILE__, $sql);
}

$thanks_by_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

// Thanked user
$sql = "SELECT post_id, thanked_user
       FROM phpbb_thanksmod
       WHERE thanked_user = '" . $profiledata['user_id'] . "'
       ORDER BY post_id";

if ( !($result = $db->sql_query($sql)) ) {
  message_die(GENERAL_ERROR, "Could not obtain thanks information", '', __LINE__, __FILE__, $sql);
}

// Calculate the user's thanks given and thanks received
$thanked_count = 0;
$thanked_posts = 0;
$old_post_id = 0;
while ($row = mysql_fetch_array($result)) {
  if ($row['post_id'] != $old_post_id) {
     $thanked_posts++;
  }
  $old_post_id = $row['post_id'];
  $thanked_count++;
}

$temp_url = "profile.$phpEx?mode=viewprofile&u=" . $profiledata['user_id'] . "&thankslist=1";
$thanks_given = $thanks_by_row['thanks_by'];
$thanks_received = '<a href="' . $temp_url . '">' .  $thanked_count . ' ' . $lang['Thanks_thanked_2'] . ' ' . $thanked_posts . ' ' . $lang['Thanks_thanked_3'] . '</a>';

//
// End Thank Post by User Mod
//

// Thanks Listing
if ( isset($HTTP_GET_VARS['thankslist']) || $HTTP_GET_VARS['thankslist'] ) {

  // Thanked Listing SQL
  $sql = "SELECT *
          FROM phpbb_thanksmod
          WHERE thanked_user = '" . $profiledata['user_id'] . "'";

  if ( !($result = $db->sql_query($sql)) ) {
     message_die(GENERAL_ERROR, "Could not obtain posts information", '', __LINE__, __FILE__, $sql);
  }

  $thanked_listing = $db->sql_fetchrowset($result);
  $db->sql_freeresult($result);
  $thanked_listing_count = count($thanked_listing);

  // Loop through all users who thanked the post
  for ($x = 0; $x < $thanked_listing_count; $x++) {

      // Users SQL
      $sql = "SELECT user_id, username
              FROM " . USERS_TABLE . "
              WHERE user_id = " . $thanked_listing[$x]['thanks_by'];

      if ( !($result = $db->sql_query($sql)) ) {
         message_die(GENERAL_ERROR, "Could not obtain user information", '', __LINE__, __FILE__, $sql);
      }

      $user_row = $db->sql_fetchrow($result);
      $db->sql_freeresult($result);


      // Posts SQL
      $sql = "SELECT topic_id
             FROM " . POSTS_TABLE . "
             WHERE post_id = " . $thanked_listing[$x]['post_id'];

        if ( !($result = $db->sql_query($sql)) ) {
           message_die(GENERAL_ERROR, "Could not obtain user information", '', __LINE__, __FILE__, $sql);
        }

        $post_topic_row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);

            // Topic SQL
        $sql = "SELECT topic_title
                FROM " . TOPICS_TABLE . "
                WHERE topic_id = '" . $post_topic_row['topic_id'] . "'";

        if ( !($result = $db->sql_query($sql)) ) {
           message_die(GENERAL_ERROR, "Could not obtain user information", '', __LINE__, __FILE__, $sql);
        }

        $topic_row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);


        $temp_url_post = "viewtopic.$phpEx?p=" . $thanked_listing[$x]['post_id'] . "#" . $thanked_listing[$x]['post_id'];
        $temp_url_topic = "viewtopic.$phpEx?t=" . $post_topic_row['topic_id'];
        $thanks_post = '<a href="' . $temp_url_post . '"> (Post #' . $thanked_listing[$x]['post_id'] . ')</a>';
        $thanks_topic = '<a href="' . $temp_url_topic . '">' . $topic_row['topic_title'] . '</a>';
        $thanks_listing .= "Thanked by " . $user_row['username'] . " in $thanks_topic - $thanks_post<br/>";
  }

}

$template->assign_block_vars('thankslist', array(
'THANKS_LISTING' => $thanks_listing,
'L_THANKS_LISTING' => "Thanks Listing")
);
It's quickly written code which should work.
AcuteAngel
Registered User
Posts: 26
Joined: Wed Jan 14, 2009 7:24 pm

Re: [RC1] Thank Post by User v0.3.2

Post by AcuteAngel »

Hi,
I'm new in this forum and I need your help guys. I make a forum using a free phpBB3 template with a directory of http://www.domain.com/phpBB3 but I wish to to put a "Thank You" button which that I have found in this forum.
My question is... can someone guide me of how to install it in my board or my phpBB3 template?
I've already installed 3 different templates Acidtech_Tiger, eTech, & Hermes.
Which folder do I need to upload the "Thank You" folder and which file do I need to edit?

Thank in Advance
alexi02
Registered User
Posts: 271
Joined: Fri Mar 05, 2004 2:15 am
Location: Australia
Contact:

Re: [RC1] Thank Post by User v0.3.2

Post by alexi02 »

This Thanks mod is for phpBB2. Try this one for phpBB3.
Post Reply

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