Custom Module Standard User

SoftDesigns
SoftDesigns
@softdesigns
6 years ago
242 posts
Hi - Now testing a custom profile module, and all is going well, except one small security setting:
--
When we test as "Standard" user, we do not see the module tab on profile. However, when we test as "Profile Admin" the custom module tab shows on profile.
--
How to adjust the custom module security, so all "Standard" users, can see our new custom module tab on the relevant profile?
updated by @softdesigns: 12/16/18 01:51:30AM
michael
@michael
6 years ago
7,714 posts
If you've yet to create anything for that module, nothing will show.

If the user has not yet created any blog posts, the blog tab will not show because there is nothing to see when the visitor goes there.

If the user is able to upload audio, but has not yet, then the audio tab will not show to others on their profile.

Admin and the Profile owner will always be able to see the tabs.

Just like Admin will see private items in any lists. Admin sees everything.
SoftDesigns
SoftDesigns
@softdesigns
6 years ago
242 posts
michael:
If you've yet to create anything for that module, nothing will show.

Yes, I see your point with standard JR Modules like blog, audio. Since this is a custom coded JR Module, for testing, it does not collect or store any user data in JR. Some custom modules may not store JR data per say. So there would be no way for JR to check for data, to show buttons.

Any way we can just set to show a module to all "Standard" users? (even if no JR data will be created, or user will not store any JR data for this module?)
paul
@paul
6 years ago
4,326 posts
In that case, maybe show the link as a (dropdown) User Menu item?
You can just create one using ACP=>Core=>System Core=>Tools=>User Menu Editor or you could add it to the module's init function in the include.php file. Checkout one of the modules that does this (eg. jrFollower include.php line 65ish) to see how its done.
hth


--
Paul Asher - JR Developer and System Import Specialist
SoftDesigns
SoftDesigns
@softdesigns
6 years ago
242 posts
paul:
In that case, maybe show the link as a (dropdown) User Menu item?
You can just create one using ACP=>Core=>System Core=>Tools=>User Menu Editor or you could add it to the module's init function in the include.php file. Checkout one of the modules that does this (eg. jrFollower include.php line 65ish) to see how its done.
hth

    // Skin menu link to 'following'
    $_tmp = array(
        'group' => 'user',
        'label' => 37, // 'Profiles I Follow'
        'url'   => 'following'
    );
    jrCore_register_module_feature('jrCore', 'skin_menu_item', 'jrFollower', 'following', $_tmp);

We found some code from jrFollower above, maybe this code is what you suggest to add menu link?
--
We are hoping to keep all functions on the Profile, using profile buttons, since the menus links are more difficult to find especially on the mobile.
--
Is there any way to have "read only" (no stored data) custom profile module tabs, show for all "Standard Users"
paul
@paul
6 years ago
4,326 posts
Yes - That's the example code.

Quote: Is there any way to have "read only" (no stored data) custom profile module tabs, show for all "Standard Users"
Yes - Take a look at you skin's profile_menu.tpl template and add them there, after the {foreach} loop. say.


--
Paul Asher - JR Developer and System Import Specialist
SoftDesigns
SoftDesigns
@softdesigns
6 years ago
242 posts
@paul - Great, I will check out and study the Ninja skin: profile_menu.tpl
--
JR = Powerful Platform - always something new to learn...
--
Great Support :)
SoftDesigns
SoftDesigns
@softdesigns
6 years ago
242 posts
I found this code in: profile_menu.tpl

{if isset($_items)}
{foreach $_items as $module => $entry}
    {if $entry.active == '1'}
    <a href="{$entry.target}" class="t{$module}"><div class="profile_menu_entry profile_menu_entry_active">{$entry.label}</div></a>
    {else}
    <a href="{$entry.target}" class="t{$module}"><div class="profile_menu_entry">{$entry.label}</div></a>
    {/if}
{/foreach}
{/if}

If we hard-code a change to this template, my guess is we would also have to hard-code the mobile version of this template.
--
Based on the code above, it seems if the module logic - {if $entry.active == '1'} - then the module tab will show?
--
IDEA: So would it be possible, say in the custom module php code, to "manually" set and force the custom module to always be "active" even if it is read only, and stores no data? Then it seems the module might show on desktop, and mobiles with no template code changes?
updated by @softdesigns: 09/15/18 11:08:42AM
paul
@paul
6 years ago
4,326 posts
The $entry.active parameter test is just to change the colour of the tab, to show that you are viewing the tab's page.
You can do something similar by testing the $_post array parameters to see if you are on your custom module's page -
{if isset($_items)}
{foreach $_items as $module => $entry}
    {if $entry.active == '1'}
    <a href="{$entry.target}" class="t{$module}"><div class="profile_menu_entry profile_menu_entry_active">{$entry.label}</div></a>
    {else}
    <a href="{$entry.target}" class="t{$module}"><div class="profile_menu_entry">{$entry.label}</div></a>
    {/if}
{/foreach}
{/if}

{if $_post.module == 'myCustomModule'}
    <a href="LINK TO MY MODULE PAGE"><div class="profile_menu_entry profile_menu_entry_active">MY MODULE TAB TEXT</div></a>
{else}
    <a href="LINK TO MY MODULE PAGE"><div class="profile_menu_entry">MY MODULE TAB TEXT</div></a>
{/if}

hth


--
Paul Asher - JR Developer and System Import Specialist

Tags