News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Hide Tag Special

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

Previous topic - Next topic

YoProPool

Quote from: ディン1031 on October 11, 2009, 01:46:01 AM
Quote from: YoProPool on October 10, 2009, 05:29:52 PM
Quote from: ディン1031 on October 10, 2009, 02:38:05 PM
Quote from: YoProPool on October 09, 2009, 07:19:58 PM
If anyone can modify the script to have 3 or more options would be excellent.
For now my only request is to know how can I change the TAG. [hide] to [hide=whatever]
After that I will see how to install the same scrip 3 or more times to set up different configuration to each one.

thanks for the reply.
Hmm difficult very difficult :X.

It's not done with a 3 time copy, you need create a hole new mod for each versions... because all variables need to be changed for this, too. It's never be created so that he should used in diffrent tag ways. Also it was never planed to be have diffrent hide tag options.   
You need also change some other files to detect correct edits and and and ;).

There is a price I can pay for that job?
Hmmm than sent me a exact description via pm what the mod should do after the changes. Than i will tell you if i can do it or not. At the moment i would say i can't making it because of some time problems ;).


I do not know if this way would be easier.
If it were possible to simply associate the number after... "Hide=xxx" to the amount of Karma / posts, necessary to view content. That would be far more useful to me.
And from the admin panel choose whether the number will refer, to Karma or Posts, or whatever.

I really appreciate the attention. Many thx

ディン1031

#1141
I think you want something like
[hide Karma=10 Posts=10], And this should rewrite the current settings of minimum posts?

Hmmm difficult... i want never insert it because it's to heavy to insert. But i will see... possible there is a way... even if don't like it...

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

YoProPool

That would be just awesome. If you do that I will be eternally grateful.

ディン1031

Quote from: YoProPool on October 12, 2009, 02:24:31 AM
That would be just awesome. If you do that I will be eternally grateful.
So for 1.8.5 the change.

Search in Subs.php for
Code (search for) Select

if ($modSettings['hide_preparedOption']['auto_unhide_parser'])
$context['user_post_avaible'] = 1;

Code (replace with) Select

if ($modSettings['hide_preparedOption']['auto_unhide_parser'])
$context['user_post_avaible'] = 1;

/*
This add some speical options to the hide tag.
[hide=OPTION]
The option change the output so that a diffrent setup for the post is avaible.
!!!Please beware only the first found option will be used as master all other will be ignored!!!
Use on own risk and it's complete untested :P
*/
$reset_hide_tage_special = false;
$old_user_post_avaible = $context['user_post_avaible'];
if ((!isset($context['user_post_avaible']) || empty($context['user_post_avaible'])) && hideTagExists($message, $cache_id) && !$user_info['is_guest'])
{
/*
This array work in follow way (it's casesensitv)
[hide=NAME]XXXX[/hide]

'NAME' => array(
'minimum_karma' => 0,
// True disable the karma check (needed becuase negativ values are possible) (true or false)
'disable_karma_check' => false,
'minimum_posts' => 0,
// True disable the post check (true or false)
'disable_posts_check' => false,
// Should all valid to see the hidden content or only one? (true or false)
'one_to_enable_unhidden_content' => true,
);
If not the minimum_posts set than he disable the posts check the same goes for karma.
Standard for one_to_enable_unhidden_content is true
*/
static $special_hide_setup_array;

if (!isset($special_hide_setup_array))
{
$special_hide_setup_array = array(
'test' => array(
'minimum_karma' => 10,
'disable_karma_check' => true,
'minimum_posts' => 2,
'disable_posts_check' => false,
'one_to_enable_unhidden_content' => true,
),
);

// Load the current Member Data 1 time, i need it ;).
global $ID_MEMBER;
loadMemberData($ID_MEMBER);
loadMemberContext($ID_MEMBER);
}

// Okay how the Hardcore check, trust me... this everthing but not server friendly :P
preg_match_all("~\[hide.*?\]~", $message, $matches);

if (!empty($matches[0]))
{
foreach ($matches[0] as $item)
{
$item_splited = explode('=', substr($item, 0, -1));
// So rewiten Setups... seems to be done
if (!empty($item_splited[1]) && isset($special_hide_setup_array[$item_splited[1]]))
{
// First he is not allowed to see this post!
$context['user_post_avaible'] = 0;

global $memberContext;
$current_hide_setup = $special_hide_setup_array[$item_splited[1]];

// Standard Setup :)
$current_hide_setup['disable_karma_check'] = !isset($current_hide_setup['disable_karma_check']) ? !isset($current_hide_setup['minimum_karma']) : (bool) $current_hide_setup['disable_karma_check'];
$current_hide_setup['disable_posts_check'] = !isset($current_hide_setup['disable_posts_check']) ? !isset($current_hide_setup['minimum_posts']) : (bool) $current_hide_setup['disable_posts_check'];
$current_hide_setup['one_to_enable_unhidden_content'] = !isset($current_hide_setup['one_to_enable_unhidden_content']) ? true : (bool) $current_hide_setup['one_to_enable_unhidden_content'];

$karmaOK = false;
$postOK = false;
if (!$current_hide_setup['disable_posts_check'])
{
print_r($current_hide_setup);
$postOK = $user_info['posts'] >= (int) $current_hide_setup['minimum_posts'];
if ($postOK && $current_hide_setup['one_to_enable_unhidden_content'])
$reset_hide_tage_special = true;
}
if (!$reset_hide_tage_special && !$current_hide_setup['disable_karma_check'])
{
if ($karmaOK && $current_hide_setup['one_to_enable_unhidden_content'])
$reset_hide_tage_special = true;
elseif($karmaOK && $postOK && !$current_hide_setup['one_to_enable_unhidden_content'])
$reset_hide_tage_special = true;
}

if($reset_hide_tage_special)
$context['user_post_avaible'] = 1;

// Okay hardcore fix :P
$message = preg_replace("~\[hide.*?\]~", "[hide]", $message);

// Sorry the first one only will work... i can't unhide it seperate...
break;
}
}
}
}

Code (search for) Select

// Okay i need to add the unhidden information at the end of the post :)
elseif (!empty($context['user_post_avaible']) && !empty($modSettings['hide_onlyonetimeinfo']) && !empty($modSettings['hide_enableUnhiddenText']) && hideTagExists($message, $cache_id))
$message .= '[br]'.$modSettings['hide_preparedOption']['unhiddentext'];

Code (replace with) Select

// Okay i need to add the unhidden information at the end of the post :)
elseif (!empty($context['user_post_avaible']) && !empty($modSettings['hide_onlyonetimeinfo']) && !empty($modSettings['hide_enableUnhiddenText']) && hideTagExists($message, $cache_id))
$message .= '[br]'.$modSettings['hide_preparedOption']['unhiddentext'];

// Disable it after the change?
if($reset_hide_tage_special)
$context['user_post_avaible'] = $old_user_post_avaible;


How to extent the options or change them, read the comments. The settings for this are hard coded :P.
The change will make it possible to use [hide=test] and it will change the options for karma and posts ;).

I give not warranty that this work correct, use is on own risk!
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

magnitude2007

how to permanantly disabled the HideTagSpecial185_Fix mod

Arantor

To disable any mod, go to the Package Manager and uninstall it.

magnitude2007

#1146
Quote from: Arantor on October 18, 2009, 08:03:58 AM
To disable any mod, go to the Package Manager and uninstall it.
i just want to show the hidden content to guests also  but i didnt find how to disable it for a short time to promote the site without any hidden contents

Arantor

Ah, you didn't make it clear that was what you wanted to do.

There is no facility for that, other than uninstalling then reinstalling the mod, I believe. Maybe the author could add it to a later version.

ɔɔɔɔɔɔuɥoɾ

There is a setting option called
"Allowed Groups to see a hidden content without posting:"
You can check off guests in there then they can see the hidden content.

If you wish to upgrade to newer version, DIN 1031 has made it so no uninstall it necessary, just run the newer installer and click upgrade.


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

magnitude2007

Quote from: ♪ JohnCcCcCc ♫ on October 18, 2009, 10:42:08 AM
There is a setting option called
"Allowed Groups to see a hidden content without posting:"
You can check off guests in there then they can see the hidden content.

If you wish to upgrade to newer version, DIN 1031 has made it so no uninstall it necessary, just run the newer installer and click upgrade.

thanks for quick reply the guest option is not available in allowed group to see a hidden content do i also need to remove the php code from the files manually to upgrade to newer version.

ɔɔɔɔɔɔuɥoɾ

Depending on which version you have installed currently, you may not even need to uninstall, there may be a simple upgrade mod :)


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

magnitude2007

Quote from: ♪ JohnCcCcCc ♫ on October 19, 2009, 02:36:06 PM
Depending on which version you have installed currently, you may not even need to uninstall, there may be a simple upgrade mod :)

thanks john

SafariMan

   
After installing when I try to access the forum is a blank page, what can I do?
www.proilusion.com [nofollow]

ディン1031

Quote from: SafariMan on October 24, 2009, 01:32:30 PM
   
After installing when I try to access the forum is a blank page, what can I do?
Are you sure that it happen evertime after you installed the modifcation? Normal the mod do not change so much that the forum take to long to load oO.
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

jaisi

hide tag install secsefully but when i aplly i got this Error
Installations actions for "Hide Tag":
The package you are trying to download or install is either corrupt or not compatible with this version of SMF. 

My forum version is Powered by SMF 2.0 RC1.2  now please tell me how can i uninstall this mod uninstall option is not showing there are only tow option delete and all file


Thanks

Arantor

Select version 2.0 RC1 from the parse options instead. The code is the same, just the package parser doesn't accept the code used for 2.0 RC1.2 (and really, nor should it)

ɔɔɔɔɔɔuɥoɾ

Quote from: jaisi on October 28, 2009, 09:49:40 AM
hide tag install secsefully but when i aplly i got this Error
Installations actions for "Hide Tag":
The package you are trying to download or install is either corrupt or not compatible with this version of SMF. 

My forum version is Powered by SMF 2.0 RC1.2  now please tell me how can i uninstall this mod uninstall option is not showing there are only tow option delete and all file


Thanks
"Warning - while you were typing a new reply has been posted. You may wish to review your post.                           "
Arantor, beat me to it.
___________________________________________________________________________________________________
It would appear (based on your description) that the mod never got installed. If the options available are Apply Mod and Delete, then the mod is not installed, or the package manager is detecting it as uninstalled anyway.
As for why its giving you that message, I cant see why, but you could try downloading another version there are specific versions of the mod for every version of SMF.


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

Arantor

I believe the mod site parser now uses the same base code as 2.0 RC2 does, and it doesn't like mods using previous workarounds such as 2.0 - 2.0.99 to accept 2.0 versions, which is why you get errors on packages that say 2.0 RC1.2 compliant but won't be parseable.

ディン1031

Strange... normal it should be installable on RC1.2 oO on my test system the Version 2.3.5 detect the SMF Version correct. I've only the problems with the upgrade there the detection is not correct... But if you use RC1 as compatible mode it should work, too. The code is not changed and it should work, too. Only if you use RC2 than the mod will not work ;). (Never updated it, because the RC2 is not public at the moment) ;)

And i do not use the 2.0-2.0.99 =)
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

scorpion1082

  if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img>')) === '') 

this failed on install for me.  im using 236 for my 2.0 rc 1.2.  should i use a different version or something?  i would manually install it, but im not on the server side, im just a forum admin who deals with all the forum stuff.

Advertisement: