PDA

View Full Version : Profile viewable to member only


cravendale
06-28-2013, 05:01 PM
Hi,

I've been looking around for a mod that will do this without any luck.

All I need it to do is allow either only the member to be able to view their own profile and no one else.

Or as above and with usergroup set permissions that can view profiles.

ForceHSS
06-28-2013, 05:40 PM
in usergroup pick the one you want to edit scroll down to General Permissions/Can View Member Info = No

cravendale
06-28-2013, 06:25 PM
This seems to also block the member of who's profile it is, from being able to view their own profile.

ForceHSS
06-28-2013, 07:47 PM
Did not have time to test.

--------------- Added 1372453289 at 1372453289 ---------------

Try posting that request here (https://vborg.vbsupport.ru/forumdisplay.php?f=112)

Simon Lloyd
06-28-2013, 10:38 PM
In the member_info blocks wrap the whole thing in this<vb:if condition="$userinfo['userid'] == $bbuserinfo['userid']">ALL THE PROFILE CODE</vb:if>now the only person that can view the stuff that you've wrapped in the conditional is the person who the profile belongs to!

ForceHSS
06-29-2013, 12:28 AM
In the member_info blocks wrap the whole thing in this<vb:if condition="$userinfo['userid'] == $bbuserinfo['userid']">ALL THE PROFILE CODE</vb:if>now the only person that can view the stuff that you've wrapped in the conditional is the person who the profile belongs to!

Good idea would use this myself but would be better if admins, super mods and mods can see others

exel
06-29-2013, 12:48 AM
<vb:if condition="$userinfo['userid'] == $bbuserinfo['userid'] && is_member_of($bbuserinfo, X, X, X)">
ALL THE PROFILE CODE
</vb:if>

X being the staff usergroup ids. :|

Simon Lloyd
06-29-2013, 12:56 AM
<vb:if condition="$userinfo['userid'] == $bbuserinfo['userid'] && is_member_of($bbuserinfo, X, X, X)">
ALL THE PROFILE CODE
</vb:if>

X being the staff usergroup ids. :|Lol beat me to it! :)

exel
06-29-2013, 01:10 AM
Wait, that's wrong, lol.

<vb:if condition="$userinfo['userid'] == $bbuserinfo['userid'] OR is_member_of($bbuserinfo, X, X, X)">
ALL THE PROFILE CODE
</vb:if>

ForceHSS
06-29-2013, 03:23 AM
So is that for groups or x = each member id

exel
06-29-2013, 06:53 AM
For groups.

cravendale
06-29-2013, 02:13 PM
So in Style Manager wrap the following?

memberinfo_block

Is that the correct one? and just that one?

Simon Lloyd
06-29-2013, 05:01 PM
Depends what you want to hide :), if you wanted to hide the "About Me" then you'd wrap the code from the "memberinfo_block_aboutme" if you want to hide the lot then wrap all the code in "memberinfo_block"

cravendale
06-29-2013, 07:25 PM
I do want to hide the whole lot and seen only be the person it belongs to and staff.

But when I use exel's code above and wrap it round the code for memberinfo_block.
The info can still be seen :|

*confused*

ForceHSS
06-29-2013, 08:41 PM
try make a normal user account and test it

cravendale
06-29-2013, 09:08 PM
Here is what I did...

I set "Can View Member Info" back to "Yes".

Then did changed it like this...

memberinfo_block

<vb:if condition="$userinfo['userid'] == $bbuserinfo['userid'] OR is_member_of($bbuserinfo, 5, 6, 7)">
<!-- {vb:raw id} -->
<div id="view-{vb:raw id}" class="block">
{vb:raw html}
</div>
<div class="underblock"></div>
<!-- / {vb:raw id} -->
</vb:if>

I did also try it as a "normal" user.
I was able to view other peoples profiles.

--------------- Added 1372544450 at 1372544450 ---------------

OK I just tried wrapping the code around "MEMBERINFO" without the _block.
And that seems to work. If another member tries to view a profile, they get a white screen.
No error messages etc... this sound right?

ForceHSS
06-29-2013, 09:25 PM
ur right it does not work

Simon Lloyd
06-29-2013, 10:40 PM
What doesn't work? what are you expecting to happen?, you shouldn't get a white screen you should get the headers, footers..etc but nothing in between.

--------------- Added 1372549477 at 1372549477 ---------------

Right just checked, you cant wrap the entire MEMBERINFO, you have to be a bit smarter and wrap waht you need so possibly just wrap from<!-- begin user css -->
<div id="usercss" class="floatcontainer">

<div id="content_container">
ADD THE CONDITION HERE
<div id="content">
and then add the </vb:if> before the last DIV on the template :), so that woyuld be here<!-- end usercss -->
ADD </vb:if> HERE!
</div>

cravendale
06-30-2013, 09:14 PM
Sorry if I'm been a bit dim here. But I don't get what you mean :|

So are we talking about the "MEMBERINFO" or the "memberinfo_block" as originally mentioned?

My memberinfo_block
<!-- {vb:raw id} -->
<div id="view-{vb:raw id}" class="block">
{vb:raw html}
</div>
<div class="underblock"></div>
<!-- / {vb:raw id} -->

My MEMBERINFO

{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml"<vb:if condition="$vboptions['enablefacebookconnect']"> xmlns:fb="http://www.facebook.com/2008/fbml"</vb:if> dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
<head>
{vb:raw headinclude}
<title>{vb:rawphrase view_profile}: {vb:raw prepared.username} - {vb:raw vboptions.bbtitle}</title>

<vb:if condition="$userinfo['userid'] == $bbuserinfo['userid']">
<script type="text/javascript">
vbphrase['edit_value_js'] = "{vb:rawphrase edit_value_js}";
vbphrase['server_failed_respond_try_again'] = "{vb:rawphrase server_failed_respond_try_again}";
</script>
<script type="text/javascript" src="clientscript/vbulletin_profilefield_edit.js?v={vb:raw vboptions.simpleversion}"></script>
</vb:if>
<script type="text/javascript" src="clientscript/vbulletin_quick_edit_generic.js?v={vb:raw vboptions.simpleversion}"></script>
<script type="text/javascript" src="clientscript/vbulletin_quick_edit_visitormessage.js?v={vb:raw vboptions.simpleversion}"></script>
<script type="text/javascript">
<!--

vB_XHTML_Ready.subscribe(init_PostBits_Lite);


function init_PostBits_Lite()
{
//var posts_container = YAHOO.util.Dom.get("posts");
var postbits = YAHOO.util.Dom.getElementsByClassName("postbit_lite", "li", "postlist");
for (var i = 0; i < postbits.length; i++)
{
new PostBit_Lite(postbits[i]);
}
}

function PostBit_Lite(postbit)
{
this.postbit = YAHOO.util.Dom.get(postbit);
this.postid = postbit.id.substr("piccom_".length);
this.inlinemod = new InlineModControl(this.postbit, this.postid, "imodsel");
}

//-->
</script>


<!--
{additional javascript files}
-->

{vb:raw usercss}

<vb:if condition="$vboptions['storecssasfile']">
{vb:cssfile memberinfo-rollup.css}
<vb:else />
{vb:cssfile forumbits.css,member.css,postbit.css,postbit-lite.css,showthread.css}
</vb:if>
<style type="text/css">{vb:raw template_hook.memberinfo_css}</style>

<!--[if IE 6]>{vb:cssfile member-ie.css}<![endif]-->


<script type="text/javascript">
<!--

function getParentElement(starterElement, classPattern, testTagName) {
//
var currElement = starterElement;
var foundElement = null;
while(!foundElement && (currElement = currElement.parentNode)) {
if ((classPattern && (currElement.className.indexOf(classPattern) != -1)) || (testTagName && (testTagName.toLowerCase() == currElement.tagName.toLowerCase())))
{
foundElement = currElement;
}
}
//go up the parentNode tree until found element with matching className
return foundElement;
}
//getParentElement

function tabViewPicker(anchorObject) {
//

var clickedTabId = null;

var tabtree = getParentElement(anchorObject,"tabslight");
var anchorInventory = tabtree.getElementsByTagName("a");

var tabIds = [];

for (var i=0; (currAnchor = anchorInventory[i]); i++) {
//
var anchorId = currAnchor.href.substring(currAnchor.href.indexOf("#") + 1, currAnchor.href.length);
var parentDd = getParentElement(currAnchor,null,"dd");
if (currAnchor == anchorObject) {
clickedTabId = anchorId;
parentDd.className = "selected";
} else {
parentDd.className = "";
}
tabIds.push(anchorId);
}

//loop thru anchors to gather all tab IDs and set appropriate selected status
for (var j=0; (currTabId = tabIds[j]); j++) {
//
var elem = document.getElementById("view-" + currTabId);
if (!elem) {continue;}
if (currTabId == clickedTabId) {
elem.className="selected_view_section";
} else {
elem.className="view_section";
}
}


//set appropriate status on all tabs.

return false;
}
//tabViewPicker

//-->
</script>


<vb:if condition="$show['post_visitor_message']">
<script type="text/javascript">
<!--
function goto_post_pm()
{
tabViewPicker(document.getElementById('visitor_mes saging-tab'));
fetch_object('view-visitor_messaging').scrollIntoView();

var textarea = fetch_object('visitor_message_form_textarea');
if (textarea)
{
textarea.focus();
textarea.select();
}
return false;
}
-->
</script>
</vb:if>
{vb:raw headinclude_bottom}
</head>

<body>
{vb:raw header}

{vb:raw navbar}

<div class="member_content">
<div class="profile_widgets member_summary" id="profile_tabs">
<div class="block mainblock">
<h1 class="blocksubhead">
<vb:if condition="$show['edit_profile']">
<a href="moderator.php?{vb:raw session.sessionurl}do=useroptions&amp;u={vb:raw userinfo.userid}" class="textcontrol imagecontrol"><img src="{vb:stylevar imgdir_button}/edit_40b.png" alt="{vb:rawphrase edit_user_profile}" /></a>
</vb:if>
<vb:if condition="is_member_of($bbuserinfo, 5,6,7)">
<a href="http://whois.domaintools.com/{vb:raw userinfo.ipaddress}" title="WhoIS" target="_blank"><img src="images/whois.png" title="WhoIS" /></a>
</vb:if>
<a href="md7084/banning.php?do=banuser&amp;u={vb:raw userinfo.userid}" class="textcontrol imagecontrol">
<img src="{vb:stylevar imgdir_misc}/cross.png" alt="Ban User" />
</a>
<span id="userinfo">
{vb:raw prepared.musername} {vb:raw prepared.onlinestatus}
<vb:if condition="$prepared['usertitle']">
<br />
<span class="usertitle">{vb:raw prepared.usertitle}</span>
</vb:if>
</span>
</h1>
<div id="userinfoblock" class="floatcontainer">
<vb:if condition="$vboptions['profilepicenabled']"><vb:if condition="$prepared['profilepicurl']">
<a class="avatar" href="{vb:link member, {vb:raw prepared}}" title="{vb:rawphrase xs_picture, {vb:raw prepared.username}}">
<span class="avatarcontainer"><img src="{vb:raw prepared.profilepicurl}" alt="" /></span>
</a>
<vb:else />
<a class="avatar" href="{vb:link member, {vb:raw userinfo}}" title="{vb:rawphrase xs_picture, {vb:raw userinfo.username}}">
<span class="avatarcontainer"><img src="{vb:stylevar imgdir_misc}/unknown.gif" alt="" /></span>
</a>
</vb:if></vb:if>
<ul id="usermenu" class="usermenu">
<vb:if condition="$prepared['canbefriend']">
<li><a href="profile.php?{vb:raw session.sessionurl}do=addlist&amp;userlist=friend&amp;u={v b:raw prepared.userid}"><img src="{vb:stylevar imgdir_siteicons}/add.png" alt="{vb:rawphrase add_as_friend}" class="inlineimg" /> {vb:rawphrase add_as_friend}</a></li>
</vb:if>
<vb:if condition="$show['contactlinks']">
<li><a href="private.php?{vb:raw session.sessionurl}do=newpm&amp;u={vb:raw prepared.userid}"><img src="{vb:stylevar imgdir_siteicons}/message.png" alt="{vb:rawphrase send_private_message}" class="inlineimg" /> {vb:rawphrase send_private_message}</a></li>
</vb:if>
<vb:if condition="$show['email']">
<li>
<a href="sendmessage.php?{vb:raw session.sessionurl}do=mailmember&amp;u={vb:raw prepared.userid}"><img src="{vb:stylevar imgdir_siteicons}/email.png" alt="{vb:rawphrase email}" class="inlineimg" /> {vb:rawphrase send_email}</a>
</li>
<vb:if condition="is_browser('safari')">&nbsp;</vb:if>
</vb:if>
<vb:if condition="$prepared['homepage']">
<li>
<a href="{vb:raw prepared.homepage}"><img src="{vb:stylevar imgdir_siteicons}/homepage.png" alt="{vb:rawphrase home_page}" class="inlineimg" /> {vb:rawphrase home_page}</a>
</li>
</vb:if>
<vb:if condition="$show['addignorelist']">
<li>
<a href="profile.php?{vb:raw session.sessionurl}do=addlist&amp;userlist=ignore&amp;u={v b:raw prepared.userid}"><img src="{vb:stylevar imgdir_siteicons}/ignore.png" alt="{vb:rawphrase add_to_ignore_list}" class="inlineimg" /> {vb:rawphrase add_to_ignore_list}</a>
</li>
</vb:if>
<vb:if condition="$show['removeignorelist']">
<li>
<a href="profile.php?{vb:raw session.sessionurl}do=removelist&amp;userlist=ignore&amp;u ={vb:raw prepared.userid}"><img src="{vb:stylevar imgdir_siteicons}/ignore.png" alt="{vb:rawphrase remove_from_ignore_list}" class="inlineimg" /> {vb:rawphrase remove_from_ignore_list}</a>
</li>
</vb:if>
<vb:if condition="$show['usernotes']">
<li>
<a href="usernote.php?{vb:raw session.sessionurl}u={vb:raw prepared.userid}"><img src="{vb:stylevar imgdir_siteicons}/note.png" alt="{vb:rawphrase user_notes}" class="inlineimg" /> {vb:rawphrase user_notes} ({vb:raw prepared.usernotecount})</a>
</li>
</vb:if>
<li class="separator"></li>
<li><a href="search.php?{vb:raw session.sessionurl}do=finduser&amp;userid={vb:raw userinfo.userid}&amp;contenttype=vBForum_Post&amp;showpost s=1"><img src="{vb:stylevar imgdir_siteicons}/forum.png" alt="{vb:rawphrase find_all_posts}" class="inlineimg" /> {vb:rawphrase find_all_posts}</a></li>
<li><a href="search.php?{vb:raw session.sessionurl}do=finduser&amp;userid={vb:raw userinfo.userid}&amp;starteronly=1&amp;contenttype=vBForum _Thread"><img src="{vb:stylevar imgdir_siteicons}/forum.png" alt="{vb:rawphrase find_all_started_threads}" class="inlineimg" /> {vb:rawphrase find_all_started_threads}</a></li>
<vb:if condition="$show['viewarticles']">
<li><a href="{vb:raw$ author_list_url}" rel='nofollow'><img src="{vb:stylevar imgdir_siteicons}/article.png" class="inlineimg" alt="" /> {vb:rawphrase view_articles}</a></li>
</vb:if>
<vb:if condition="$show['viewblog']">
<li><a href="blog.php?{vb:raw session.sessionurl}u={vb:raw userinfo.userid}" rel='nofollow'><img src="{vb:stylevar imgdir_siteicons}/blog.png" class="inlineimg" alt="" /> {vb:rawphrase view_blog_entries}</a></li>
</vb:if>
</ul>
</div>
</div>
<vb:comment>sidebar</vb:comment>
{vb:raw template_hook.profile_sidebar_first}
{vb:raw blocks.stats_mini}
{vb:raw template_hook.profile_sidebar_stats}
{vb:raw blocks.friends_mini}
{vb:raw template_hook.profile_sidebar_friends}
{vb:raw blocks.albums}
{vb:raw template_hook.profile_sidebar_albums}
{vb:raw blocks.groups}
{vb:raw template_hook.profile_sidebar_groups}
{vb:raw blocks.visitors}
{vb:raw template_hook.profile_sidebar_last}
<vb:comment>sidebar</vb:comment>
</div>
<div class="member_tabs">
<dl class="tabslight">
<dt>Tab Content</dt>
{vb:raw template_hook.profile_tabs_first}
<vb:if condition="$blocks[visitor_messaging]"><dd<vb:if condition="$selected_tab == 'visitor_messaging'"> class="selected"<vb:elseif condition="$selected_tab == '' AND $show['post_visitor_message']" /> class="selected"</vb:if>><a id="visitor_messaging-tab" class="wider" href="{vb:raw relpath}#visitor_messaging" onclick="return tabViewPicker(this);">{vb:rawphrase visitor_messages_tab}</a></dd></vb:if>
<dd<vb:if condition="$selected_tab == 'aboutme'"> class="selected"<vb:elseif condition="$selected_tab == '' AND !$show['post_visitor_message']" /> class="selected"</vb:if>><a id="aboutme-tab" href="{vb:raw relpath}#aboutme" onclick="return tabViewPicker(this);">{vb:rawphrase about_me}</a></dd>
<vb:if condition="$blocks[friends]"><dd<vb:if condition="$selected_tab == 'friends'"> class="selected"</vb:if>><a id="friends-tab" href="{vb:raw relpath}#friends-content" onclick="return tabViewPicker(this);">{vb:rawphrase friends}</a></dd></vb:if>
<vb:if condition="$blocks[infractions]"><dd<vb:if condition="$selected_tab == 'infractions'"> class="selected"</vb:if>><a id="infractions-tab" href="{vb:raw relpath}#infractions-content" onclick="return tabViewPicker(this);">{vb:rawphrase infractions}</a></dd></vb:if>
{vb:raw template_hook.profile_tabs_last}
</dl>
<div class="profile_content">
<div id="view-visitor_messaging" class="<vb:if condition="$selected_tab == 'visitor_messaging'">selected_view_section<vb:elseif condition="$selected_tab == '' AND $show['post_visitor_message']" />selected_view_section<vb:else />view_section</vb:if>">
{vb:raw blocks.visitor_messaging}
</div>
<div id="view-aboutme" class="<vb:if condition="$selected_tab == 'aboutme'">selected_view_section<vb:elseif condition="$selected_tab == '' AND !$show['post_visitor_message']" />selected_view_section<vb:else />view_section</vb:if>">
{vb:raw blocks.aboutme}
{vb:raw blocks.contactinfo}
{vb:raw blocks.stats}
</div>
<div id="view-friends-content" class="<vb:if condition="$selected_tab == 'friends'">selected_view_section<vb:else />view_section</vb:if>">
{vb:raw blocks.friends}
</div>
<div id="view-infractions-content" class="<vb:if condition="$selected_tab == 'infractions'">selected_view_section<vb:else />view_section</vb:if>">
{vb:raw blocks.infractions}
</div>
{vb:raw template_hook.profile_tabs}
</div>
</div>
</div>

{vb:raw footer}
</body>
</html>

Simon Lloyd
07-01-2013, 03:45 AM
Below this <div class="member_content"> put your opening condition and close it before the last </div> in memberinfo

cravendale
07-01-2013, 09:18 PM
Thanks that's worked a treat!!
:D

ForceHSS
07-02-2013, 12:13 AM
Strange I don't seem to have <div class="member_content"> in MEMBERINFO template even the default does not have it.

Simon Lloyd
07-02-2013, 08:14 AM
Strange I don't seem to have <div class="member_content"> in MEMBERINFO template even the default does not have it.In that case find the first <div after{vb:raw navbar} and put your IF condition right under it and the </vb:if> before the last </div> in the template.