Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: mickjav on September 04, 2021, 05:30:58 AM

Title: Extra Links In Profile
Post by: mickjav on September 04, 2021, 05:30:58 AM
Hi Been trying to add some links to my profile As Below

I can get the bookmarks to show but not the gallery, I do have another to add for Downloads

I Am trying to add the 3 links below the badge awards link

Even thought the Bookmarks shows it keep getting altered by the profile_areas Array

Any help would be appreciated

// End Badge Awards
'bookmarks' => array(
'title' => $txt['bookmarks'],
'href' => $scripturl . '?action=bookmarks',
'show' => allowedTo('make_bookmarks'),
'permission' => array(
'own' => 'profile_view_own',
'any' => 'profile_view_any',
),
),
'gallery' => array(
'title' => 'Gallery',
'href' => $scripturl . 'index.php?action=gallery;su=user;u=' && $context['id_member'],
'show' => true,
),
Title: Re: [FREE] Extra Links In Profile
Post by: Arantor on September 04, 2021, 05:37:49 AM
You need to set some permissions for it like the bookmarks one does, no permissions set means the system thinks you don't have permission to see it.
Title: Re: Extra Links In Profile
Post by: mickjav on September 04, 2021, 05:56:46 AM
Quote from: Arantor on September 04, 2021, 05:37:49 AMYou need to set some permissions for it like the bookmarks one does, no permissions set means the system thinks you don't have permission to see it.

Thanks Done That but it's still not showing.

The problem I'm having with the Bookmarks is the link keeps being altered from:
?action=bookmarks to ?action=profile;area=bookmarks;u=1
I receive error warning "You are not allowed to access this section"

// End Badge Awards
                'bookmarks' => array(
                        'title' => $txt['bookmarks'],
                        'href' => $scripturl . '?action=bookmarks',
                        'show' => allowedTo('make_bookmarks'),
                        'permission' => array(
                        'own' => 'profile_view_own',
                        'any' => 'profile_view_any',
                        ),
                    ),
                'gallery' => array(
                        'title' => 'Gallery',
                        'href' => $scripturl . 'index.php?action=gallery;su=user;u=' && $context['id_member'],
                        'show' => true,
                        'permission' => array(
                        'own' => 'profile_view_own',
                        'any' => 'profile_view_any',
                        ),
                    ),
Title: Re: Extra Links In Profile
Post by: Arantor on September 04, 2021, 06:25:13 AM
Ah, I forgot, the menu system isn't *really* designed to do what you're trying to do because it's designed to generate the menu and links automatically based on the sections defined - and is pointedly not the same as the main menu.

However... there is a way to override it explicitly, which should be the following:

// End Badge Awards
                'bookmarks' => array(
                        'title' => $txt['bookmarks'],
                        'custom_url' => $scripturl . '?action=bookmarks',
                        'show' => allowedTo('make_bookmarks'),
                        'permission' => array(
                                'own' => 'profile_view_own',
                                'any' => 'profile_view_any',
                        ),
                    ),
                'gallery' => array(
                        'title' => 'Gallery',
                        'custom_url' => $scripturl . 'index.php?action=gallery;su=user;u=' && $context['id_member'],
                        'show' => true,
                        'permission' => array(
                                'own' => 'profile_view_own',
                                'any' => 'profile_view_any',
                        ),
                    ),
Title: Re: Extra Links In Profile
Post by: mickjav on September 04, 2021, 06:54:11 AM
Thanks The Bookmarks link works great the only item of interest is the user ID is tagged on the end ";u=1" but does not seem an issue but I only have my data at the moment so will wait till more data available to see if it's going to be a problem.

I am unable to display the gallery link I have edited the links for $txt[] and added a value in the profile.English file as wasn't sure if the 'Gallery' was causing a problem.

'gallery' => array(
                        'title' => $txt['gallery_title'],
                        'custom_url' => $scripturl . 'index.php?action=gallery;su=user;u=' && $context['id_member'],
                        'show' => true,
                        'permission' => array(
                                'own' => 'profile_view_own',
                                'any' => 'profile_view_any',
                        ),
                    ),

Title: Re: Extra Links In Profile
Post by: mickjav on September 04, 2021, 06:57:02 AM
I have edited link as the default seems to add U=I on end

'gallery' => array(
                        'title' => $txt['gallery_title'],
                        'custom_url' => $scripturl . 'index.php?action=gallery;su=user',
                        'show' => true,
                        'permission' => array(
                                'own' => 'profile_view_own',
                                'any' => 'profile_view_any',
                        ),
                    ),