News:

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

Main Menu

Recent posts user preference

Started by miseryshining, March 19, 2007, 05:37:32 PM

Previous topic - Next topic

ES23

#140
As of now,I don't see those above errors appearing again .... :)

But now,this error is repetitive:

http://www.xxxxxx.com/forums/index.php?action=profile;u=1;sa=recentPosts
8: Undefined index: userprefsMode
File: /var/www/html/forums/Themes/default/languages/Settings.english.php (recentPosts sub template - eval?)
Line: 1893

How can I solve this?Kindly please advise :) and I realised the recent topics/posts don't seem to work according to user preferences ... Despite me not choosing to display topics from a particular board under recent posts preferences,when I access recent posts or recent topics,they still display ...

This is my Settings.english file:

<?php
// Version: 1.1; Settings

$txt['theme_thumbnail_href'] = $settings['images_url'] . '/thumbnail.gif';
$txt['theme_description'] = 'The default theme from Simple Machines.<br /><br />Thanks go to Bloc and the design team.';

?>


As you can see,there's no userprefsMode at all ... so strange ... :(

ES23

The error has stop producing ... :)

But the function still fails to work ... ... it can work on my another mod-packed forum but not on this fresh new forum.I created a tab for recent topics(www.XXXXXX.com/forums/index.php?action=recenttopics) and have set my board preferences under Recent posts preferences in my profile.But the display for recent topics don't follow my recent posts preferences at all.Neither does the recent posts follow as well ... :(

miseryshining

Quote from: ES23 on November 12, 2007, 05:45:16 AM
The error has stop producing ... :)

But the function still fails to work ... ... it can work on my another mod-packed forum but not on this fresh new forum.I created a tab for recent topics(www.XXXXXX.com/forums/index.php?action=recenttopics) and have set my board preferences under Recent posts preferences in my profile.But the display for recent topics don't follow my recent posts preferences at all.Neither does the recent posts follow as well ... :(

hmmz, seems something went wrong during install. did you try to uninstall / reinstall?

ES23

I have tried uninstalling and reinstalling again.

All tests are successful and no more errors produced... but the preferences does not work at all.Which boards the user wish to monitor doesn't seem to have any effect.Recent Topics or Recent posts will just display all recent topics or posts without following the user's selection under recent posts preferences ... :(

I'm really frustrated about this ... can you please kindly advise?I'm running SMF 1.1.4 with Recent posts and topics 2.3 ...

miseryshining

Quote from: ES23 on November 12, 2007, 07:37:16 AM
I have tried uninstalling and reinstalling again.

All tests are successful and no more errors produced... but the preferences does not work at all.Which boards the user wish to monitor doesn't seem to have any effect.Recent Topics or Recent posts will just display all recent topics or posts without following the user's selection under recent posts preferences ... :(

I'm really frustrated about this ... can you please kindly advise?I'm running SMF 1.1.4 with Recent posts and topics 2.3 ...

i really don't have a clue why it doesnt work for you. you could try to put this on top of your index.template.php to find out if the settings are put into the variables correctly:


global $context;
echo '<pre>';
print_r($context['user']['recentPosts']);
echo '</pre>';


please post the results back here

ES23

On top of my index.template.php file?

Ok ...  :o I put it on the very top of my index.template.php file so that now it looks like this:

global $context;
echo '<pre>';
print_r($context['user']['recentPosts']);
echo '</pre>';
<?php
// Version: 1.1; index

/* This template is, perhaps, the most important template in the theme. It
contains the main template layer that displays the header and footer of
the forum, namely with main_above and main_below. It also contains the
menu sub template, which appropriately displays the menu; the init sub
template, which is there to set the theme up; (init can be missing.) and
the linktree sub template, which sorts out the link tree.


After refreshing my forums page,there is this row of code appearing on top of my forum:

global $context; echo '

';
print_r($context['user']['recentPosts']);
echo '

';


No errors are generated in my forum error log.

Please kindly advise me on what is going wrong.Thanks a million :)

miseryshining

you should put it right beneath the <php tag so it will print some useful info :-)


ES23

#147
Lol ... :D Sorry ...

I have put the code after the <?php so now,it looks like this:

<?php
global $context;
echo 
'<pre>';
print_r($context['user']['recentPosts']);
echo 
'</pre>';
// Version: 1.1; index

/* This template is,


A new row of code appear on top of my forum page.It is as shown below:
Array
(
    [boards] => Array
        (
        )

    [lastOnly] => NULL
    [nrofPosts] => 10
)



I realised the set of code that appears on top of my forum differs when I stayed log-in or not.The above shown code that appear is before I logged in.After I logged in,the row of code that appears on top of my forum page becomes:
Array
(
    [boards] => Array
        (
        )

    [lastOnly] => 1
    [nrofPosts] => 25
)



No errors are generated in the forum error log in anyway :)

So any suggestion to solve this? :( Please advise.

miseryshining

so, it seems you haven't selected any boards to monitor in your profile, is that right?

ES23

#149
That's right :) I did not select any of the boards but yet when I click recent topics(http://www.xxxxxx.com/index.php?action=recenttopics)/recent posts(http://www.xxxxxx.com/index.php?action=recent),the results display ALL the topics/posts from ALL the boards.I did not even select those boards under my profile.My other forum do not seem to have that problem ...

So,what's the reason?Any idea?Please kindly enlighten me on this issue :) Thanks ...

***Here's the row of code that appears on top of my forum page when I'm logged in AND I have chosen a board for display :)

Array
(
    [boards] => Array
        (
            [0] => 1
        )

    [lastOnly] => 1
    [nrofPosts] => 25
)

miseryshining

Quote from: ES23 on November 13, 2007, 09:23:19 AM
That's right :) I did not select any of the boards but yet when I click recent topics(http://www.xxxxxx.com/index.php?action=recenttopics)/recent posts(http://www.xxxxxx.com/index.php?action=recent),the results display ALL the topics/posts from ALL the boards.I did not even select those boards under my profile.My other forum do not seem to have that problem ...

So,what's the reason?Any idea?Please kindly enlighten me on this issue :) Thanks ...

***Here's the row of code that appears on top of my forum page when I'm logged in AND I have chosen a board for display :)

Array
(
    [boards] => Array
        (
            [0] => 1
        )

    [lastOnly] => 1
    [nrofPosts] => 25
)


I think you're a bit confused about how this is supposed to work. If you don't select any boards at all, it will display ALL of them, no filters applied. you have to select at least one board.. as for the recent posts (action=recent) listing, it isn't affected by this mod.

Matthew Schenker

In my forum, members have been asking me to increase the number of recent posts from 100 to 500.  But I have not been able to figure out how to do it.

This may be my answer!!

With this mod, is it possible to set the number of recent posts to 500?  Or is there a limit on the number that is possible?

Thanks,
Matt

miseryshining

Quote from: Matthew Schenker on November 14, 2007, 11:30:29 AM
In my forum, members have been asking me to increase the number of recent posts from 100 to 500.  But I have not been able to figure out how to do it.

This may be my answer!!

With this mod, is it possible to set the number of recent posts to 500?  Or is there a limit on the number that is possible?

Thanks,
Matt

What type of recent posts listing do you mean? the one that is called with action=recent? This mod doesn't change anything about that.

Matthew Schenker

#153
Quote from: miseryshining on November 14, 2007, 02:31:53 PM
What type of recent posts listing do you mean? the one that is called with action=recent? This mod doesn't change anything about that.

I'm referring to the option that appears in the "Forum Stats" area called "View the most recent posts on the forum."  It usually displays 100 recent messages, and many of my members want to see 500.  I have never found a way to increase the number. I know this modification does not change that area of the forum, but it seems to offer an alternative way for members to see more posts.  That is correct, right?

Thanks,
Matt

miseryshining

Quote from: Matthew Schenker on November 14, 2007, 05:50:33 PM
Quote from: miseryshining on November 14, 2007, 02:31:53 PM
What type of recent posts listing do you mean? the one that is called with action=recent? This mod doesn't change anything about that.

I'm referring to the option that appears in the "Forum Stats" area called "View the most recent posts on the forum."  It usually displays 100 recent messages, and many of my members want to see 500.  I have never found a way to increase the number. I know this modification does not change that area of the forum, but it seems to offer an alternative way for members to see more posts.  That is correct, right?

Thanks,
Matt
This mod adds the possibility to only show the last post in a topic. maybe that'd be useful.

To answer your question: yes, but the queries will never select more then 125 recent posts to be listed. you'd have to change the queries in SSI.php in the ssi_recentPosts function to fix that. You will also have to change the select values that a user can choose (currently limited to show max 25 posts or topics). The latter you can find in Profile.template.php, in the default theme directory. make backups before editing anything, you wont be able to uninstall the mod if you edit something.  If you need more pointers, just ask.

JaGuR123

Hi Miseryshining,

Is there a way to exclude Locked and Stickied Topics ?

I have used this code in Recent.Template.php and MessageIndex.Template.php to do what i want


if (($topic['is_sticky']==0) && ($topic['is_locked']))
{
echo '<td class="windowbg7" valign="middle" align="center" width="4%" style="padding:7px;">&nbsp;
</td>


but i can't get it to work in the ssi.php file, i have tried using different variables like $row['is_locked'] etc , but must be doing it incorrectly  :-[

miseryshining

Quote from: JaGuR123 on November 17, 2007, 09:11:11 PM
Hi Miseryshining,

Is there a way to exclude Locked and Stickied Topics ?

I have used this code in Recent.Template.php and MessageIndex.Template.php to do what i want


if (($topic['is_sticky']==0) && ($topic['is_locked']))
{
echo '<td class="windowbg7" valign="middle" align="center" width="4%" style="padding:7px;">&nbsp;
</td>


but i can't get it to work in the ssi.php file, i have tried using different variables like $row['is_locked'] etc , but must be doing it incorrectly  :-[

You shouldnt change anything in there probably. do you want to display a list of recent topics (a la action=recent) or are you using a block on your page?

JaGuR123

#157
I am using the code copied from ssi.php in a tinyportal php.box

I am displaying recent Topics , but don't want locked topics to show,  if you look here i have made the locked topics un clickable


Jimbo's Tips For Friday (moved to existing thread)

I would like to be able to do the same in a php box that displays the last 10 recent replies

Cheers

miseryshining

#158
Quote from: JaGuR123 on November 18, 2007, 12:25:43 PM
I am using the code copied from ssi.php in a tinyportal php.box

I am displaying recent Topics , but don't want locked topics to show,  if you look here i have made the locked topics un clickable


Jimbo's Tips For Friday (moved to existing thread)

I would like to be able to do the same in a php box that displays the last 10 recent replies

Cheers

sorry for the late reply; the queries in SSI.php currently don't check if a topic is locked or sticky. for topics you could quite easily add the functionality to SSI.php BUT this will make it impossible to succesfully uninstall the mod with the package manager (you'd have to remove the changes again before).

look in SSI.php for
// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = db_query("
SELECT


change to:

// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = db_query("
SELECT t.isSticky AS isSticky2, t.locked AS locked2,


find:

else {
$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']), array('<br />' => '')));
if ($func['strlen']($row['body']) > 128)
$row['body'] = $func['substr']($row['body'], 0, 128) . '...';

// Censor the subject.
censorText($row['subject']);
censorText($row['body']);

if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? '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['posterName'],
'href' => empty($row['ID_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
),
'subject' => $row['subject'],
'short_subject' => shorten_subject($row['subject'], 25),
'preview' => $row['body'],
'time' => timeformat($row['posterTime']),
'timestamp' => forum_time(true, $row['posterTime']),
'raw_timestamp' => $row['posterTime'],
'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['isRead']),
'new_from' => $row['new_from'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
);
}


and replace with

else {
$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']), array('<br />' => '')));
if ($func['strlen']($row['body']) > 128)
$row['body'] = $func['substr']($row['body'], 0, 128) . '...';

// Censor the subject.
censorText($row['subject']);
censorText($row['body']);

if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? '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['posterName'],
'href' => empty($row['ID_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
),
'is_sticky' => $row['isSticky2'],
'is_locked' => $row['locked2'],
'subject' => $row['subject'],
'short_subject' => shorten_subject($row['subject'], 25),
'preview' => $row['body'],
'time' => timeformat($row['posterTime']),
'timestamp' => forum_time(true, $row['posterTime']),
'raw_timestamp' => $row['posterTime'],
'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['isRead']),
'new_from' => $row['new_from'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
);
}


under it search for

echo '
<table border="0" class="ssi_table">';
foreach ($posts as $post)
echo '
<tr>
<td align="right" valign="top" nowrap="nowrap">
[', $post['board']['link'], ']
</td>
<td valign="top">
<a href="', $post['href'], '">', $post['subject'], '</a>
', $txt[525], ' ', $post['poster']['link'], '
', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', '
</td>
<td align="right" nowrap="nowrap">
', $post['time'], '
</td>
</tr>';
echo '
</table>';


and replace with

echo '
<table border="0" class="ssi_table">';
foreach ($posts as $post) {
if (($post['is_sticky'] == 0) && ($post['is_locked'] == 0)) {
echo '
<tr>
<td align="right" valign="top" nowrap="nowrap">
[', $post['board']['link'], ']
</td>
<td valign="top">
<a href="', $post['href'], '">', $post['subject'], '</a>
', $txt[525], ' ', $post['poster']['link'], '
', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', '
</td>
<td align="right" nowrap="nowrap">
', $post['time'], '
</td>
</tr>';
}
}
echo '
</table>';


now you can call a recent topics list with:

ssi_recentPostsPref(10, null, 'echo', 2, null)

Aileen

Nice feature,  BTW is this easy to install on a dilber theme?

Advertisement: