Recent posts user preference

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

Previous topic - Next topic

miseryshining

#100
Quote from: zeitwort on October 16, 2007, 05:46:07 AM
I made this testforum for this Mod. Everything ist original.

seems you didnt install the updated package yet which i attached above:
http://www.simplemachines.org/community/index.php?topic=158917.msg1274962#msg1274962

It should fix this. You'll have to uninstall the old package, and delete it as well, then download the new one and install it.

zeitwort

Certainly, but I will delete everything and install again

Wenn du merkst, dass du ein totes Pferd reitest - steig ab!

miseryshining

#102
Quote from: zeitwort on October 16, 2007, 05:55:04 AM
Certainly, but I will delete everything and install again



Ok, seems there is an error in the installer after all, fixing it now.

zeitwort

#103
So, I tried it with a new blank SMF, but everything is the same.  Wrong date and errors.
Wenn du merkst, dass du ein totes Pferd reitest - steig ab!

miseryshining

Quote from: zeitwort on October 16, 2007, 06:06:05 AM
So, I tried it with a new blank SMF, but everything is the same.  Wrong date and errors.

yes, somehow the installer didnt change something, without giving any errors. this attached package should do the trick.

zeitwort

Yes! Thank you - now the date is correct and there are no errors!

Quote from: miseryshining on March 19, 2007, 05:37:32 PM

require_once('SSI.php');
if (function_exists('ssi_recentPostsPref')) ssi_recentPostsPref();

Can you give me one example how to use this? My schoolenglish ist not able to make me understanding this!
Wenn du merkst, dass du ein totes Pferd reitest - steig ab!

miseryshining

Quote from: zeitwort on October 16, 2007, 06:31:30 AM
Yes! Thank you - now the date is correct and there are no errors!

Quote from: miseryshining on March 19, 2007, 05:37:32 PM

require_once('SSI.php');
if (function_exists('ssi_recentPostsPref')) ssi_recentPostsPref();

Can you give me one example how to use this? My schoolenglish ist not able to make me understanding this!

Thanks for helping me solve that ^^. There are some examples of use in this topic. You need to edit your index.template.php, or one of the other template files. It takes some understanding of PHP though.


require_once('SSI.php');
if (function_exists['ssi_recentPostsPref']) {
echo '  <div class="recentposts">';
  ssi_recentPostsPref();
echo '  </div>';


You can then style it from the theme settings in your administration panel (style.css) and add a border, etc.

.recentposts { border: 1px solid #000000; }

zeitwort

Thank you, now I can understand the background!

I've translated the MOD to german - maybe you want include this!
/Themes/default/languages/Profile.german.php
$txt['RP_title'] = 'Aktive Postings Einstellungen';
$txt['RP_info'] = 'Hier kannst du den Aktive Postings Block einstellen';
$txt['RP_blockSettings'] = 'Einstellungen für Blöcke';
$txt['RP_lastOnly'] = 'Themenansicht (Nur die letzen Antworten eines Themas)';
$txt['RP_nrofPosts'] = 'Anzahl der Beiträge';
$txt['RP_recentPosts'] = $txt['recentPosts'] = 'Aktive Postings Einstellungen';
$txt['RP_listheader'] = 'Wähle die anzuzeigenden Foren';

/Themes/default/languages/ModSettings.german.php
$txt['userprefs_title'] = 'Benutzereinstellungen';
$txt['userprefsMode'] = 'Extra Benutzereinstellungen für aktive Postings erlauben';

/Themes/default/languages/index.german.php
$txt['recent_topics'] = 'Aktive Themen';
$txt['unread_topics_only'] = 'Zeige nur Ungelesene';
Wenn du merkst, dass du ein totes Pferd reitest - steig ab!

JaGuR123

#108
Quote from: miseryshining on October 14, 2007, 12:32:02 AMSyntax:
ssi_recentPostsPref( int $nrofPosts, string $boards, string $returnMode, int $mode, int $member_id )

$nrofPosts:     

    * override user preference,
    * default: null

$boards:           

    * override board selection
    * possible values: board numbers separated by commas
    * default: null

$returnMode:

    * how the list is returned
    * possible values:       

------  'echo' (print the result on the page)
------  'extended' (creates a detailed array with recent topics, ala vBulletin. puts it in $context['topics'])
------  [anything else] (return an array with post/topic info)

    * default: 'echo'
    * peculiarities:  applies only for recent topics, for recent posts, it will fallback to 'echo' mode

$mode:           

    * override posts/topics mode
    * possible values:

------  1 (show all posts)
------  2 (show topics)

    * default: 1                     

$member_id   

    * show only posts by one member
    * default: null


So lets see if i have this correct we replace the strings with values inside the function ?

for eg

if you want to display it for member 2 you put 2 where $member_id is ?

ssi_recentPostsPref( int $nrofPosts, string $boards, string $returnMode, int $mode, 2)

Correct ?  :-\

Cheers

edit:

Also with this little gem you gave me before

ssi_recentPosts($context['user']['recentPosts']['nrofPosts'], null, 'echo', null, $context['user']['id']);

i have it displaying all the user posts in profile.template.php of the users profile you are looking at and it is great, but one little problem i have with it is, that if that user has posted in same topic more then once then that topic shows up more then once , is it possible to only show the topic once for multiple posts and when clicked on go to the last post of that user ?

It's just a small grievance i have with it and not of great importance  :D

Thanks great work

zeitwort

#109
There are new errors!

8: Undefined index:  action
Datei: /var/...../smf/SSI.php
Zeile: 398

8: Undefined variable:  extravalues
Datei: /var/kunden/zeitwort/smf/SSI.php
Zeile: 378


Here my SSI.php


{$extravalues}
                        m.posterTime, ms.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, b.ID_BOARD, b.name AS bName,
                        IFNULL(mem.realName, m.posterName) AS posterName, " . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
                        IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= m.ID_MSG_MODIFIED AS isRead,
                        IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ", LEFT(m.body, 384) AS body, m.smileysEnabled, m.icon
                FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ms)
                        LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.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 = $ID_MEMBER)
                        LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = b.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)" : '') . "
                WHERE t.ID_LAST_MSG >= " . ($modSettings['maxMsgID'] - 35 * min($num_recent, 5)) . "
                        AND t.ID_LAST_MSG = m.ID_MSG
                        AND b.ID_BOARD = t.ID_BOARD" . (empty($exclude_boards) ? '' : "
                        AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . (!empty($include_boards) ? "
                        AND b.ID_BOARD IN (" . implode(', ', $include_boards) . ")"  : '') . (isset($_REQUEST['limit']) && is_numeric($_REQUEST['limit']) ? "
                        AND m.posterTime > " . (time() - ($_REQUEST['limit']*24*60*60)) : '') . (!empty($member_id) ? "       
                        AND m.ID_MEMBER = {$member_id}" : '') .        "
                        AND $user_info[query_see_board]
                        AND ms.ID_MSG = t.ID_FIRST_MSG
                ORDER BY " . (isset($_REQUEST['sort']) ? (
                        $_REQUEST['sort'] . ($context['ascending'] ? '' : ' DESC')) : ("t.ID_LAST_MSG DESC")) . "
                LIMIT " . ((isset($_REQUEST['start']) && $_REQUEST['action'] == 'recenttopics' && is_numeric($_REQUEST['start'])) ? ($_REQUEST['start'].', ') : ('')) . $num_recent, __FILE__, __LINE__);


Wenn du merkst, dass du ein totes Pferd reitest - steig ab!

miseryshining

Quote from: JaGuR123 on October 16, 2007, 07:30:29 AM
Quote from: miseryshining on October 14, 2007, 12:32:02 AMSyntax:
ssi_recentPostsPref( int $nrofPosts, string $boards, string $returnMode, int $mode, int $member_id )

$nrofPosts:     

    * override user preference,
    * default: null

$boards:           

    * override board selection
    * possible values: board numbers separated by commas
    * default: null

$returnMode:

    * how the list is returned
    * possible values:       

------  'echo' (print the result on the page)
------  'extended' (creates a detailed array with recent topics, ala vBulletin. puts it in $context['topics'])
------  [anything else] (return an array with post/topic info)

    * default: 'echo'
    * peculiarities:  applies only for recent topics, for recent posts, it will fallback to 'echo' mode

$mode:           

    * override posts/topics mode
    * possible values:

------  1 (show all posts)
------  2 (show topics)

    * default: 1                     

$member_id   

    * show only posts by one member
    * default: null


So lets see if i have this correct we replace the strings with values inside the function ?

for eg

if you want to display it for member 2 you put 2 where $member_id is ?

ssi_recentPostsPref( int $nrofPosts, string $boards, string $returnMode, int $mode, 2)

Correct ?  :-\
you should use this:

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

QuoteAlso with this little gem you gave me before

ssi_recentPosts($context['user']['recentPosts']['nrofPosts'], null, 'echo', null, $context['user']['id']);

i have it displaying all the user posts in profile.template.php of the users profile you are looking at and it is great, but one little problem i have with it is, that if that user has posted in same topic more then once then that topic shows up more then once , is it possible to only show the topic once for multiple posts and when clicked on go to the last post of that user ?

It's just a small grievance i have with it and not of great importance  :D

Thanks great work

Change it to the code above ;-) Users can then select themselves what mode they want to use

miseryshining

Quote from: zeitwort on October 16, 2007, 04:39:26 PM
There are new errors!

8: Undefined index:  action
Datei: /var/...../smf/SSI.php
Zeile: 398

8: Undefined variable:  extravalues
Datei: /var/kunden/zeitwort/smf/SSI.php
Zeile: 378


Here my SSI.php


{$extravalues}
                        m.posterTime, ms.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, b.ID_BOARD, b.name AS bName,
                        IFNULL(mem.realName, m.posterName) AS posterName, " . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
                        IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= m.ID_MSG_MODIFIED AS isRead,
                        IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ", LEFT(m.body, 384) AS body, m.smileysEnabled, m.icon
                FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ms)
                        LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.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 = $ID_MEMBER)
                        LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = b.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)" : '') . "
                WHERE t.ID_LAST_MSG >= " . ($modSettings['maxMsgID'] - 35 * min($num_recent, 5)) . "
                        AND t.ID_LAST_MSG = m.ID_MSG
                        AND b.ID_BOARD = t.ID_BOARD" . (empty($exclude_boards) ? '' : "
                        AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . (!empty($include_boards) ? "
                        AND b.ID_BOARD IN (" . implode(', ', $include_boards) . ")"  : '') . (isset($_REQUEST['limit']) && is_numeric($_REQUEST['limit']) ? "
                        AND m.posterTime > " . (time() - ($_REQUEST['limit']*24*60*60)) : '') . (!empty($member_id) ? "       
                        AND m.ID_MEMBER = {$member_id}" : '') .        "
                        AND $user_info[query_see_board]
                        AND ms.ID_MSG = t.ID_FIRST_MSG
                ORDER BY " . (isset($_REQUEST['sort']) ? (
                        $_REQUEST['sort'] . ($context['ascending'] ? '' : ' DESC')) : ("t.ID_LAST_MSG DESC")) . "
                LIMIT " . ((isset($_REQUEST['start']) && $_REQUEST['action'] == 'recenttopics' && is_numeric($_REQUEST['start'])) ? ($_REQUEST['start'].', ') : ('')) . $num_recent, __FILE__, __LINE__);




I'll fix that later (curretnly converting to new installation format), it's nothing to worry about. I didn't know SMF would log all of these, it's really nothing critical ;-)

NEMINI

bit of an odd issue.  Installs fine.  Works fine except if a user chooses the Topic view (Only show the last reply of a thread) option and tries to enter a forum an internal server error occurs.  turn off the topic view option and everything works great again.
signatures are boring.

miseryshining

Quote from: NEMINI on October 17, 2007, 08:09:04 AM
bit of an odd issue.  Installs fine.  Works fine except if a user chooses the Topic view (Only show the last reply of a thread) option and tries to enter a forum an internal server error occurs.  turn off the topic view option and everything works great again.

it happens only when they visit a forum, not on the board index? I can't seem to reproduce it, can you show me the error?? Inside forums it shouldn't load this mod.

zeitwort

In my forum is the same. If the user chooses "Topic view (Only show the last reply of a thread)", then are error messages.

8: Undefined index:  action
Datei: /var/........../smf/SSI.php
Zeile: 398

8: Undefined variable:  extravalues
Datei: /var/........./smf/SSI.php
Zeile: 378



Wenn du merkst, dass du ein totes Pferd reitest - steig ab!

miseryshining

Quote from: zeitwort on October 17, 2007, 11:28:16 AM
In my forum is the same. If the user chooses "Topic view (Only show the last reply of a thread)", then are error messages.

8: Undefined index:  action
Datei: /var/........../smf/SSI.php
Zeile: 398

8: Undefined variable:  extravalues
Datei: /var/........./smf/SSI.php
Zeile: 378


thanks for the reports :-). I will fix all of these 'errors' soon. But you didnt get the internal server error, right?

zeitwort

Quote from: miseryshining on October 17, 2007, 11:38:36 AM
thanks for the reports :-). I will fix all of these 'errors' soon. But you didnt get the internal server error, right?
Certainly these are the errors of the Mod in SMF, but only if any user  has "Topic view (Only show the last reply of a thread)" activated.

Would it be possible to enable this option for guests in the ACP?

Wenn du merkst, dass du ein totes Pferd reitest - steig ab!

miseryshining

Quote from: zeitwort on October 17, 2007, 11:50:44 AM
Quote from: miseryshining on October 17, 2007, 11:38:36 AM
thanks for the reports :-). I will fix all of these 'errors' soon. But you didnt get the internal server error, right?
Certainly these are the errors of the Mod in SMF, but only if any user  has "Topic view (Only show the last reply of a thread)" activated.

Would it be possible to enable this option for guests in the ACP?



Only way to do it for guests is with a cookie i think, but isn't it a good reason for guests to register to your forums? So they get all the nice features :-)

zeitwort

Quote from: miseryshining on October 17, 2007, 02:37:38 PM
Only way to do it for guests is with a cookie i think

I want to change the standard on the board index to "Topic view".
Wenn du merkst, dass du ein totes Pferd reitest - steig ab!

NEMINI

Quote from: miseryshining on October 17, 2007, 09:58:39 AM
Quote from: NEMINI on October 17, 2007, 08:09:04 AM
bit of an odd issue.  Installs fine.  Works fine except if a user chooses the Topic view (Only show the last reply of a thread) option and tries to enter a forum an internal server error occurs.  turn off the topic view option and everything works great again.

it happens only when they visit a forum, not on the board index? I can't seem to reproduce it, can you show me the error?? Inside forums it shouldn't load this mod.

I've PM'd you a test account so you can experience yourself.  when the topic option is active you cannot access a forum by any means.  Though clicking a specific topic does work. 
signatures are boring.

Advertisement: