News:

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

Main Menu

Advanced News

Started by Matthew K., March 08, 2010, 03:12:30 AM

Previous topic - Next topic

live627

Mod updated to 1.2

* Takeover by live627.
! Small tweaks to the code that don't make any difference overall.
- Removed the ability to have news items clickable and redirect to the news page - seems a waste of template edits and principle to me...
+ Tweaked the template to look nicer in my eyes. See, I'm not a fan of big boxes everywhere - adds clutter. So use one round frame, separate the news items with a margin and a padding totaling 1em, and use a dotted grey border. See figure three on the mod page.
+ And, here is my favorite part. Refactored the code to use only hooks and no file edits. SWEET! I love it when I do that! The SMF coding god has endowed his powers on me. lol. No, no deity was involved.

Eclipse16V

Thanks for update

How do I get the button as a submenu in the home button?

What do I need exactly here?
function advanced_news_menu_buttons($menu_buttons)
{
global $txt, $context, $scripturl, $modSettings, $settings;

$new_button = array(
'title' => $txt['news'],
'href' => $scripturl . '?action=news',
'show' => empty($modSettings['disable_advanced_news_page']) && allowedTo('view_news') && !empty($settings['enable_news']),
);

$new_menu_buttons = array();
foreach ($menu_buttons as $area => $info)
{
$new_menu_buttons[$area] = $info;
if ($area == 'home')
$new_menu_buttons['news'] = $new_button;
}

$menu_buttons = $new_menu_buttons;
}
I worked with:
SMF 2 in German

Shop:
SID Giessen

Matthew K.

You'd just put
'sub_buttons' => array(
'title' => 'Sub Button 1',
'href' => $scripturl,
'show' => true,
),

live627

#23
Code (Find and remove) Select
$new_menu_buttons = array();
foreach ($menu_buttons as $area => $info)
{
$new_menu_buttons[$area] = $info;
if ($area == 'home')
$new_menu_buttons['news'] = $new_button;
}

$menu_buttons = $new_menu_buttons;


Code (Use this instead) Select
$menu_buttons['home']['sub_buttons']['news'] = $new_button;

Eclipse16V

I worked with:
SMF 2 in German

Shop:
SID Giessen

Karlsm

Installed without errors but I don't see the news menu button?

Box is left unchecked in the settings.


live627

  • Check for ./Sources/AdvancedNews.php and ensure that it exists
  • Make sure membergroup permissions are set

arcadios

#27
Quote from: Karlsm on August 08, 2011, 07:12:29 PM
Installed without errors but I don't see the news menu button?

Box is left unchecked in the settings.

same for me, No news button on menu.

./Sources/AdvancedNews.php   file exists
permissions looks fine

i have earlier manually added a new button [website] on the menu bar, don't know if this is a conflict ??

live627

What is your cache settings?
Did you remove the home button, by any chance?

arcadios

cache settings "level one"
memcache parametres  [none]

jus aded a new button in fron of the home one...

vkbr

Love this mod. Thanks. I wonder, would be great to have different news for each membergroup. Is that possible?
thanx
vk

Matthew K.

Not with this mod it's not. Although I did develop a mod called "Advanced News 2.0" which completely re-writes the whole system, never finished it. Too much like the forums themselves.

vkbr

Well, i'd love to have it...
thanks for answer.
vk

Michael Pfaff

How do I make it so that a membergroup can see the News page but not Edit it?

Right now, as admin, I can see the News page, but the only options I see for permissions are to Edit the News and send out Newsletters.

What if I just want one membergroup to see the News page?

live627

The permission for this mod  should be under :"Use basic forum functionality". I trust that you are using one of the "gold" releases?

Michael Pfaff

Quote from: live627 on January 17, 2012, 06:46:40 PM
The permission for this mod  should be under :"Use basic forum functionality". I trust that you are using one of the "gold" releases?

Ah, great! I found it. Thank you.

Michael Pfaff

One more quick question: is there any way to have the news show up on the News page in order of the latest addition to the news?

Right now, at the top of my News page it has the oldest News item.

live627

Quote from: Michael Pfaff on January 17, 2012, 07:19:24 PM
Quote from: live627 on January 17, 2012, 06:46:40 PM
The permission for this mod  should be under :"Use basic forum functionality". I trust that you are using one of the "gold" releases?

Ah, great! I found it. Thank you.
Yeah, it's not in the same spot as the other news permission because viewing the news page isn't an admin task but is closer to a basic feature.. :)

Quote from: Michael Pfaff on January 17, 2012, 07:21:58 PM
One more quick question: is there any way to have the news show up on the News page in order of the latest addition to the news?

Right now, at the top of my News page it has the oldest News item.
No.

Michael Pfaff

Quote from: live627 on January 17, 2012, 07:32:34 PM
Yeah, it's not in the same spot as the other news permission because viewing the news page isn't an admin task but is closer to a basic feature.. :)

Right on. Thanks for the hasty response.

Quote from: live627 on January 17, 2012, 07:32:34 PM
Quote from: Michael Pfaff on January 17, 2012, 07:21:58 PM
One more quick question: is there any way to have the news show up on the News page in order of the latest addition to the news?

Right now, at the top of my News page it has the oldest News item.
No.

Darn. That means this mod is less useful to me.  :'(

live627

SMF stores the news in a weird way. All the entries are stored in a single setting, which means without dates, or other reliable sorting aids. However, it explodes them into a simple aarray which can be reversed in bulk, so the first becomes last and vice versa.

Advertisement: