Skip to main content
Recent Posts
91
Support / Re: Timeformat/strftime with php 8
Last post by Spuds -
I'm still chasing this one:person_running:

I did find one error which may help, or not, but it is a bug.

in Load.php find the following:
Code: [Select]
	// Allow overriding the board wide time/number formats.
if (empty($user_settings['time_format']) && !empty($txt['time_format']))
$user_info['time_format'] = $txt['time_format'];
replace it with
Code: [Select]
	// Allow overriding the board wide time/number formats.
if (empty($user_settings['time_format']) && !empty($modSettings['time_format']))
$user_info['time_format'] = $modSettings['time_format'];

The system is supposed to use the time format set in the admin panel, unless the user has set their own.  The error above would use the actual text string of Time Format instead of the system default formatting, in rare instances.

The other thing to check is if in your profile you set a custom time format
92
Addons / Re: [ADDON] SimplePortal
Last post by Ruth -
Thank you very much, Spuds.  :smiley:  I will try them...

To articles:

This 3 buttons are to see, if I look at a categorie for articles. The buttons say "read more", "reply" and "write a comment".

3 buttons.jpg

"Reply" and "write a comment" can both be used, and both do the same: There will be another comment then in this article. So I don't understand, why there are two buttons for the same result. Should the reply-button do something different?



Edit:

The smileys in shoutbox are displayed now and theme selection is also working perfect.  :smiley:  Thank you very much, Spuds!
94
Addons / Re: [ADDON] SimplePortal
Last post by Spuds -
Quote from: Ruth – 1.
This block "Theme Selection" displays each theme, which was installed once on forum. Members see them all. It would be a lot better and less confusing, if they could only see this 2 or 3 themes, they are allowed to select at the moment. Can this be changed?
Looks like a bug ... the selection list in the block was not honoring the selectable themes.   The attached ThemeSelect.block.php should fix this.  It goes in sources/subs/spblocks
Quote from: Ruth – 2.
For some reason (maybe caused by my changings in portal css) my "articles" in portal look all the same, they have the same styling. In the preview I see other backgrounds, I could select. But after saving the articles, they all will have the same background.

Another thing are the two "reply buttons" there. One tells "reply", the other one tells "write a comment". Both do the same, there will be a new comment then. Why are there two buttons?
I'm not seeing this in the article areas that have checked, so I need some more information.  I checked both portal articles and article blocks.
Quote from: Ruth – 3.
Using various backgrounds and roundframes in portal blocks is working fine. But I was not able yet to create another header for portal blocks. My tries had very funny results so far. Lol. I think, I did this wrong or I inserted the class for another header in a wrong way. How does this work? I also don't understand, what I need to insert in "Custom Title Style".
a custom style needs to be the complete set of CSS rules for that title.  As a silly example, using the following in a style profile
Code: [Select]
background: green;font-size: 2em;padding: 10px 10px 2px 10px;line-height: 1em;border: 1px solid;border-radius: 10px 10px 0 0;color: #fff;overflow: hidden;text-shadow: 4px 4px #111111;
should give you a starting point of what to do.
Quote from: Ruth – 4.
I fear, there is something wrong with the smileys on elk11, Spuds. I created a new shoutbox now, but the smileys are not displayed there in the shouts. Only the code of them is to see in shoutbox.
Oh goodie, another bug:bug:The attached PortalShoutbox.subs.php should fix that one:pleading_face:  It goes in sources/subs
95
Support / Re: Timeformat/strftime with php 8
Last post by Ruth -
I made a few more tests and created new blocks. Some only for portal and another one, which is displayed on forum and on portal.

This block "recent topics", which comes with SimplePortal, displays everything correct in portal.

But the custom php block is only displayed correct on forum. 
On portal each variant of this php-code will have "Uhr" twice and "Timeformat" instead of the time.
96
Support / Re: Timeformat/strftime with php 8
Last post by Ruth -
I don't find such a setting there, Spuds?

All I have in ACP is this:
Code: [Select]
%d. %B %Y, %H:%M %p
And i have enabled "show today and yesterday" in the settings.

Both is the same in both forums.

The two screenshots are both from elk11, the upgraded forum with the newest portal version.
The "small block" on forum displays eveything correct.
The "big block" on portal does not.



Edit:

I just created a new custom block on elk11 with this php code in it. In the preview all is displayed correct.
But it is displayed wrong then in portal....but not on forum. This is really weird.
98
Support / Re: Timeformat/strftime with php 8
Last post by Spuds -
It could be different settings in Enable shorthand date display   That setting is found in configuration - features and options - layout.  Are those different between the two forums and what are they set as? 
99
Addons / Re: [ADDON] SimplePortal
Last post by Ruth -
I am still not done with the portal....but I need to say, that I am very pleased with it.  :smiley:  Great job, Spuds!

It means some work first to do all the settings for the "profiles" for styling, permissions and visibility. But when done once, it will be very easy and fast to handle the portal and to create new blocks or to edit them...specially if more than one theme is used on forum. This with the "profiles" is a very smart and comfortable solution...I like it a lot. :smiley:

I have some questions:

1.
This block "Theme Selection" displays each theme, which was installed once on forum. Members see them all. It would be a lot better and less confusing, if they could only see this 2 or 3 themes, they are allowed to select at the moment. Can this be changed?


2.
For some reason (maybe caused by my changings in portal css) my "articles" in portal look all the same, they have the same styling. In the preview I see other backgrounds, I could select. But after saving the articles, they all will have the same background.

Another thing are the two "reply buttons" there. One tells "reply", the other one tells "write a comment". Both do the same, there will be a new comment then. Why are there two buttons?


3.
Using various backgrounds and roundframes in portal blocks is working fine. But I was not able yet to create another header for portal blocks. My tries had very funny results so far. Lol. I think, I did this wrong or I inserted the class for another header in a wrong way. How does this work? I also don't understand, what I need to insert in "Custom Title Style".


4.
I fear, there is something wrong with the smileys on elk11, Spuds. I created a new shoutbox now, but the smileys are not displayed there in the shouts. Only the code of them is to see in shoutbox.
100
Support / Re: Timeformat/strftime with php 8
Last post by Ruth -
I think, there is a problem with this custom php block, which might be caused by php 8...

Spuds and Emanuele were writing this code once for our forum.
I use it in 3 variants on forum and in portal.

Code: [Select]
global $context, $settings, $scripturl, $txt, $user_info, $modSettings, $posts, $color_profile;

$db = database();

$exclude_boards = null;

// Number of items to show
$num_recent = 25;

// Show the body preview on hover
$show_preview = true;

// Show the body preview text in the block
$show_body = false;

// Number of characters to show in the preview, 0 is all
$preview_char = 128;

// First or last message for the preview
$preview_last = false;

if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
$exclude_boards = array($modSettings['recycle_board']);
else
$exclude_boards = empty($exclude_boards) ? array() : $exclude_boards;

$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';

// If empty, no previews at all
if (empty($show_preview) && empty($show_body))
$preview_bodies = '';
// If 0 means everything
elseif (empty($preview_char))
$preview_bodies = ', ml.body AS last_body, mf.body AS first_body';
// else a SUBSTRING
else
$preview_bodies = ', SUBSTRING(ml.body, 1, ' . ($preview_char + 256) . ') AS last_body, SUBSTRING(mf.body, 1, ' . ($preview_char + 256) . ') AS first_body';

// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = $db->query('substring', '
SELECT
mf.subject,
ml.id_msg, ml.id_topic, ml.id_member, ml.poster_time,
b.id_board, b.name AS bName,
t.num_replies, t.num_views, t.id_first_msg, t.id_last_msg,
IFNULL(mem.real_name, ml.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= ml.id_msg_modified AS is_read,
IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . ', mf.smileys_enabled, mf.icon, mg.online_color' .
$preview_bodies . '
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)
INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = t.id_last_msg)
LEFT JOIN {db_prefix}boards AS b ON (b.id_board = mf.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = ml.id_member)' . (!$user_info['is_guest'] ? '
LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:current_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})' : '') . '
LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = mem.id_group)
WHERE t.id_last_msg >= {int:likely_max_msg}
AND b.id_board = t.id_board' . (empty($exclude_boards) ? '' : '
AND b.id_board NOT IN ({array_int:exclude_boards})') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND ml.approved = {int:is_approved}' : '') . '
ORDER BY t.id_last_msg DESC
LIMIT {int:limit}',
array(
'current_member' => $user_info['id'],
'exclude_boards' => $exclude_boards,
'limit' => (int) $num_recent,
'is_approved' => 1,
'likely_max_msg' => $modSettings['maxMsgID'] - 35 * min($num_recent, 5),
'preview_char' => $preview_char,
)
);
$posts = array();
$color_ids = array();
while ($row = $db->fetch_assoc($request))
{
// Shorten and censor the body as needed
$row['body'] = '';
if (!(empty($show_preview) && empty($show_body)))
{
if (!empty($preview_char))
{
$row['body'] = strip_tags(strtr(parse_bbc($preview_last ? $row['last_body'] : $row['first_body'], false, $row['id_first_msg']), array('<br />' => "\n", ' ' => ' ')));
$row['body'] = Util::shorten_text($row['body'], !empty($modSettings['preview_characters']) ? $modSettings['preview_characters'] : $preview_char, true);
}
elseif (!empty($show_preview))
$row['body'] = strip_tags(strtr(parse_bbc($preview_last ? $row['last_body'] : $row['first_body'], false, $row['id_first_msg']), array('<br />' => "\n", ' ' => ' ')));

censorText($row['body']);
}

// Censor the subject.
$row['subject'] = preg_replace('/^' . preg_quote($txt['response_prefix']) . '/', '', $row['subject']);
censorText($row['subject']);

// Collect the color ids :)
$color_ids[$row['id_member']] = $row['id_member'];

if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';

// Build the array.
$posts[] = array(
'board' => array(
'id' => $row['id_board'],
'name' => $row['bName'],
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['bName'] . '</a>'
),
'topic' => $row['id_topic'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
),
'subject' => $row['subject'],
'short_subject' => Util::shorten_text($row['subject'], 25),
'preview' => $row['body'],
'time' => standardTime($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#new',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#new">' . $row['subject'] . '</a>',
'new' => !empty($row['is_read']),
'new_from' => $row['new_from'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.png" style="vertical-align: middle;" alt="' . $row['icon'] . '" />',
'views' => $row['num_views'],
'replies' => $row['num_replies'],
);
}
$db->free_result($request);

// Colorization
if (!empty($color_ids) && sp_loadColors($color_ids) !== false)
{
foreach ($posts as $key => $value)
{
if (!empty($color_profile[$value['poster']['id']]['link']))
$posts[$key]['poster']['link'] = $color_profile[$value['poster']['id']]['link'];
}
}

$context['recent_topics'] = $posts;

// Just return if we have no results
if (empty($posts))
return $txt['error_sp_no_posts_found'];

// Preview tips?
if (!empty($show_preview))
addInlineJavascript('
$(document).ready(function () {
$(".sp_custom_tr2").SiteTooltip({
hoverIntent: {
sensitivity: 10,
interval: 150,
timeout: 50
}
});
});', true);

echo '
<style>
.sp_custom_tr {display: table-cell; padding: 0 8px;border-bottom:1px dashed #6394BD;text-align: center;}
.sp_custom_tr1 {display: table-cell;border-bottom:1px dashed #6394BD;width:100%;}
.sp_custom_tr2 {font-weight: bold;}

</style>

<div>';

foreach ($posts as $post)
{
echo '
<div style="display: table-row">
<div class="sp_custom_tr centericon">
', $post['icon'], '
</div>
<div class="sp_custom_tr1" >
', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new" rel="nofollow"><span class="new_posts"> ' . $txt['new'] . '</span></a>', '
<a class="sp_custom_tr2" href="', $post['href'], '" title="', $post['preview'], '">', $post['subject'], '</a>';

echo '
<div class="smalltext">
', $txt['by'], ' ', $post['poster']['link'], ' ', $txt['in'], ' ', $post['board']['link'], '
</br />
', $post['time'], ' | ', $txt['views'], ': ', $post['views'], ' | ', $txt['replies'], ': ', $post['replies'], '
</div>';

if (!empty($show_body))
echo '
<div class="middletext">
', $post['preview'], '
</div>';

echo '
</div>
</div>';
}

echo '
</div>';

The small one on forum is still working proper. It displayes the time format this way and correct:

Code: [Select]
<div class="sp_custom_tr1" >
', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new" rel="nofollow"><span class="new_posts"> ' . $txt['new'] . '</span></a>', '
<a class="sp_custom_tr2" href="', $post['href'], '" title="', $post['preview'], '">', $post['subject'], '</a>';

echo '
<div class="smalltext">
', $txt['by'], ' ', $post['poster']['link'], ' ', $txt['in'], ' ', $post['board']['link'], ' - ', $post['time'], '
</div>';


Aktuelle Themen Forum.jpg

But the "big one" in portal shows "Uhr" twice together with "today" and "yesterday". And it does tell "Zeitformat" ("time format") instead of the time. I don't understand why. Should it not be just the same like in the other portal block?

Aktuelle Themen Portal.jpg

Code: [Select]
<div class="sp_custom_tr1" >
', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new" rel="nofollow"><span class="new_posts"> ' . $txt['new'] . '</span></a>', '
<a class="sp_custom_tr2" href="', $post['href'], '" title="', $post['preview'], '">', $post['subject'], '</a>';

echo '
<div class="smalltext">
', $txt['by'], ' ', $post['poster']['link'], ' ', $txt['in'], ' ', $post['board']['link'], '
</br />
', $post['time'], ' | ', $txt['views'], ': ', $post['views'], ' | ', $txt['replies'], ': ', $post['replies'], '
</div>';

On the smart phone of my friend this portal block shows the time correct....but not on my laptop.