[RC] Thanks for post by Палыч

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!
Anti-Spam Guide
User avatar
knmt
Registered User
Posts: 110
Joined: Fri Aug 29, 2008 10:13 am
Contact:

Re: [RC] Thanks for post by Палыч

Post by knmt »

As I said earlier you should use the way search.php handles search results for thanklist.php :'P

Okay, I will post the language pack, soon ;)
User avatar
Палыч
Registered User
Posts: 1543
Joined: Sun Jul 01, 2007 7:59 pm
Location: St. Petersburg
Name: Сергей
Contact:

Re: [RC] Thanks for post by Палыч

Post by Палыч »

zach'
This is done specifically to reduce the load
I'll try to fix
Sorry for my bad english
User avatar
Палыч
Registered User
Posts: 1543
Joined: Sun Jul 01, 2007 7:59 pm
Location: St. Petersburg
Name: Сергей
Contact:

Re: [RC] Thanks for post by Палыч

Post by Палыч »

knmt wrote:As I said earlier you should use the way search.php
I decide that I should? 8-) :D :D
Sorry for my bad english
User avatar
Kamahl19
Registered User
Posts: 1598
Joined: Tue Nov 06, 2007 3:33 pm
Location: Slovakia
Name: Martin
Contact:

Re: [RC] Thanks for post by Палыч

Post by Kamahl19 »

I was using Geoffreak's MOD but when many users were online and they thank a much, it was getting me DB errors and hosting shuted me down. Are these problems with allocating many memmory etc solved? :)

and what about an DB upgrade? can i upgrade the thanks from geoffreaks mod to this?
turbopanel
Registered User
Posts: 1
Joined: Fri May 29, 2009 7:26 am

Re: [RC] Thanks for post by Палыч

Post by turbopanel »

I want users with minimum 20 posts can thank you. Please help me ?

Thank you very much.
usenet2you
Registered User
Posts: 407
Joined: Sat Mar 22, 2008 7:31 pm
Location: The Netherlands

Re: [RC] Thanks for post by Палыч

Post by usenet2you »

Is it possible to thank only the first post??

nvm, I have tweaked it:

OPEN includes/functions_thanks.php

SEARCH

Code: Select all

	$sql_array = array(
		'SELECT'	=> 'p.post_id, p.poster_id',
		'FROM'		=> array (POSTS_TABLE => 'p'),
		'WHERE'		=> "p.post_id = $post_id");
	$sql = $db->sql_build_query('SELECT', $sql_array);
	$result = $db->sql_query($sql);
	$row = $db->sql_fetchrow($result);
If you could not find it, please search in words, it's around line 73.

REPLACE with

Code: Select all

	$sql = 'SELECT p.poster_id, t.topic_id
	FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t
    WHERE p.post_id = ' . $post_id . '
      AND p.post_id = t.topic_first_post_id';     
    $result = $db->sql_query($sql);
    $row = $db->sql_fetchrow($result);
    $db->sql_freeresult($result);
SEARCH

Code: Select all

WHERE post_id = $post_id AND user_id = " . $user->data['user_id'];
REPLACE with

Code: Select all

WHERE user_id = " . $user->data['user_id'];
Remember, if you could not find it, please search in words, it's around line 122.

OPEN viewtopic.php

SEARCH

Code: Select all

'S_FORUM_THANKS'	=> ($auth->acl_get('f_thanks', $forum_id)) ? true : false,
ADD after

Code: Select all

		'S_FIRST_POST'      => ($row['post_id'] == $topic_data['topic_first_post_id']) ? true : false,
OPEN prosilver/template/viewtopic_body.html

SEARCH

Code: Select all

<!-- ELSEIF postrow.S_IS_OWN_POST and not postrow.THANKS -->
ADD after

Code: Select all

<!-- ELSEIF not postrow.S_FIRST_POST -->

Enjoy!
User avatar
Палыч
Registered User
Posts: 1543
Joined: Sun Jul 01, 2007 7:59 pm
Location: St. Petersburg
Name: Сергей
Contact:

Re: [RC] Thanks for post by Палыч

Post by Палыч »

Kamahl19 wrote:I was using Geoffreak's MOD but when many users were online and they thank a much, it was getting me DB errors and hosting shuted me down. Are these problems with allocating many memmory etc solved? :)
I hope so 8-)
and what about an DB upgrade? can i upgrade the thanks from geoffreaks mod to this?
yes
Sorry for my bad english
User avatar
Палыч
Registered User
Posts: 1543
Joined: Sun Jul 01, 2007 7:59 pm
Location: St. Petersburg
Name: Сергей
Contact:

Re: [RC] Thanks for post by Палыч

Post by Палыч »

turbopanel wrote:I want users with minimum 20 posts can thank you. Please help me ?

Thank you very much.
I do not think that this is the right way. There is a MOD AutoGroup that automatically add users to group, depending on the number of posts. And this group, you can determine any rights, which would like, including gratuities.
Sorry for my bad english
User avatar
Палыч
Registered User
Posts: 1543
Joined: Sun Jul 01, 2007 7:59 pm
Location: St. Petersburg
Name: Сергей
Contact:

Re: [RC] Thanks for post by Палыч

Post by Палыч »

usenet2you wrote:Is it possible to thank only the first post??

nvm, I have tweaked it:
You may have to simply insert a condition in the file viewtopivc_body.html before the conclusion of the buttons thanks

Code: Select all

		<!-- IF not START and postrow.S_ROW_COUNT == 0 -->
Sorry for my bad english
usenet2you
Registered User
Posts: 407
Joined: Sat Mar 22, 2008 7:31 pm
Location: The Netherlands

Re: [RC] Thanks for post by Палыч

Post by usenet2you »

Палыч wrote:
usenet2you wrote:Is it possible to thank only the first post??

nvm, I have tweaked it:
You may have to simply insert a condition in the file viewtopivc_body.html before the conclusion of the buttons thanks

Code: Select all

		<!-- IF not START and postrow.S_ROW_COUNT == 0 -->
Hmm with that code, I think you can also see the thanks button on 1st post of the 2nd page. If not, yeah its much easier then lol. :P

I'll try it soon. :)
User avatar
Палыч
Registered User
Posts: 1543
Joined: Sun Jul 01, 2007 7:59 pm
Location: St. Petersburg
Name: Сергей
Contact:

Re: [RC] Thanks for post by Палыч

Post by Палыч »

usenet2you wrote:Hmm with that code, I think you can also see the thanks button on 1st post of the 2nd page. If not, yeah its much easier then lol. :P
You're right. You need to add:

Code: Select all

==open==
viewtopic.php
==find==
'PAGE_NUMBER' 	=> on_page($total_posts, $config['posts_per_page'], $start),
==after-add==
'START'			=> $start,
Sorry for my bad english
usenet2you
Registered User
Posts: 407
Joined: Sat Mar 22, 2008 7:31 pm
Location: The Netherlands

Re: [RC] Thanks for post by Палыч

Post by usenet2you »

I'll try it tommorow, thanks. :)

What about a addon: Simple Hide BBCode add-on? :) When user has thanked, it will unhide.

http://sourceforge.net/project/download ... _0.3.0.zip

I got something but it won't work,

Code: Select all

// Check if the topic viewer has posted in a topic
$unhide = false;
if ($user->data['user_id'] != ANONYMOUS)
{
   // If moderator or admin, skip reply check, auto unhide
   if ($auth->acl_get('m_', $forum_id))
   {
      $unhide = true;
   }
   else if ($thanked($user->data['user_id']))
   {
      $unhide = true;
   }
   
   else
   {
	$sql = "SELECT poster_id, topic_id 
		FROM " . POSTS_TABLE . "
		WHERE post_id = $msg_id
		AND poster_id = " . $user->data['user_id'];

	$result = $db->sql_query($sql);
	$unhide = $db->sql_affectedrows($result) ? true : false;
	$db->sql_freeresult($result);
    }	
}

This code:

Code: Select all

   else if ($thanked($user->data['user_id']))
   {
      $unhide = true;
   }

Hope you can help me.
User avatar
Палыч
Registered User
Posts: 1543
Joined: Sun Jul 01, 2007 7:59 pm
Location: St. Petersburg
Name: Сергей
Contact:

Re: [RC] Thanks for post by Палыч

Post by Палыч »

usenet2you wrote:I'll try it tommorow, thanks. :)

What about a addon: Simple Hide BBCode add-on? :) When user has thanked, it will unhide.
Hmm.. I put the mod Simple Hide BBCode, but found no conflict in viewtopic...
Sorry for my bad english
usenet2you
Registered User
Posts: 407
Joined: Sat Mar 22, 2008 7:31 pm
Location: The Netherlands

Re: [RC] Thanks for post by Палыч

Post by usenet2you »

Ni , there is no conflict. :P I want that if the user press Thank the author, it will unhide. So an add-on. :D

Code: Select all

// Check if the topic viewer has posted in a topic
$unhide = false;
if ($user->data['user_id'] != ANONYMOUS)
{
   // If moderator or admin, skip reply check, auto unhide
   if ($auth->acl_get('m_', $forum_id))
   {
      $unhide = true;
   }
   else if (already_thanked($user->data['user_id']))
   {
      $unhide = true;
   }
   
   else
   {
	$sql = "SELECT poster_id, topic_id 
		FROM " . POSTS_TABLE . "
		WHERE post_id = $msg_id
		AND poster_id = " . $user->data['user_id'];

	$result = $db->sql_query($sql);
	$unhide = $db->sql_affectedrows($result) ? true : false;
	$db->sql_freeresult($result);
    }	
}

This code:

Code: Select all

   else if (already_thanked($user->data['user_id']))
   {
      $unhide = true;
   }
but then it gives me an error.
usenet2you
Registered User
Posts: 407
Joined: Sat Mar 22, 2008 7:31 pm
Location: The Netherlands

Re: [RC] Thanks for post by Палыч

Post by usenet2you »

Палыч wrote:
usenet2you wrote:Hmm with that code, I think you can also see the thanks button on 1st post of the 2nd page. If not, yeah its much easier then lol. :P
You're right. You need to add:

Code: Select all

==open==
viewtopic.php
==find==
'PAGE_NUMBER' 	=> on_page($total_posts, $config['posts_per_page'], $start),
==after-add==
'START'			=> $start,
won't work, you can thank the 2nd only instead of the 1st only, and I even think the user will be able to thank other posts then the 2nd one with your modification for this, simple change post_id. With my modification you wouldn't be able to thank the 2nd post.

Can you have a look at my Hide add-on, so if the user press on the thanks button, the hide will unhide.

When I use already_thanked in viewtopic.php, it will give me an error, why? With Geofreak's thanks MOD was that code enough, but here it won't work.

Code: Select all

// Check if the topic viewer has posted in a topic
$unhide = false;
if ($user->data['user_id'] != ANONYMOUS)
{
   // If moderator or admin, skip reply check, auto unhide
   if ($auth->acl_get('m_', $forum_id))
   {
      $unhide = true;
   }
   else if (already_thanked($user->data['user_id']))
   {
      $unhide = true;
   }
   
   else
   {
	$sql = "SELECT poster_id, topic_id 
		FROM " . POSTS_TABLE . "
		WHERE post_id = $msg_id
		AND poster_id = " . $user->data['user_id'];

	$result = $db->sql_query($sql);
	$unhide = $db->sql_affectedrows($result) ? true : false;
	$db->sql_freeresult($result);
    }	
}
This code:

Code: Select all

   else if (already_thanked($user->data['user_id']))
   {
      $unhide = true;
   }
Locked

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