[ABD]Advanced Hide Post 1.0.0 (From Sell Post 0.2.1)

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.
Locked
User avatar
TimeVirus
Registered User
Posts: 125
Joined: Sat Jul 12, 2003 12:17 am

Post by TimeVirus » Thu Dec 11, 2003 6:54 pm

From functions/functions_hide.php

Code: Select all

function get_hiding_info_box($hiding_info, $simple=false, $buy_action='')
{
	global $template, $lang, $phpEx;

	if ( !empty($hiding_info['type']) )
	{
		$template->set_filenames(array(
			'hidinginfo' => 'hiding_information.tpl')
		);
		
		$block_name = '';
		if ( in_array($hiding_info['type'], array('Sale', 'Fortune') ) )
		{
			if ($hiding_info['cash_prefix'])
			{
				$prefix = $hiding_info['cash_name'] . ' ';
				$postfix = '';
			}
			else
			{
				$prefix = '';
				$postfix = ' ' . $hiding_info['cash_name'];
			}
		}
		else
		{
			$prefix = '';
			$postfix = '';
		}

		switch ( $hiding_info['type'] )
		{
			case 'Sale':
				if ( empty($buy_action) )
					$buy_action = "viewtopic.$phpEx";
				if ( (!$simple) && ($hiding_info['state'] == 'Cannot_read') )
				{
					$block_name = 'selling';
					$template->assign_block_vars('selling', array(
						'L_SELL_DESCRIPTION' => $lang['Sale_info'][$hiding_info['state']],
						'L_SELLING_PRICE' => $lang['Selling_price'],
						'L_BUY' => $lang['Buy'],
						'U_POST_ID' => $hiding_info['post_id'],
						'S_BUYPOST_ACTION' => append_sid($buy_action),
						'SELLING_PRICE' => $prefix . intval($hiding_info['hiding_condition_value']) . $postfix )
					);
				}
				else
				{
					$block_name = 'bought';
					$template->assign_block_vars('bought', array(
						'L_BOUGHT_DESCRIPTION' => $lang['Sale_info'][$hiding_info['state']],
						'L_SELLING_PRICE' => $lang['Selling_price'],
						'SELLING_PRICE' => $prefix . intval($hiding_info['hiding_condition_value']) . $postfix )
					);
				}
				break;
				
			case 'Reply':
				$block_name = 'simple_hiding_box';
				$template->assign_block_vars('simple_hiding_box', array(
					'L_HIDING_DESCRIPTION' => $lang['Reply_info'][$hiding_info['state']])
				);
				break;
				
			case 'Posts':
			case 'Fortune':
				$block_name = 'simple_hiding_box';
				$template->assign_block_vars('simple_hiding_box', array(
					'L_HIDING_DESCRIPTION' => sprintf($lang[$hiding_info['type'] . '_info'][$hiding_info['state']], $prefix . intval($hiding_info['hiding_condition_value']) . $postfix) )
				);
				break;			
			
			default:
				break;
		}
		$template->assign_var_from_handle('tmpHiding', 'hidinginfo');
		if (!empty($block_name))
			unset($template->_tpldata[$block_name]);
		return $template->_tpldata['.'][0]['tmpHiding'];
	}
	else
		return '';
}  

This is from inculdes/template.php, hoping its waht you need, I dont understand php. :?

Code: Select all

	/**
	 * Root-level variable assignment. Adds to current assignments, overriding
	 * any existing variable assignment with the same name.
	 */
	function assign_var($varname, $varval)
	{
		$this->_tpldata['.'][0][$varname] = $varval;

		return true;
	}

I'm probably wrong again...

User avatar
TimeVirus
Registered User
Posts: 125
Joined: Sat Jul 12, 2003 12:17 am

Post by TimeVirus » Fri Dec 12, 2003 3:07 am

And using CyberAliens Xtrme styles mod (I just added it now) it looks like this in template.php

Code: Select all

	function assign_var($varname, $varval)
	{
		$this->vars[$varname] = $varval;

		return true;
	}
I'm probably wrong again...

shi
Registered User
Posts: 58
Joined: Fri Sep 12, 2003 7:14 am
Location: Shanghai, China
Contact:

Post by shi » Fri Dec 12, 2003 5:21 am

About the AUTH_**** constants. You don't have to change the rest to the real number. Anyway, to change it is also ok.

And I'm sorry for asking the wrong information. :oops: The codes of the function assign_block_vars in includes/template.php are exactly I want.

What's the CyberAliens Xtrme styles mod? Is it a style/template for phpBB? I never know a style will change template.php. :?:

User avatar
TimeVirus
Registered User
Posts: 125
Joined: Sat Jul 12, 2003 12:17 am

Post by TimeVirus » Fri Dec 12, 2003 5:50 am

Yes it is the only php file his mod changes. The rest are extra files you just upload. A very easy mod to apply. Extreme Styles Mod It makes your pages load faster and adds other benefits I hope to explore.

No problem about wrong info, I dont feel quite so bad for being perpetually confused about this stuff now. ;) I think its amazing you can make all this work together. :)

Here's what I think you wanted:

Code: Select all

	/**
	 * Block-level variable assignment. Adds a new block iteration with the given
	 * variable assignments. Note that this should only be called once per block
	 * iteration.
	 */
	function assign_block_vars($blockname, $vararray)
	{
		if (strstr($blockname, '.'))
		{
			// Nested block.
			$blocks = explode('.', $blockname);
			$blockcount = sizeof($blocks) - 1;
			         $str = &$this->_tpldata; 
         for ($i = 0; $i < $blockcount; $i++) 
         { 
            $str = &$str[ $blocks[$i].'.' ]; 
            $str = &$str[ sizeof($str)-1 ]; 
         } 
         // Now we add the block that we're actually assigning to. 
         // We're adding a new iteration to this block with the given 
         // variable assignments. 
         $str[ $blocks[$blockcount].'.' ][] = $vararray; 

		}
		else
		{
			// Top-level block.
			// Add a new iteration to this block with the variable assignments
			// we were given.
			$this->_tpldata[$blockname . '.'][] = $vararray;
		}

		return true;
	}
If thats not what you need just download Extreme Styles mod and look in there at his template.php. Let me know if there's anything else that would help I can provide. Oh I checked again and it does it with his template.php as well as my original.
I'm probably wrong again...

shi
Registered User
Posts: 58
Joined: Fri Sep 12, 2003 7:14 am
Location: Shanghai, China
Contact:

Post by shi » Fri Dec 12, 2003 6:05 am

TimeVirus wrote: Yes it is the only php file his mod changes. The rest are extra files you just upload. A very easy mod to apply. Extreme Styles Mod It makes your pages load faster and adds other benefits I hope to explore.


Oops, I found that there was one copy in my disk when I tried to download Extreme Styles Mod. It has been in my computer for so long. I'd better check it out later.

TimeVirus wrote: Here's what I think you wanted:

Code: Select all

$this->_tpldata[$blockname . '.'][] = $vararray;

Aha, that's it. The same reason as that in phpBB 2.0.4. Here's the solution.

User avatar
TimeVirus
Registered User
Posts: 125
Joined: Sat Jul 12, 2003 12:17 am

Post by TimeVirus » Fri Dec 12, 2003 6:29 am

Yes! That is it. Works great using points system now. So now I can tell my members they can use sell posts again and fix their old posts that may have reset.

Thanks for your help and your mod again Shi. :D
I'm probably wrong again...

shi
Registered User
Posts: 58
Joined: Fri Sep 12, 2003 7:14 am
Location: Shanghai, China
Contact:

Post by shi » Fri Dec 12, 2003 7:19 am

The following can fix the reseting issue for the old sold posts in the forum which upgrade from Sell Post to Advanced Hide Post, before your members using the new mod.

NOTE: Don't forget to backup database and correct the table prefix if it isn't phpbb_ before applying.

Code: Select all

UPDATE phpbb_posts SET hiding_type=3 WHERE hiding_condition_value<>0;
If you're using Cash MOD 2.0.x, try the following with the number 999 below replaced with actual cash id used for selling before upgrading:

Code: Select all

UPDATE phpbb_posts SET hiding_type=3, hiding_cash_id=999 WHERE hiding_condition_value<>0;

deny
Registered User
Posts: 565
Joined: Wed May 14, 2003 9:14 am
Location: Find-Ip-Address.org
Contact:

.

Post by deny » Mon Dec 15, 2003 9:13 pm

I can't find this line in posting.php (phpBB 2.0.4)

Code: Select all

#
#-----[ FIND ]---------------------------------
#
$EMBB_keys = array(''

#
#-----[ IN-LINE FIND ]---------------------------------
#
)

#
#-----[ IN-LINE BEFORE, ADD ]---------------------------------
#
,'y'

#
#-----[ FIND ]---------------------------------
#
$EMBB_widths = array(''

#
#-----[ IN-LINE FIND ]---------------------------------
#
)

#
#-----[ IN-LINE BEFORE, ADD ]---------------------------------
#
,'40'

#
#-----[ FIND ]---------------------------------
#
$EMBB_values = array(''

#
#-----[ IN-LINE FIND ]---------------------------------
#
)

#
#-----[ IN-LINE BEFORE, ADD ]---------------------------------
#
,'intro'

shi
Registered User
Posts: 58
Joined: Fri Sep 12, 2003 7:14 am
Location: Shanghai, China
Contact:

Post by shi » Tue Dec 16, 2003 1:22 am

##############################################################
## Author Notes:
## Multiple BBCode MOD should have been installed before applying this MOD.
##
## The permession of hiding a post can be set in the Permissions settings of forum, group or
## user respectivly in admin's control panel(ACP).
##
## Please set the value of AUTH_SELLPOST carefully when modifying constants.php. If you install
## the MOD with EasyMOD, please check it manually after installing.
##
## DO NOT ignore the comments of the instrucions.
##############################################################

The red line is what you need.

deny
Registered User
Posts: 565
Joined: Wed May 14, 2003 9:14 am
Location: Find-Ip-Address.org
Contact:

Hide

Post by deny » Tue Dec 16, 2003 9:24 am

I did a install your MOds without Multiple BB code (and the lines that i posted in my previosly post) and so far i can't see any fault.
Did i really need to install MUltiple BB code or this Mods can work without it.

THanks

shi
Registered User
Posts: 58
Joined: Fri Sep 12, 2003 7:14 am
Location: Shanghai, China
Contact:

Post by shi » Tue Dec 16, 2003 11:20 am

If you will not use the intro bbcode, it probably is ok. But I'm not sure since I never try that.

User avatar
TimeVirus
Registered User
Posts: 125
Joined: Sat Jul 12, 2003 12:17 am

Post by TimeVirus » Wed Dec 17, 2003 7:10 pm

Just an idea:

In Xore's Cash Mod 2.2 he has added a feature where when one member donates money to another, a PM is automatically generated so the giver doesn't need to make a post just to say there was a transaction.

I'm wondering if that feature could be accessed or an alternative way added to let owners of posts see who has viewed their post. Come to think of it, it sounds complicated and DB intensive, but I'll mention it anyways since you have been adding other cool features. ;) Maybe just for the posts that are actually sold, but not the other hide conditions.
I'm probably wrong again...

shi
Registered User
Posts: 58
Joined: Fri Sep 12, 2003 7:14 am
Location: Shanghai, China
Contact:

Post by shi » Thu Dec 18, 2003 1:18 am

Thanks for your advice! Could you post it at here?

deny
Registered User
Posts: 565
Joined: Wed May 14, 2003 9:14 am
Location: Find-Ip-Address.org
Contact:

Hide

Post by deny » Thu Dec 18, 2003 5:40 am

I've installed with BBcode other Mods and works perfect.Thanks for your great Mods.
I just would to ask you of is it possible to give user not choice.I mean if Adm. have decided for some area to use hidding post (points,selling or at least XX post) user must use it (chose one of method) or other he can't post.And it should be only for new post and not for reply.
Thanks

shi
Registered User
Posts: 58
Joined: Fri Sep 12, 2003 7:14 am
Location: Shanghai, China
Contact:

Post by shi » Thu Dec 18, 2003 12:06 pm

It's impossible to do like that with my mod. I think what you want is so rare. :lol:

Locked

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