[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.
djvini
Registered User
Posts: 91
Joined: Sun Sep 04, 2005 1:55 pm
Location: Sheffield, UK
Contact:

Re: [BETA] Thank Post by User 0.2.6

Post by djvini » Fri Nov 16, 2007 11:09 am

Sweet, good job, simple and easy fix. Many thanks!!

Another question has popped up, is it possible to allow users to 'thank themselves'... I've actually tried to turn the system into an attendance function, so people can say if they're attending a session or not. And it would be beneficial to have a 'thanks' button on every first post of a topic regardless of who posted it.

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

Re: [BETA] Thank Post by User 0.2.6

Post by alexi02 » Tue Dec 04, 2007 2:39 pm

To allow users to thank themselves:

In viewtopic

Find

Code: Select all

$thanks_img = '';

        if ( ($userdata['session_logged_in']) && ($userdata['user_id'] != $poster_id) ) {
Replace with

Code: Select all

$thanks_img = '';

        if ($userdata['session_logged_in']) {

In thanks.php

Remove these lines

Code: Select all

// If the user isn't the user who made the post
         if ($userdata['user_id'] != $post_row['poster_id']) {
Remove these lines

Code: Select all

         }
         else {
            $l_message = $lang['Thanks_self'];
         }

helene50
Registered User
Posts: 1
Joined: Mon Mar 10, 2008 5:48 pm
Contact:

Re: [BETA] Thank Post by User 0.2.6

Post by helene50 » Mon Mar 10, 2008 5:53 pm

Hello, alexi!
At my test forum this MOD is work not correctly… do not printing string {postrow.thanks.L_THANKS_TEXT}: {postrow.thanks.THANKS_USERS}

UPD for all have this trouble
alexi02 wrote: And if your viewtopic_body.tpl has the <!-- BEGIN thanks --> and <!-- END thanks -->.
Yes!!! That is it! (I have deleted this comments before, in troubleshooting process :oops: )
Delighted!!!! Great thanks!

User avatar
cacc
Registered User
Posts: 20
Joined: Sat Nov 11, 2006 5:13 pm
Location: Toronto, Ontario
Contact:

Re: [BETA] Thank Post by User 0.2.6

Post by cacc » Tue Mar 18, 2008 4:14 am

Is this mod going to be updated for use with phpBB 3.0?

Tuning
Registered User
Posts: 11
Joined: Wed Mar 26, 2008 12:20 am

Re: [BETA] Thank Post by User 0.2.6

Post by Tuning » Wed Mar 26, 2008 12:24 am

Hallo
Wie kann ich das über Admin Panel ein und ausschalten, Gibst dafür einen Addon?

How can I switch over Admin the panel off and, do give for it a Addon?


MFG

Tumbo
Registered User
Posts: 294
Joined: Wed Jun 01, 2005 7:20 pm
Location: Malmo/Sweden
Contact:

Re: [BETA] Thank Post by User 0.2.6

Post by Tumbo » Thu Mar 27, 2008 12:53 pm

Oh I've been searching for this mod sooo long!!

Thank you so much!


Btw, is there any way of making a stat module, where you can see the most thanked users?

Tumbo
Registered User
Posts: 294
Joined: Wed Jun 01, 2005 7:20 pm
Location: Malmo/Sweden
Contact:

Re: [BETA] Thank Post by User 0.2.6

Post by Tumbo » Thu Mar 27, 2008 2:09 pm

- Is there a possibility tho skip the "Confirmation"/"Popup" window that you have Thanked a post? I mean. If you thank, your named ads in the bottom, and that's it.

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

Re: [BETA] Thank Post by User 0.2.6

Post by alexi02 » Thu Mar 27, 2008 3:36 pm

Tumbo wrote:- Is there a possibility tho skip the "Confirmation"/"Popup" window that you have Thanked a post? I mean. If you thank, your named ads in the bottom, and that's it.
The quick way to 'kind' of skip the confirmation page is to go to includes/subSilver/thanks.tpl, find the first line:

Code: Select all

<meta http-equiv="refresh" content="5;URL={U_BACK_LINK}"> 
and change to

Code: Select all

<meta http-equiv="refresh" content="0;URL={U_BACK_LINK}"> 

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

Re: [BETA] Thank Post by User 0.2.6

Post by alexi02 » Fri Mar 28, 2008 5:24 am

I've had a request from a user to be able to modify which forums can have this mod displayed in, so I'll post it here if anyone else wants to use it.

To have the thanks only be displayed in the forums you specify please follow the changes below.
You will be able to Enable / Disable the thanks via the ACP -> Forum Admin -> Management. It will say "Thanks Allowed?" and you can select Yes or No. The current status is shown by being bold.

In an SQL query tool of you choice (change the phpbb_ to suit your table prefix)

Code: Select all

ALTER TABLE `phpbb_forums` ADD `thanks_enabled` SMALLINT( 1 ) NOT NULL ;

In admin/admin_forums.php

Find

Code: Select all

                case 'forum_sync':
                        sync('forum', intval($HTTP_GET_VARS[POST_FORUM_URL]));
                        $show_index = TRUE;

                        break;
After Add

Code: Select all

                case 'thanks_yes':
                        $forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]);
                        $sql = "UPDATE " . FORUMS_TABLE . "
                                SET thanks_enabled = '1'
                                WHERE forum_id = $forum_id";
                        if( !$result = $db->sql_query($sql) )
                        {
                                message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql);
                        }

                        $show_index = TRUE;

                        break;

                case 'thanks_no':
                        $forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]);
                        $sql = "UPDATE " . FORUMS_TABLE . "
                                SET thanks_enabled = '0'
                                WHERE forum_id = $forum_id";
                        if( !$result = $db->sql_query($sql) )
                        {
                                message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql);
                        }

                        $show_index = TRUE;

                        break;
Find (near the EOF)

Code: Select all

$template->assign_block_vars("catrow.forumrow",
Before Add

Code: Select all

                                $thanks_enabled = 'Yes';
                                $thanks_disabled = "<b>No</b>";

                                if ($forum_rows[$j]['thanks_enabled'] == 1) {
                                   $thanks_enabled = "<b>Yes</b>";
                                   $thanks_disabled = "No";
                                }
Find

Code: Select all

'U_FORUM_MOVE_DOWN' => append_sid("admin_forums.$phpEx?mode=forum_order&move=15&" . POST_FORUM_URL . "=$forum_id"),
After Add

Code: Select all

                                        'THANKS_ENABLED' => $thanks_enabled,
                                        'THANKS_DISABLED' => $thanks_disabled,
                                        'U_FORUM_THANKS_YES' => append_sid("admin_forums.$phpEx?mode=thanks_yes&" . POST_FORUM_URL . "=$forum_id"),
                                        'U_FORUM_THANKS_NO' => append_sid("admin_forums.$phpEx?mode=thanks_no&" . POST_FORUM_URL . "=$forum_id"),

In templates/subSilver/admin/forum_admin_body.tpl

Find

Code: Select all

<th class="thHead" colspan="7">{L_FORUM_TITLE}</th>
Replace with

Code: Select all

<th class="thHead" colspan="8">{L_FORUM_TITLE}</th>
Find

Code: Select all

<td class="catRight" align="center" valign="middle"><span class="gen">&nbsp;</span></td>
Replace with

Code: Select all

       <td class="cat" align="center" valign="middle" nowrap="nowrap"><span class="gen">&nbsp;</span></td>
       <td class="catRight" align="center" valign="middle"><span class="gen">Thanks Allowed?</span></td>
Find

Code: Select all

<td class="row2" align="center" valign="middle"><span class="gen"><a href="{catrow.forumrow.U_FORUM_RESYNC}">{L_RESYNC}</a></span></td>
After Add

Code: Select all

<td class="row1" align="center" valign="middle"><span class="gen"><a href="{catrow.forumrow.U_FORUM_THANKS_YES}">{catrow.forumrow.THANKS_ENABLED}</a> <a href="{catrow.forumrow.U_FORUM_THANKS_NO}">{catrow.forumrow.THANKS_DISABLED}</a></span></td>
Find

Code: Select all

        <tr>
                <td colspan="7" class="row2"><input class="post" type="text" name="{catrow.S_ADD_FORUM_NAME}" /> <input type="submit" class="liteoption"  name="{catrow.S_ADD_FORUM_SUBMIT}" value="{L_CREATE_FORUM}" /></td>
        </tr>
        <tr>
                <td colspan="7" height="1" class="spaceRow"><img src="../templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
        </tr>
        <!-- END catrow -->
        <tr>
                <td colspan="7" class="catBottom"><input class="post" type="text" name="categoryname" /> <input type="submit" class="liteoption"  name="addcategory" value="{L_CREATE_CATEGORY}" /></td>
        </tr>
Replace with

Code: Select all

        <tr>
                <td colspan="8" class="row2"><input class="post" type="text" name="{catrow.S_ADD_FORUM_NAME}" /> <input type="submit" class="liteoption"  name="{catrow.S_ADD_FORUM_SUBMIT}" value="{L_CREATE_FORUM}" /></td>
        </tr>
        <tr>
                <td colspan="8" height="1" class="spaceRow"><img src="../templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
        </tr>
        <!-- END catrow -->
        <tr>
                <td colspan="8" class="catBottom"><input class="post" type="text" name="categoryname" /> <input type="submit" class="liteoption"  name="addcategory" value="{L_CREATE_CATEGORY}" /></td>
        </tr>

In viewtopic.php

Find

Code: Select all

$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
Replace with

Code: Select all

$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments, f.thanks_enabled" . $count_sql . "
Find

Code: Select all

$forum_id = intval($forum_topic_data['forum_id']);
After Add

Code: Select all

$thanks_forum_enabled = intval($forum_topic_data['thanks_enabled']);
Find

Code: Select all

if ( ($userdata['session_logged_in']) && ($userdata['user_id'] != $poster_id) ) {
Replace with

Code: Select all

if ( ($userdata['session_logged_in']) && ($userdata['user_id'] != $poster_id) && $thanks_forum_enabled == 1) {
Find

Code: Select all

if ($postrow[$i]['user_id'] != ANONYMOUS) {
Replace with

Code: Select all

if ($postrow[$i]['user_id'] != ANONYMOUS && $thanks_forum_enabled == 1) {
Find

Code: Select all

if ($postrow[$i]['thanks_count'] >= 1) {
Replace with

Code: Select all

if ($postrow[$i]['thanks_count'] >= 1 && $thanks_forum_enabled == 1) {
Last edited by alexi02 on Thu Apr 03, 2008 3:01 am, edited 2 times in total.

Tumbo
Registered User
Posts: 294
Joined: Wed Jun 01, 2005 7:20 pm
Location: Malmo/Sweden
Contact:

Re: [BETA] Thank Post by User 0.2.6

Post by Tumbo » Fri Mar 28, 2008 8:14 am

Another request, to make this mod really perfect, would be:

When you click on the number next to "Thanked", there should be a new page opening, where you can see for example the 20 Latest "Thank You's" of people that Thanked you, and then get link to which posts it comes from.
For example, like vBulletin has:
Image

User avatar
CiberRed
Registered User
Posts: 4
Joined: Sun Aug 05, 2007 7:28 am
Location: Mexico
Contact:

Re: [BETA] Thank Post by User 0.2.6

Post by CiberRed » Fri Mar 28, 2008 12:40 pm

Hi,

your MOD Thank Post by User 0.2.6 is compatible with the MOD Color Groups v1.2.1???

EXCUSES I DO NOT SPEAK ENGLISH !!
Last edited by CiberRed on Sat Mar 29, 2008 5:42 am, edited 1 time in total.

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

Re: [BETA] Thank Post by User 0.2.6

Post by alexi02 » Fri Mar 28, 2008 2:15 pm

CiberRed wrote:your MOD Thank Post by User 0.2.6 is compatible with the MOD Color Groups v1.2.1???
It should run with the Mod Color Groups but it won't use anything from that mod. To incorporate your own colors into the thanked users follow the step below. You can then add more cases for different user levels or you could change the $user_row['user_level'] variable with something else to suit your needs.

In viewtopic.php

Find

Code: Select all

if ($x >= 1) { $thanked_by .= ", "; }

             // Add user to thanked by list
             $temp_url = "profile.$phpEx?mode=viewprofile&u=" . $user_row['user_id'];
             $thanked_by .= '<a href="' . $temp_url . '">' . $user_row['username'] . '</a>';
Replace with

Code: Select all

switch ( $user_row['user_level'] )
             {
                case ADMIN:
                        $poster_name = '<b>' . $poster . '</b>';
                        $style_color = ' style="color:#' . $theme['fontcolor3'] . '"';
                        break;
                case MOD:
                        $poster_name = '<b>' . $poster . '</b>';
                        $style_color = ' style="color:#' . $theme['fontcolor2'] . '"';
                        break;
                default:
                        $poster_name = $poster;
                        $style_color = '';
                        break;
             }


             if ($x >= 1) { $thanked_by .= ", "; }

             // Add user to thanked by list
             $temp_url = "profile.$phpEx?mode=viewprofile&u=" . $user_row['user_id'];
             $thanked_by .= '<a href="' . $temp_url . '"' . $style_color . '>' . $user_row['username'] . '</a>';

Tuning
Registered User
Posts: 11
Joined: Wed Mar 26, 2008 12:20 am

Re: [BETA] Thank Post by User 0.2.6

Post by Tuning » Fri Mar 28, 2008 6:07 pm

It functioned unfortunately, the Mod does not laest itself not or out switches.

Das Mod läst sich leider über Admin Panel nicht ein oder aus schalten.

I can switch however over phpmyadmin and out. Whom mod out is become thanks and the information also not indicated, which should thanks and the information from the user already is indicated also whom thanks out is.

Ich kann das aber über phpmyadmin ein und aus schalten wen ich die tabellen werte änderer.

Wen das mod aus ist werden die thanks und die infos auch nicht angezeigt, die thanks und die infos von dem user sollten schon angezeigt werden auch wen das thanks für dieser Forum aus ist.
Last edited by Tuning on Sun Mar 30, 2008 10:18 pm, edited 1 time in total.

Tuning
Registered User
Posts: 11
Joined: Wed Mar 26, 2008 12:20 am

Re: [BETA] Thank Post by User 0.2.6

Post by Tuning » Sun Mar 30, 2008 10:16 pm

Kann jemand bitte meine Problem auf englisch übersetzen, Ich glaube der Mod macher versteht mich nicht, Ich habe das bei astlavista übersetzen lassen. das ist nicht so toll mit online übersetzung.

MFG

Tumbo
Registered User
Posts: 294
Joined: Wed Jun 01, 2005 7:20 pm
Location: Malmo/Sweden
Contact:

Re:

Post by Tumbo » Wed Apr 02, 2008 11:13 am

I tried this on the eZportal. It worked, but it got repeated 5 times.. Any ideas why?
alexi02 wrote:
apocan wrote: can we show how much a user thanked in index page

e.g:top 5 thanked users...


This should work.

Open index.php

Find

Code: Select all

        $is_auth_ary = array();
        $is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);
After Add

Code: Select all

        //
        // Start Top 5 Thanked Users
        //

        $lang['Top_5_thanked'] = 'Top 5 thanked users';

        $sql = "SELECT user_id, username, user_thanks_received
                FROM " . USERS_TABLE . "
                WHERE user_id <> " . ANONYMOUS . "
                ORDER BY user_thanks_received DESC";

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

        $row = $db->sql_fetchrowset($result);
        $db->sql_freeresult($result);
        $row_count = count($row);

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

           if ($row[$x]['user_id']) {
           if ($x >= 1) { $top_5_thanked_users .= ", "; }

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

        //
        // End Top 5 Thanked Users
        //
Find

Code: Select all

                'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'),
After Add

Code: Select all

                'L_TOP_5_THANKED_TEXT' => $lang['Top_5_thanked'],
                'L_TOP_5_THANKED_USERS' => $top_5_thanked_users,

Open templates/subSilver/index_body.tpl

Find

Code: Select all

<td class="row1" align="center" valign="middle" rowspan="2"><img src="templates/subSilver/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td>
Replace with

Code: Select all

<td class="row1" align="center" valign="middle" rowspan="3"><img src="templates/subSilver/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td>
Find

Code: Select all

  <tr>
        <td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE} &nbsp; [ {L_WHOSONLINE_ADMIN} ] &nbsp; [ {L_WHOSONLINE_MOD} ]<br />{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td>
  </tr>
After Add

Code: Select all

  <tr>
        <td class="row1" align="left"><span class="gensmall">{L_TOP_5_THANKED_TEXT}: {L_TOP_5_THANKED_USERS}</span></td>
  </tr>

Post Reply

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

Who is online

Users browsing this forum: No registered users and 12 guests