SimplePortal

Support => English Support => Topic started by: edi67 on April 07, 2009, 02:56:40 PM

Title: Board News: Add topic of different sections ?
Post by: edi67 on April 07, 2009, 02:56:40 PM
I saw in options that in Board NEws i can add topic of one section only is possible add topics of 2 or 3 different sections?
Title: Re: Board News: Add topic of different sections ?
Post by: Nathaniel on April 07, 2009, 09:42:44 PM
That block doesn't support showing posts from multiple boards. Although if you post your SMF version then I can post some edits that you can make so that it will allow you to do that.
Title: Re: Board News: Add topic of different sections ?
Post by: edi67 on April 08, 2009, 03:09:27 AM
That block doesn't support showing posts from multiple boards. Although if you post your SMF version then I can post some edits that you can make so that it will allow you to do that.

2.0 RC1 thx for help, i wanted show in board news ONLY topics of certains board not topcs of all boards
Title: Re: Board News: Add topic of different sections ?
Post by: Nathaniel on April 08, 2009, 03:24:13 AM
Edits for the 'SPortal2.php' file.

These edits will mean that you can enter a list of board IDs separated by commas into the 'Board ID' field. Eg '1,45,3,2'.

Find this code:
Code: [Select]
$block_parameters = array(
'board' => 'int',
'limit' => 'int',
'start' => 'int',
'length' => 'int',
'avatar' => 'check',
'per_page' => 'int',
);

if ($return_parameters)
return $block_parameters;

$board = !empty($parameters['board']) ? (int) $parameters['board'] : null;

Replace with this code:
Code: [Select]
$block_parameters = array(
'board' => 'text',
'limit' => 'int',
'start' => 'int',
'length' => 'int',
'avatar' => 'check',
'per_page' => 'int',
);

if ($return_parameters)
return $block_parameters;

$boards = !empty($parameters['board']) ? explode(',', $parameters['board']) : array();
foreach ($boards as $id_board => $board)
{
$board = (int) $board;
if (empty($board))
unset($boards[$id_board]);
else
$boards[$id_board] = $board;
}

Find this code:
Code: [Select]
$request = $smcFunc['db_query']('', '
SELECT id_first_msg
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE ' . (empty($board) ? '{query_see_board}' : 'b.id_board = {int:current_board}') . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
ORDER BY t.id_first_msg DESC
LIMIT {int:limit}',
array(
'current_board' => $board,
'is_approved' => 1,
'limit' => $limit,
)
);

Replace with this code:
Code: [Select]
$request = $smcFunc['db_query']('', '
SELECT id_first_msg
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE ' . (empty($boards) ? '{query_see_board}' : 'b.id_board IN ({array_int:current_boards})') . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
ORDER BY t.id_first_msg DESC
LIMIT {int:limit}',
array(
'current_boards' => $boards,
'is_approved' => 1,
'limit' => $limit,
)
);
Title: Re: Board News: Add topic of different sections ?
Post by: edi67 on April 08, 2009, 05:47:08 AM
Edits for the 'SPortal2.php' file.

These edits will mean that you can enter a list of board IDs separated by commas into the 'Board ID' field. Eg '1,45,3,2'.


please sticky me in bold the part of code where i must add board id , i cannot understand :(

thx
Title: Re: Board News: Add topic of different sections ?
Post by: Nathaniel on April 08, 2009, 06:26:08 AM
You put them into the 'Board ID' field that is shown when you edit/add a Board News block. ;)
Title: Re: Board News: Add topic of different sections ?
Post by: edi67 on April 08, 2009, 07:15:46 AM
You put them into the 'Board ID' field that is shown when you edit/add a Board News block. ;)
work like a chamr thx ;) but there is one problem big for me, now every user groups can view topics in portal but can view too topic of sections where are NOT enabled to view, i means, there are some sections in my forum that some user groups cannot view, and now topics of these sections are visible for disable user groups too
is possible fix this?

tha anyway
Title: Re: Board News: Add topic of different sections ?
Post by: edi67 on April 09, 2009, 05:28:07 PM
please you can reply me to my last question thx.
Title: Re: Board News: Add topic of different sections ?
Post by: Nathaniel on April 09, 2009, 08:40:00 PM
The Board News block assumes that you are only showing topics/boards that you want all users to see.

Replace this code:
Code: [Select]
   $request = $smcFunc['db_query']('', '
      SELECT id_first_msg
      FROM {db_prefix}topics AS t
         INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
      WHERE ' . (empty($boards) ? '{query_see_board}' : 'b.id_board IN ({array_int:current_boards})') . ($modSettings['postmod_active'] ? '
         AND t.approved = {int:is_approved}' : '') . '
      ORDER BY t.id_first_msg DESC
      LIMIT {int:limit}',
      array(
         'current_boards' => $boards,
         'is_approved' => 1,
         'limit' => $limit,
      )
   );

With this code:
Code: [Select]
   $request = $smcFunc['db_query']('', '
      SELECT id_first_msg
      FROM {db_prefix}topics AS t
         INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
      WHERE {query_see_board}
AND b.id_board IN ({array_int:current_boards})' . ($modSettings['postmod_active'] ? '
         AND t.approved = {int:is_approved}' : '') . '
      ORDER BY t.id_first_msg DESC
      LIMIT {int:limit}',
      array(
         'current_boards' => $boards,
         'is_approved' => 1,
         'limit' => $limit,
      )
   );
Title: Re: Board News: Add topic of different sections ?
Post by: edi67 on April 10, 2009, 11:54:52 AM
work good now with permission, but one little question not inerent this.

Why the TAG (CODE, QUOTE etc) are not showed in correct way ?
look screenshot,  portal not show CODE with code style but with the TAG look screen for understand.

but not problem for it , thx for help everything is ok ;)
Title: Re: Board News: Add topic of different sections ?
Post by: Nathaniel on April 11, 2009, 04:44:54 AM
Looks like the post is being cut off in the middle of the Code tags, although it should be able to cope with that.

This is either an SMF or SP bug.
Title: Re: Board News: Add topic of different sections ?
Post by: Nigel on May 02, 2009, 04:23:59 PM
That block doesn't support showing posts from multiple boards. Although if you post your SMF version then I can post some edits that you can make so that it will allow you to do that.

How about SMF version 1.1.8? Anyway I can also fix this code in order to display multiple boards on the Frontpage block?
Title: Re: Board News: Add topic of different sections ?
Post by: Nathaniel on May 02, 2009, 07:36:43 PM
For SMF 1.1.8:
Replace this code:
Code: [Select]
SELECT ID_FIRST_MSG
FROM {$db_prefix}topics AS t
INNER JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = t.ID_BOARD)
WHERE " . (empty($board) ? $user_info['query_see_board'] : "b.ID_BOARD = $board") . "
ORDER BY t.ID_FIRST_MSG DESC
LIMIT $limit", __FILE__, __LINE__);

With this code:
Code: [Select]
SELECT ID_FIRST_MSG
FROM {$db_prefix}topics AS t
INNER JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = t.ID_BOARD)
WHERE $user_info[query_see_board]" . (empty($board) ? '' : "
b.ID_BOARD = $board") . "
ORDER BY t.ID_FIRST_MSG DESC
LIMIT $limit", __FILE__, __LINE__);)
Title: Re: Board News: Add topic of different sections ?
Post by: Nigel on May 02, 2009, 08:24:07 PM
Thank you for the reply.

I applied the code changes you suggested for 1.1.8 and also do the code changes mentioned above for the "$block_parameters".

However, when previewing the Board News block I receive the following:
Code: [Select]
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'b.ID_BOARD = 2
ORDER BY t.ID_FIRST_MSG DESC
LIMIT 5' at line 5
File: /home8/xxxx/public_html/Sources/SPortal1-1.php
Line: 1344

Any ideas where this is coming from and how I can fix this?
Title: Re: Board News: Add topic of different sections ?
Post by: Nathaniel on May 02, 2009, 10:04:11 PM
Whoops, try this:
Code: [Select]
      SELECT ID_FIRST_MSG
      FROM {$db_prefix}topics AS t
         INNER JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = t.ID_BOARD)
      WHERE $user_info[query_see_board]' . (empty($board) ? '' : '
         AND b.id_board IN (' . implode(',', $boards) . ')') . ($modSettings['postmod_active'] ? '
         AND t.approved = {int:is_approved}' : '') . '
      ORDER BY t.ID_FIRST_MSG DESC
      LIMIT $limit", __FILE__, __LINE__);
Title: Re: Board News: Add topic of different sections ?
Post by: Nigel on May 03, 2009, 07:57:31 AM
Hi LHVWB,

Thank you for your help so far.
Unfortunately I now receive the following error message:
Code: [Select]
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home8/xxxx/public_html/Sources/SPortal1-1.php on line 1342
I've been trying for some hours now trying to fix this on my own, but it's pretty obvious my skills are not that good as I might have hoped  :-X

Any suggestions?
Title: Re: Board News: Add topic of different sections ?
Post by: Nathaniel on May 03, 2009, 08:01:59 AM
Sigh, not having any luck today. Shows what happens when I am not concentraiting.

The code below should work:
Code: [Select]
SELECT ID_FIRST_MSG
FROM {$db_prefix}topics AS t
INNER JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = t.ID_BOARD)
WHERE $user_info[query_see_board]" . (empty($board) ? '' : "
AND b.id_board IN (" . implode(',', $boards) . ')') . ($modSettings['postmod_active'] ? "
AND t.approved = {int:is_approved}" : '') . "
ORDER BY t.ID_FIRST_MSG DESC
LIMIT $limit", __FILE__, __LINE__);;
Title: Re: Board News: Add topic of different sections ?
Post by: Nigel on May 03, 2009, 09:32:38 AM
Ahh that did the trick for me  :D

Thanks for your help.
Title: Re: Board News: Add topic of different sections ?
Post by: ccbtimewiz on May 23, 2009, 12:30:55 PM
./Sources
Title: Re: Board News: Add topic of different sections ?
Post by: Nathaniel on May 25, 2009, 04:53:36 AM
You are running SMF 1.1.8, so the file is at '{smf directory}/sources/Subs-SPortal1-1.php'. ;)
Title: Re: Board News: Add topic of different sections ?
Post by: Nathaniel on May 25, 2009, 05:32:21 PM
SMF 1.1.9 is essentially the same as SMF 1.1.8, the file that you need to edit is still at '{smf directory}/sources/Subs-SPortal1-1.php'.
Title: Re: Board News: Add topic of different sections ?
Post by: ccbtimewiz on May 25, 2009, 08:15:50 PM
You are running SMF 1.1.8, so the file is at '{smf directory}/sources/Subs-SPortal1-1.php'. ;)

Make sure the "S" in "sources" is capitalized.
Title: Re: Board News: Add topic of different sections ?
Post by: Nathaniel on June 04, 2009, 05:27:17 PM
No, sorry, the edits are for the '{smf directory}/Sources/SPortal1-1.php' file. :/

If you attach that file then I can do the edits for you. :)
Title: Re: Board News: Add topic of different sections ?
Post by: edi67 on October 18, 2009, 02:39:11 AM
The Board News block assumes that you are only showing topics/boards that you want all users to see.

Replace this code:
Code: [Select]
   $request = $smcFunc['db_query']('', '
      SELECT id_first_msg
      FROM {db_prefix}topics AS t
         INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
      WHERE ' . (empty($boards) ? '{query_see_board}' : 'b.id_board IN ({array_int:current_boards})') . ($modSettings['postmod_active'] ? '
         AND t.approved = {int:is_approved}' : '') . '
      ORDER BY t.id_first_msg DESC
      LIMIT {int:limit}',
      array(
         'current_boards' => $boards,
         'is_approved' => 1,
         'limit' => $limit,
      )
   );

With this code:
Code: [Select]
   $request = $smcFunc['db_query']('', '
      SELECT id_first_msg
      FROM {db_prefix}topics AS t
         INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
      WHERE {query_see_board}
AND b.id_board IN ({array_int:current_boards})' . ($modSettings['postmod_active'] ? '
         AND t.approved = {int:is_approved}' : '') . '
      ORDER BY t.id_first_msg DESC
      LIMIT {int:limit}',
      array(
         'current_boards' => $boards,
         'is_approved' => 1,
         'limit' => $limit,
      )
   );

i need help please in simpleportal 2.3 where i can find that code to edit ?
SimplePortal 2.3.8 © 2008-2024, SimplePortal