News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Yet Another Spoiler Mod

Started by dougiefresh, December 21, 2017, 09:38:22 AM

Previous topic - Next topic

StarredSkies

Any developments on nested spoilers (spoilers within spoilers)? I've been using this modification for awhile but I'm disappointed to say that this is one feature we're really missing out on here. :(

m4z

"Faith is what you have in things that don't exist."
--Homer Simpson

Es gibt hier im Forum ein deutsches Support-Board!

m4z

This is probably another side of the same coin.
"Faith is what you have in things that don't exist."
--Homer Simpson

Es gibt hier im Forum ein deutsches Support-Board!

Arantor

-sigh- Please stop blaming mod authors for core bugs.

m4z

It wasn't on purpose, I just didn't grasp your reply until you wrote this and this. :-*
"Faith is what you have in things that don't exist."
--Homer Simpson

Es gibt hier im Forum ein deutsches Support-Board!

Varti

#25
Hi,

thanks for this mod, I have installed it as I needed a tag to make a link hidden to unregistered users on my forum, I'm now using the spoiler one with the guests=no parameter in order to have some links hidden to unregistered users.

I have found a bug with the latter, on SMF 2.0.17: when using the guests=no parameter and viewing a post as a guest, the Login and Register links in the You must login or register to view this Spoiler! text are broken. They are set as e.g.
https://www.myforum.org/{scripturl}?action=login
https://www.myforum.org/{scripturl}?action=register

instead of
https://www.myforum.org/?action=login
https://www.myforum.org/?action=register


I have manually fixed this by removing the {scripturl} variable in the above message, I guess it is not required there since the login and register links do not need to be called from the script's path.

Varti

SulevFan

OK, any help with this? One user, one action and 4 errors in the log? What have I messed up?


Steve

The team member that will respond to this just went on an extended vacation so be patient until she gets back.
DO NOT pm me for support!

SulevFan

it's fine, I switched us over to another spoiler mod. Fortunately there was one that seems to work just fine.

Steve

This one hasn't been upgraded to work with 2.1.2 which is probably why you got the errors.
DO NOT pm me for support!

Dave J

Does anyone know where to see which members used the function?
If you want quizzes to add to the new SMF2.1 quiz mod go here . There are also walkthroughs in the forum to explain how to install them and other tips.

Senkusha

Does anybody have a solution to this?

You cannot view this attachment.
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

Diego Andrés

Looks related to language strings, did the language file upload correctly?

SMF Tricks - Free & Premium Responsive Themes for SMF.

Senkusha

Yeah.  It's in the Default theme languages folder.
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

Tyrsson

Can you post the relevant function that surrounds the lines from those error messages from their Subs-YASM.php file?
PM at your own risk, some I answer, if they are interesting, some I ignore.

Senkusha

function YASM_Validate(&$tag, &$data, &$disabled)
{
global $txt, $user_info, $modSettings, $smcFunc, $context, $scripturl;

// Are the contents empty?  Then don't show anything to the user:
if (empty($data))
return ($tag['content'] = '');

// Parse the parameters given to us by the poster:
$name = &$tag['tag'];
list($text, $quote, $show, $hide, $guests, $expand,, $log_id) = explode('|', $tag['content']);

// If guests aren't allowed to view, then tell the user to login or register:
if ((!empty($modSettings['YASM_' . $name . '_no_guests']) || $guests == 'n' || $guests == 'no' || $guests == 'false') && !empty($user_info['is_guest']))
{
$search = array('{script_url}', '{tag_name}');
$replace = array($scripturl, $txt[$name]);
$message = str_replace($search, $replace, $txt['YASM_strings']['no_guest_html']);
}
// Otherwise.....
else
{
// Parse the parameters given to us:
$quote = $quote;
$text = empty($text) ? (empty($modSettings['YASM_' . $name . '_text']) ? $txt[$name] : stripslashes($modSettings['YASM_' . $name . '_text'])) : $text;
$show = empty($show) ? (empty($modSettings['YASM_' . $name . '_show']) ? $txt['YASM_show'] : stripslashes($modSettings['YASM_' . $name . '_show'])) : $show;
$hide = empty($hide) ? (empty($modSettings['YASM_' . $name . '_hide']) ? $txt['YASM_hide'] : stripslashes($modSettings['YASM_' . $name . '_hide'])) : $hide;
$expand = empty($expand) ? !empty($modSettings['YASM_' . $name . '_expanded']) : ($expand == 'y' || $expand == 'yes' || $expand == 'true');
$show_log = $log_id && !empty($modSettings['YASM_' . $name . '_show_log']);

// Are we allowed to log users who viewed the contents?
$limit = !empty($modSettings['YASM_' . $name . '_limit_log']) ? $modSettings['YASM_' . $name . '_limit_log'] : 0;
if (empty($log_id))
$context['YASM_users'] = array();
elseif (($context['YASM_users'] = cache_get_data('YASM_viewed_log_' . $log_id, 86400)) == NULL)
YASM_Get_Members($log_id, $limit);
$count = isset($context['YASM_users']) ? count($context['YASM_users']) : 0;
$viewed = sprintf($txt[$limit <= $count ? 'YASM_viewed_by' : 'YASM_last_viewed'], min(max(1, $limit), $count));

// If expanded and not logged, then log the user and add to the list:
if ($log_id && $expand && !isset($context['YASM_users'][$user_info['id']]))
{
YASM_Add_Member($log_id, $user_info['id'], false);
if ($show_log)
{
// Move user to front of the list, as user is most recent to view:
YASM_Get_Members($log_id, 0, $user_info['id']);
$tmp = $context['YASM_users'][$user_info['id']];
unset($context['YASM_users'][$user_info['id']]);
$context['YASM_users'] = array_shift($context['YASM_users']);
array_splice($context['YASM_users'], 0, 0, $tmp);
}
$log_id = 0;
}

// We need to parse the contents so it is readable for the user:
$data = parse_bbc($data);
}

// Build the string we are going to show the user.  The Easy-To-Read edition! :p
$style = 'YASM_' . (empty($modSettings['YASM_' . $name . '_style']) ? 'original' : $modSettings['YASM_' . $name . '_style']);
$tag['content'] =
'<div class="' . $style . '">' .
'<div class="YASM_inner' . (empty($message) && empty($modSettings['YASM_' . $name . '_no_border']) ? ' YASM_border' : '') . '">' .
'<span class="YASM_text">' . (!empty($message) ? $message : $text .
(!empty($quote) ? '<span class="YASM_quote">'. $quote . '</span> ' : '') . '</span><span class="YASM_colon">:</span> ' .
'<span class="YASM_links" onClick="YASM_toggle(this, ' . ((int) $log_id) . '); return false;" />' .
'<a href="#" onClick="return false;"' . ($expand ? ' style="display:none;"' : '') . '>' . $show . '</a>' .
'<a href="#" onClick="return false;"' . (!$expand ? ' style="display:none;"' : '') . '>' . $hide . '</a>') .
'</span>' .
'</div>' . (empty($message) ?
'<div class="YASM_content quotecontent">' .
'<div'. ($expand ? '' : ' style="display: none;"') . '>' .
'$1' . (!empty($count) && $show_log ?
'<hr class="clear" />' .
'<span class="YASM_log">' . $viewed . ': <span class="YASM_users">' . implode(', ', $context['YASM_users']) . '</span></span>' : '') .
'</div>' .
'</div>' : '') .
'</div>';

// Let's free up the context entry for users viewed:
unset($context['YASM_users']);
}

Line 164, 165, 166:
$text = empty($text) ? (empty($modSettings['YASM_' . $name . '_text']) ? $txt[$name] : stripslashes($modSettings['YASM_' . $name . '_text'])) : $text;
$show = empty($show) ? (empty($modSettings['YASM_' . $name . '_show']) ? $txt['YASM_show'] : stripslashes($modSettings['YASM_' . $name . '_show'])) : $show;
 $hide = empty($hide) ? (empty($modSettings['YASM_' . $name . '_hide']) ? $txt['YASM_hide'] : stripslashes($modSettings['YASM_' . $name . '_

Line 177:
$viewed = sprintf($txt[$limit <= $count ? 'YASM_viewed_by' : 'YASM_last_viewed'], min(max(1, $limit), $count));
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

StarredSkies

Removing this mod to test something and got this error when clicking on ANY post:
Call to undefined function YASM_preparse()
Removing it from line 1166 in Display.php works...

Just in case anyone needs this in the future.

Advertisement: