yick
New Member
Posts: 7
inherit
268989
0
Jan 19, 2024 7:41:06 GMT -8
yick
7
January 2024
yick
|
Post by yick on Jan 10, 2024 8:43:45 GMT -8
FORUM PRIVATE
Thanks for the great service guys. Just started our forum so still learning.
Our forum is private. Allows registration but limits what new members can view until they complete a verification process. I would like new members to be able to view their own profile but not allow them to view other member profiles.
At the moment if a new member views their profile the browser link is say FORUM/user/10. If they change the 10 to another number then they can view that members profile which I would like to disable.
Thinking I need to add an if/else to the profile template but not sure how?
eg if $[current_user.group.name] == "New Member" Show ONLY their profile page else Show profile
Was thinking a redirect but not sure I can do this.
if $[current_user.group.name] == "New Member" redirect to FORUM/user/$[current_user.id] else Show profile.
Can anyone provide any pointers how I could acheive this?
|
|
yick
New Member
Posts: 7
inherit
268989
0
Jan 19, 2024 7:41:06 GMT -8
yick
7
January 2024
yick
|
Post by yick on Jan 11, 2024 13:21:23 GMT -8
OK, I found a way BUT this will only work on the Desktop Version of a site. You cannot edit the Mobile Version so for this to work you have to force all users to use the Desktop Version via /admin/upgrades/enhancements, far from ideal, but here goes anyhow.......
Admin/Themes/Layout Templates/User Profile
ADD TO THE TOP {if $[current_user.username] == ($[user.username]) || $[current_user.group.name] == "A MEMBER GROUP" || $[current_user.is_staff]}
ADD TO BOTTOM {else} <div class="container show-user"> <div class="title-bar"> <h1>View Profile</h1> </div> <div class="content cap-bottom"> <br> AN ERROR MESSAGE. <br> </div> </div> {/if}
NOTE: Change "A MEMBER GROUP" to a valid Member Group for your forum or just delete || $[current_user.group.name] == "A MEMBER GROUP" if that feature isn't required.
This allows the current user to view ONLY their OWN profile unless they are in A MEMBER GROUP or are staff. You also change the ERROR MESSAGE to suit. If they try and view any other profile they get the error message
THEN
Admin/Themes/Layout Templates/Forum Wrapper
Find the line with {if $[navigation.tree]} and change it to
{if $[navigation.tree]} {if $[current_user.username] == ($[user.username]) || $[current_user.group.name] == "A MEMBER GROUP" || $[current_user.is_staff]} <div id="navigation-tree"> $[navigation.tree] </div> {else} <div id="navigation-tree"> AN ERROR MESSAGE. </div> {/if} {/if}
Similar to earlier code so change as required. This stops another members username appearing in the navigation tree and shows an error message there instead UNLESS they are viewing their own profile or are staff or belong the member group.
|
|