TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,021
  • Total Topics: 21,332
  • Online today: 744
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 163
  • Total: 163

Link to articles in the menu

Started by WillyP, November 21, 2011, 09:21:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WillyP

Link to my site:http://planetdescent.net
SMF version: SMF 2.0.1
TP version: TP 1.104
Theme name and version: a copy of default modified by me
Browser Name and Version: Firefox 7.0.1

Mods installed:

  • TinyPortal  1.104
  • Avea Media 1.4w
  • Bad Behavior mod 1.5.5
  • BBC Spoiler 1.0
  • httpBL 2.5.1
  • reCAPTCHA for SMF 0.9.8a
  • Stop Spammer 2.3.9
  • Ultimate Profile 0.9.1

Related Error messages: None

I wanted my article categories link from the regular menu bar, so I added this to the menu in subs.php:
$buttons = array(
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),
'forum' => array(
'title' => isset($txt['tp-forum']) ? $txt['tp-forum'] : 'Forum',
'href' => $scripturl . '?action=forum',
'show' => true,
),
'articles' => array(
'title' => 'Articles',
'href' => $scripturl . '?page=4',
'show' => true,
'sub_buttons' => array(
'general' => array(
  'title' => 'General Articles',
  'href' => $scripturl . '?cat=4',
  'show' => true,
),
   'd3articles' => array(
  'title' => 'Descent 3 Articles',
  'href' => $scripturl . '?cat=7',
  'show' => true,
  'sub_buttons' => array(
   'd3missionreviews' => array(
  'title' => 'Descent 3 Mission Reviews',
  'href' => $scripturl . '?cat=9',
  'show' => true,
),
'd3edit' => array(
  'title' => 'Descent 3 Level Editing',
  'href' => $scripturl . '?cat=8',
  'show' => true,
),
),
),
'd1d2articles' => array(
  'title' => 'Descent 1 & 2 Articles',
  'href' => $scripturl . '?cat=6',
  'show' => true,
  'sub_buttons' => array(
   'd3missionreviews' => array(
  'title' => 'Descent 1 & 2 Mission Reviews',
  'href' => $scripturl . '?cat=12',
  'show' => true,
),
'd3edit' => array(
  'title' => 'Descent 1 & 2 Level Editing',
  'href' => $scripturl . '?cat=10',
  'show' => true,
),
),
),
),
),


This works great! Note the first link 'Articles' appears in the menu bar and links to an article, which I will write to include a bit about our article system. The rest of the links lead to each category. This all works fine.

However, the link in the menu titled 'Tiny Portal' appears in the menu for anyone who has permission to write articles. I have tried to move it to the bottom of the categories menu but it does not seem to work there. I would like to hide the 'Tiny Portal' button for article writes who do not have TP admin permission, and have direct links to 'Submit BBC Articles', and 'Manage My Articles' For those who have permission to do so. Those who have permission will be placed in a group called 'Article Writers'.

First i tried adding the whole block of the link to tp admin to the code above, that resulted in a blank page.
then I changed to url and tried some variations of href' => $scripturl . '?action=tpadmin;sa=addarticle_bbc', but none seem to work.

I would like to have something like this:
$buttons = array(
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),
'forum' => array(
'title' => isset($txt['tp-forum']) ? $txt['tp-forum'] : 'Forum',
'href' => $scripturl . '?action=forum',
'show' => true,
),
'articles' => array(
'title' => 'Articles',
'href' => $scripturl . '?page=4',
'show' => true,
'sub_buttons' => array(
'general' => array(
  'title' => 'General Articles',
  'href' => $scripturl . '?cat=4',
  'show' => true,
),
   'd3articles' => array(
  'title' => 'Descent 3 Articles',
  'href' => $scripturl . '?cat=7',
  'show' => true,
  'sub_buttons' => array(
   'd3missionreviews' => array(
  'title' => 'Descent 3 Mission Reviews',
  'href' => $scripturl . '?cat=9',
  'show' => true,
),
'd3edit' => array(
  'title' => 'Descent 3 Level Editing',
  'href' => $scripturl . '?cat=8',
  'show' => true,
),
),
),
'd1d2articles' => array(
  'title' => 'Descent 1 & 2 Articles',
  'href' => $scripturl . '?cat=6',
  'show' => true,
  'sub_buttons' => array(
   'd3missionreviews' => array(
  'title' => 'Descent 1 & 2 Mission Reviews',
  'href' => $scripturl . '?cat=12',
  'show' => true,
),
'd3edit' => array(
  'title' => 'Descent 1 & 2 Level Editing',
  'href' => $scripturl . '?cat=10',
  'show' => true,
),
),
),
                                'submitbbc' => array(
    'title' => 'Submit a BBC Article',
    'href' => $scripturl . '?action=tpadmin;sa=addarticle_bbc',
    'show' =>  HAS PERMISSION TO SUBMIT BBC ARTICLE(),
    'sub_buttons' => array(
),
                                 'myarticles' => array(
    'title' => 'Manage Your Articles',
    'href' => $scripturl . '?action=tpmod;sa=myarticles',
    'show' =>  HAS PERMISSION TO EDIT OWN ARTICLES(),
    'sub_buttons' => array(
),
),


Then change the link to TP Admin so only admins can see it.

IchBin

The TPAdmin links are generated in the Subs.php file from this code which references a function in the TPSubs.php file.

// tinyportal //
$buttons['tpadmin']['sub_buttons'] = tp_getbuttons();


You could make that menu disappear for everyone but admin by putting a check in front of it.
// tinyportal //
                if (allowedTo('tp_settings'))
$buttons['tpadmin']['sub_buttons'] = tp_getbuttons();


To check for the different article permissions.
allowedTo('tp_submithtml')
allowedTo('tp_submitbbc')

If you want to get anymore customized than what TP inserts into the menu, you are going to have to add to the Subs.php menu like you already have begun. :) If you get stuck after this bit of info, post your code that you have and I can take a look.

WillyP

Add to the menu is exactly what I want to do, if that was not clear I apologize. I would like to have it all in the menu and not have another block for people to submit articles. Having a drop-down in the menu titles 'Tiny Portal' isn't right, I could re-name it 'Submit Article' but I would much rather have that under the 'Articles' heading that I have already added. Even if I could just move the 'Tiny Portal' drop-down and re-name it, that would be fine, as nobody else has access to manage blocks etc., anyway. I just haven't been able to move it there, I get a blank page whenever I try.

I should have some time tomorrow to work on it some more.

This website is proudly hosted on Crocweb Cloud Website Hosting.