News:

SMF 2.1.2 has been released! Take it for a spin! Read more.

Main Menu

Hide Tag Special

Started by enik, April 11, 2005, 03:41:07 PM

Previous topic - Next topic

fortest

Quote from: ディン1031 on September 11, 2007, 06:00:36 AM
At least yes it is possible to auto unhide it after a karma von +20 (or enable the option that it unhide after post). No this is not possible at the moment, it's possible to integrate but not easy to make :x leaf's hide post work in a complete diffrent way to my mod ;).

I will look at the code at evening and tell if it possible or not :x.

I've actually tried Leaf's Hide Post mod, but there are some bugs where the hidden content could be seen even if the member doesn't have enough post/karma... e.g. the search result or using reply with quote will reveal the hidden content.
Leaf hasn't been active for months now, so I don't know if he'll ever fix the bugs.
I was checking your mod, and I thought that it would be amazing if somehow the features of Hide Tag Special and Hide Post could be combined...

Quote from: ディン1031 on September 11, 2007, 06:00:36 AM
But i need some infos, you would like to have a special amount of karma after he reach this karma he can see the hidden content after the post, or do you like that the user can see it each time after he reach this karma?

I'd like that the member can see the hidden content as long as he has 20 or more karma... If his karma dropped to 19, then he won't be able to see the hidden content...

Quote from: ディン1031 on September 11, 2007, 06:00:36 AM
Second question the post count related thing, you mean for example [hide post=10][/hide] <- need 10 posts to unhidde, or you mean something with karma?

Bye
DIN1031

I was thinking both actually... so the poster can choose between e.g.
[hide post=10][/hide] <- need 10 posts to unhide
OR
[hide karma=20][/hide] <- need +20 karma to unhide


Thanks again DIN1031.

ディン1031

QuoteI was thinking both actually... so the poster can choose between e.g.
[hide post=10][/hide] <- need 10 posts to unhide
OR
[hide karma=20][/hide] <- need +20 karma to unhide

And a last question that i forget XD, you mean full unhide without posting?

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

fortest

Quote from: ディン1031 on September 12, 2007, 01:28:01 AM
And a last question that i forget XD, you mean full unhide without posting?

Bye
DIN1031

Yes. :)

ディン1031

For the Karma Options i will release a new version of the mod that include this :), but for the post thing i will give you the code with that you can do this... my problem with the karma there is that you need to load the karma values out of the database if you use the parse function and somehow i don't like to use sql querys in the parser... but i will make it for you and it will be you choice to use it ;). But first i make the Upgrade of the Mod for the karma options.

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

fortest

Ok... thanks a lot, DIN1031...
looking forward to the new version of your mod...  :D

ディン1031

Quote from: fortest on September 12, 2007, 07:30:26 AM
Ok... thanks a lot, DIN1031...
looking forward to the new version of your mod...  :D
Version 1.7.0 (12.09.07)
+ Add Some Karma Options, only if Karma enabled
+ Auto Unhide Karma Options
+ Minimum to Unhide Karma
+ Some small Option
! Insert a redirect for better user handling
- Upgrade included, Language Upgrades for Turkish, English and German included ;)

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

fortest

#626
wow that was quick...
Thanks a lot for being so helpful...  :D

Just a little question, though...
If I want all members with 20 or more karma to be able to automatically see the hidden content without posting in that thread, what numbers should I set in "Minmum karma count to allow unhide content" and "Minmum karma count to unhide content without posting"?
Should I set them both to 20?

kamili34


ディン1031

Quote from: fortest on September 12, 2007, 05:33:03 PM
wow that was quick...
Thanks a lot for being so helpful...  :D

Just a little question, though...
If I want all members with 20 or more karma to be able to automatically see the hidden content without posting in that thread, what numbers should I set in "Minmum karma count to allow unhide content" and "Minmum karma count to unhide content without posting"?
Should I set them both to 20?
The first one to 20 ;) than he can not see it until than and the other too 20 than it auto unhide :)

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

fortest

Quote from: ディン1031 on September 12, 2007, 06:02:23 AM
For the Karma Options i will release a new version of the mod that include this :), but for the post thing i will give you the code with that you can do this... my problem with the karma there is that you need to load the karma values out of the database if you use the parse function and somehow i don't like to use sql querys in the parser... but i will make it for you and it will be you choice to use it ;). But first i make the Upgrade of the Mod for the karma options.

Bye
DIN1031

So... any update yet on this code?

ディン1031

I will prog it at the evening when my forum is working after the server move ;).

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

ディン1031

#631
Quote from: Puka on September 18, 2007, 05:40:03 AM
Hi,

I've noticed if You used Hide tags that everybody can see the hide information in the code of the browser.
[hide][url]http://.....[ /url][.....

Now, is there a possibility or mod that you can use

[hide][click here[/url..........

I've noticed that you can't see the hidden information in the code

I use SMF 1.1.3
?_? i totally understand nothing... can you give a better discription that it unhidden ?_? normal it's not possible :X... give me in a [nobbc][/nobbc] a complete version of the insert that is not removed... because with the ........ i don't know how the end look like...

And i tried it, and it's not possible to see it in the code, only if you allowed to see it ;P.

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

fortest

Quote from: ディン1031 on September 14, 2007, 02:58:19 AM
I will prog it at the evening when my forum is working after the server move ;).

Bye
DIN1031

Hi, Din1031... So, how's that code coming along? Any estimated release date maybe?
Thanks, and sorry if I'm bugging you...

ディン1031

Quote from: fortest on September 19, 2007, 10:05:23 PM
Quote from: ディン1031 on September 14, 2007, 02:58:19 AM
I will prog it at the evening when my forum is working after the server move ;).

Bye
DIN1031

Hi, Din1031... So, how's that code coming along? Any estimated release date maybe?
Thanks, and sorry if I'm bugging you...
At the moment i have a lot of other problems and work at my office and came back until late night and i don't feel like it to solve this.

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

asdas2

just a small and simple quest ..... i install this mod sucessfully .... but i cant see any button for thie hide tag .........

how du u install button for that ......
www.chillparadise.com

for all desi people .... get everything u ever wanted.... log in to view hidden stuff.

kamili34

Put this buton in your thame bbc catalog.

ディン1031

Or use the installer for a Button is attached to the first post ;).

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

asdas2

www.chillparadise.com

for all desi people .... get everything u ever wanted.... log in to view hidden stuff.

ディン1031

#638
Quote from: fortest on September 19, 2007, 10:05:23 PM
Quote from: ディン1031 on September 14, 2007, 02:58:19 AM
I will prog it at the evening when my forum is working after the server move ;).

Bye
DIN1031

Hi, Din1031... So, how's that code coming along? Any estimated release date maybe?
Thanks, and sorry if I'm bugging you...
So i'm finished:

USE THIS ON YOUR OWN RISK, NO SUPPORT OR ANYTHING and Make a backup of the file before you change it!

This code change make follow Changes:
Now you can use [hide karma=10 posts=10 autounhide=1 needall=1]
Karma minimum value to unhide content after post
Posts minimum value to unhide content after post
Autounhide if this set to 1 it will unhide after you reach one of the given things
Needall if this set to 1 it will need both value to be valid that it unhide the content.

It can only one of the value given ;) karma or post this will work, too. But it will work also normal without any of the items.


<edit file>
$sourcedir/Subs.php
</edit file>

<search for>
// For old stuff still using doUBBC()...
function doUBBC($message, $enableSmileys = true)
{
return parse_bbc($message, $enableSmileys);
}
</search for>

<replace>
// For old stuff still using doUBBC()...
function doUBBC($message, $enableSmileys = true)
{
return parse_bbc($message, $enableSmileys);
}

function parse_hiddenContent($message) {
global $context, $modSettings, $user_info, $db_prefix, $ID_MEMBER;
static $karma;

//Hidden Content?
if(preg_match("/\[hide\](.+?)\[\/hide\]/i", $message) == 0 && preg_match("/\[hide(.+?)\](.+?)\[\/hide\]/i", $message) == 0) {
return $message;
}

//I remove the content for guests... sorry but this is needed now...
if($user_info['is_guest']) {
$message = preg_replace("/\[hide\](.+?)\[\/hide\]/i", (empty($modSettings['hide_onlyonetimeinfo']) ? $modSettings['hide_preparedOption']['hiddentext'] : "&nbsp"), $message);
$message = preg_replace(array('~\n?\[hide.*?\].+?\[/hide\]\n?~is', '~^\n~', '~\[/hide\]~'), (empty($modSettings['hide_onlyonetimeinfo']) ? $modSettings['hide_preparedOption']['hiddentext'] : "&nbsp"), $message);
return $message;
}

//Some Options are not possible any more for example the show one time option!
$modSettings['hide_onlyonetimeinfo'] = 0; //Must be disabled for this Function!

//Here i remove this content :) or show onetime unhide info :)
if(!isset($context['user_post_avaible']) || empty($context['user_post_avaible'])) {
//Remove it the standard things first :)
$message = preg_replace("/\[hide\](.+?)\[\/hide\]/i", (empty($modSettings['hide_onlyonetimeinfo']) ? $modSettings['hide_preparedOption']['hiddentext'] : "&nbsp"), $message);
}

//So now welcome to the special part ;D
if(preg_match("/\[hide(.+?)\](.+?)\[\/hide\]/i", $message) != 0) {
//First exatract all hidden contents ;D
$found = preg_match_all("/\[hide(.+?)\](.+?)\[\/hide\]/i", preg_replace("/\[hide\](.+?)\[\/hide\]/i", "", $message), $hiddenContent, PREG_SET_ORDER);

if(empty($found) || $found === false)
return $message;

foreach($hiddenContent as $hiddenItem) {
//Extract the it :)
$hiddenValues = array();
$hiddenItems = explode(' ', $hiddenItem[1]);
$found = false;
foreach($hiddenItems as $possible) {
if(empty($possible))
continue;

$searchItem = explode('=', $possible);
if(in_array(strtolower($searchItem[0]), $modSettings['hide_preparedOption']['tag_possibles'])) {
if(empty($searchItem[0]) || empty($searchItem[1]))
continue;
$hiddenValues[strtolower($searchItem[0])] = (int) $searchItem[1];
}
}
//Nothing allowed used?
if(empty($hiddenValues) && (!isset($context['user_post_avaible']) || empty($context['user_post_avaible']))) {
$message = str_replace($hiddenItem[0], (empty($modSettings['hide_onlyonetimeinfo']) ? $modSettings['hide_preparedOption']['hiddentext'] : "&nbsp"), $message);
continue;
}
elseif(empty($hiddenValues)) //Do not go further... nothing to check here ;)
continue;

//Okay the easies the posts ;D
$allowedToSeePosts = false;
$allowedToSeeKarma = false;
$autoUnhide = isset($hiddenValues['autounhide']) && $hiddenValues['autounhide'] == 1;
$needAll = isset($hiddenValues['needall']) && $hiddenValues['needall'] == 1 && isset($hiddenValues['posts']);

if(isset($hiddenValues['posts']) && $hiddenValues['posts'] > 0) {
//Let's check if the user is allowed to see it after the post :)
if($user_info['posts'] > $hiddenValues['posts']) {
$allowedToSeePosts = true;
}
elseif(!$needAll && isset($hiddenValues['karma'])) {
$allowedToSeePosts = false;
}
else {
$message = str_replace($hiddenItem[0], (empty($modSettings['hide_onlyonetimeinfo']) ? $modSettings['hide_preparedOption']['hiddentext'] : "&nbsp"), $message);
continue;
}
}

if(isset($hiddenValues['karma']) && (!$allowedToSeePosts || ($allowedToSeePosts && $needAll))) {
//Okay prepare some Data for this user :)
if(!isset($karma)) {
$request = db_query("
SELECT karmaGood as good, karmaBad as bad
FROM {$db_prefix}members
WHERE ID_MEMBER = ".$ID_MEMBER."
LIMIT 1", __FILE__, __LINE__);

$karmaValues = mysql_fetch_assoc($request);
mysql_free_result($request);

if(!empty($modSettings['hide_onlykarmagood']))
$karma = $karmaValues['good'];
else
$karma = $karmaValues['good'] - $karmaValues['bad'];
}
if($hiddenValues['karma'] < $karma)
$allowedToSeeKarma = true;
else {
$message = str_replace($hiddenItem[0], (empty($modSettings['hide_onlyonetimeinfo']) ? $modSettings['hide_preparedOption']['hiddentext'] : "&nbsp"), $message);
continue;
}
}

//Need all valid?
if($needAll)
$allowedToSee = $allowedToSeePosts && $allowedToSeeKarma;
else
$allowedToSee = $allowedToSeePosts || $allowedToSeeKarma;

//Okay Auto Unhide or remove? ;)
if($allowedToSee && $autoUnhide) {
continue;
}
if($allowedToSee && !isset($context['user_post_avaible']) || empty($context['user_post_avaible'])) {
$message = str_replace($hiddenItem[0], (empty($modSettings['hide_onlyonetimeinfo']) ? $modSettings['hide_preparedOption']['hiddentext'] : "&nbsp"), $message);
}
}
}

return $message;
}
</replace>

<search for>
$modSettings['hide_preparedOption']['parse_content'] = !empty($modSettings['hide_enableUnhiddenText']) && empty($modSettings['hide_onlyonetimeinfo']);
</serach for>

<replace>
$modSettings['hide_preparedOption']['parse_content'] = !empty($modSettings['hide_enableUnhiddenText']) && empty($modSettings['hide_onlyonetimeinfo']);

//Prepare the Special Options =D
$modSettings['hide_preparedOption']['tag_possibles'] = array(
'posts',
'autounhide',
);
//Karma is only possible if it enabled
if(!empty($modSettings['karmaMode'])) {
$modSettings['hide_preparedOption']['tag_possibles'][] = 'karma';
$modSettings['hide_preparedOption']['tag_possibles'][] = 'needall'; //This Function is usefull to check both items to be valid :)
}
</replace>

<serach for>
if((empty($context['user_post_avaible']) || !isset($context['user_post_avaible'])) && !empty($modSettings['hide_onlyonetimeinfo'])) {
//Okay some more things to do, i must check if there a hidden content... without i need do nothing ;)
if(preg_match("/\[hide\](.+?)\[\/hide\]/i", $message) != 0 || preg_match("/\[hide(.+?)\](.+?)\[\/hide\]/i", $message) != 0) {
//Add the Hidden Text at the end of the post :)
$message .= '[br]'.$modSettings['hide_preparedOption']['hiddentext'];
}
}
//Here i remove this content :) or show onetime unhide info :)
if(!isset($context['user_post_avaible']) || empty($context['user_post_avaible'])) {
//Remove it ;D
$message = preg_replace("/\[hide\](.+?)\[\/hide\]/i", (empty($modSettings['hide_onlyonetimeinfo']) ? $modSettings['hide_preparedOption']['hiddentext'] : "&nbsp"), $message);
$message = preg_replace(array('~\n?\[hide.*?\].+?\[/hide\]\n?~is', '~^\n~', '~\[/hide\]~'), (empty($modSettings['hide_onlyonetimeinfo']) ? $modSettings['hide_preparedOption']['hiddentext'] : "&nbsp"), $message);
}
elseif(!empty($context['user_post_avaible']) && !empty($modSettings['hide_onlyonetimeinfo']) && !empty($modSettings['hide_enableUnhiddenText'])) {
//Okay i need to add the unhidden information at the end of the post :)
if(preg_match("/\[hide\](.+?)\[\/hide\]/i", $message) != 0 || preg_match("/\[hide(.+?)\](.+?)\[\/hide\]/i", $message) != 0) {
$message .= '[br]'.$modSettings['hide_preparedOption']['unhiddentext'];
}
}
</search for>

<replace>
$message = parse_hiddenContent($message);
</replace>

<search for>
array(
'tag' => 'hide',
'before' => $modSettings['hide_preparedOption']['before_info'],
'after' => $modSettings['hide_preparedOption']['after_info'],
'block_level' => true,
),
</serach for>

<replace>
array(
'tag' => 'hide',
'before' => $modSettings['hide_preparedOption']['before_info'],
'after' => $modSettings['hide_preparedOption']['after_info'],
'block_level' => true,
),
array(
'tag' => 'hide',
'parameters' => array(
'karma' => array('optional' => true),
'posts' => array('optional' => true),
'needall' => array('optional' => true),
'autounhide' => array('optional' => true),
),
'before' => $modSettings['hide_preparedOption']['before_info'],
'after' => $modSettings['hide_preparedOption']['after_info'],
'block_level' => true,
),
</replace>

<search for>
//So i parse now the unhidden bbc code one time ;)
if($modSettings['hide_preparedOption']['parse_content']) {
$modSettings['hide_preparedOption']['parse_content'] = false;
if(isset($bbc_codes['h'])) {
foreach($bbc_codes['h'] as $key => $item) {
if($item['tag'] == 'hide') {
$bbc_codes['h'][$key]['before'] = parse_bbc($item['before']);
$bbc_codes['h'][$key]['after'] = parse_bbc($item['after']);
break;
}
}
}
}
</serach for>

<replace>
//So i parse now the unhidden bbc code one time ;)
if($modSettings['hide_preparedOption']['parse_content']) {
$modSettings['hide_preparedOption']['parse_content'] = false;
if(isset($bbc_codes['h'])) {
foreach($bbc_codes['h'] as $key => $item) {
if($item['tag'] == 'hide') {
$bbc_codes['h'][$key]['before'] = parse_bbc($item['before']);
$bbc_codes['h'][$key]['after'] = parse_bbc($item['after']);
}
}
}
}
</replace>


I can give no warranty that this add on work 100% correct ;)

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

fortest

Thanks a million, DIN1031... :D
Helpful people like you is one of the main reason why SMF is so great...
Very much appreciated. I'll give it a try and heed your warning to be careful.

cheers. :D

Advertisement: