vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   conditional for member viewing to only see (https://vborg.vbsupport.ru/showthread.php?t=298369)

dethfire 05-22-2013 01:16 AM

conditional for member viewing to only see
 
I have a section in memberinfo that I want only the member of that profile to see. aka if I am viewing my profile, I want a section only I can see. What is that conditional? thanks!

Lynne 05-22-2013 02:11 AM

It would help to know what template you are adding this code to.

dethfire 05-22-2013 02:31 AM

memberinfo

will this do?

<if condition="$bbuserinfo['userid'] == $userinfo['userid']">

Lynne 05-22-2013 03:50 PM

It should.

snakes1100 05-22-2013 08:26 PM

vb3 programming section Lynne

Xexiu 05-22-2013 09:21 PM

Hello Lynne.

That code worked for me. I added:

Code:

<if condition="$userinfo['userid'] == $bbuserinfo['userid']"></if>
And the "button" only showed for the user that was browsing. Now my question is:

How do I do this?

http://www.vbulletin.com/forum/forum...ms#post3971219

Lynne 05-23-2013 12:59 AM

You said you wanted to only show some code to the viewer if they are viewing their own profile, so doesn't that condition do that?

As for the code you linked to, you are getting the avatar for the viewer of the page, not the profile owner.

Xexiu 05-23-2013 12:19 PM

And whats the code to show the avatar for the profile owner?

I need something like this:

<if condition="$show['profile_owner']">
<img scr="url_to_avatar_of_profile_owner" /> // similar as the one I made $user_ava[0]
<else />
<img src="no_avatar.gif" />
</if>

I had tried "prepared[avatarurl] in <img src="prepared[avatarurl]" />, (other than $user_ava[0]") but doesn't work!

See example:

http://www.1st-hacks.com/members/prue.html

The avatar is shown correctly on ministats_block but not on profile (below the profile picture)!

Lynne 05-23-2013 07:13 PM

You need to use php, a plugin, to get the avatar based on who is viewing.

But I don't understand.... if you are the profile owner and viewing the page, you want to show the profile owners avatar, otherwise you want to show the no_avatar.gif - is that correct? If not, please write out your condition in a sentence like I just did.

Xexiu 05-24-2013 12:47 AM

Ok, let me explain myself. I have a plugin that shows avatar on all pages. The plugin is:

Code:

require_once('./includes/functions_user.php');
  $user_ava = fetch_avatar_url($vbulletin->userinfo['userid']);

if ($user_ava[0] == "")
  $user_ava[0] = "http://www.1st-hacks.com/images/as4/avatars/user.gif";

It uses $user_ava[0] to display the avatar. So <img src="$user_ava[0]" /> Show's the user avatar.

Ok, now here it the problem/question/issue! I had modified the memberinfo template to show an avatar 160x160 dimensions using $user_ava[0]. The good news: It shows up.

- Now here comes the bad news. The avatar is showing under the profile picture and shows the avatar of the current userid (user whom is browsing right now the forum - his/her avatar). Thats ok, if he browses his/her profile (his/her avatar will show up - ok).

- But when he goes to another profile (different than her/his profile), the avatar should be of that user/profile, not her/his (the one that browsing). By default it shows the avatar of the user bowsing on all pages. Don't know if you get me.

I need a conditional to say, something like:

If the actual user is browsing his/her profile, show her/his avatar. If he browses a different profile, show the avatar of that profile/user.


P.D. Does nothing to do with this thread, but whats the conditional "php" to show to userid? I know that the template conditional is: <if condition="$bbuserinfo['userid'] == 1"></if> // shows to ID 1 // But how do you do the same in php plugin?

darnoldy 05-24-2013 01:35 AM

Quote:

Originally Posted by Xexiu (Post 2423821)
If the actual user is browsing his/her profile, show her/his avatar. If he browses a different profile, show the avatar of that profile/user.

Okay, so you say this a different way...you want people's avatar to be displayed on their profile page?

You shouldn't need a plugin for that--just a template edit. In the postbit, the avatar is displayed by the following code:
HTML Code:

<img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" />
I would start by changing $post to $userinfo...
HTML Code:

<img src="$userinfo[avatarurl]" $userinfo[avwidth] $userinfo[avheight]  alt="<phrase  1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0"  />
and placing that code in the memberinfo template, to see if that works.

--don

Xexiu 05-24-2013 07:44 PM

Thanks don,

Tested it and doesnt work!

I have thge following code:

Code:

<if condition="$prepared['profilepicurl']">
<img src="$user_ava[0]" /> // Shows the currently user avatar (the one that's browsing his/her profile)
<else />
<img src="$userinfo[avatarurl]" /> // Doesnt show the avatar (no image) on other profiles, neither on his/her own if I change $user_ava[0]!
</if>

Quote:

Originally Posted by darnoldy (Post 2423826)
Okay, so you say this a different way...you want people's avatar to be displayed on their profile page?

You shouldn't need a plugin for that--just a template edit. In the postbit, the avatar is displayed by the following code:
HTML Code:

<img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" />
I would start by changing $post to $userinfo...
HTML Code:

<img src="$userinfo[avatarurl]" $userinfo[avwidth] $userinfo[avheight]  alt="<phrase  1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0"  />
and placing that code in the memberinfo template, to see if that works.

--don


Lynne 05-24-2013 08:49 PM

It's only going to work if you write a plugin that gets the avatarurl for you. There would be no reason for the query regarding the profile user to include avatar information if it wasn't needed on the page. What I don't get though is that the avatar is already shown on the member.php page, so shouldn't the actually template code already be in the template?

darnoldy 05-24-2013 08:53 PM

Quote:

Originally Posted by Xexiu (Post 2423981)
Tested it and doesnt work!

If
Code:

<img src="$userinfo[avatarurl]" />
doesn't work, Then I would try:
Code:

<img src="$prepared[avatarurl]" />
if that doesn't work, we can hope that somebody with better resources will chime in.

--don

Xexiu 05-25-2013 01:40 AM

Quote:

Originally Posted by darnoldy (Post 2423991)
If
Code:

<img src="$userinfo[avatarurl]" />
doesn't work, Then I would try:
Code:

<img src="$prepared[avatarurl]" />
if that doesn't work, we can hope that somebody with better resources will chime in.

--don

Hi don,

Yeah tried it before "$prepared[avatarurl]" and it has the same result (doesn't show nothing). I'm getting a bit desesperate!!

Any news Lynne?

Lynne 05-25-2013 02:21 AM

Quote:

Originally Posted by Xexiu (Post 2424030)
Any news Lynne?

I already commented and you didn't reply back to my comments, so I'm not sure what else you want from me.

Xexiu 05-25-2013 03:52 PM

Quote:

Originally Posted by Lynne (Post 2423777)
You need to use php, a plugin, to get the avatar based on who is viewing.

But I don't understand.... if you are the profile owner and viewing the page, you want to show the profile owners avatar, otherwise you want to show the no_avatar.gif - is that correct? If not, please write out your condition in a sentence like I just did.


Quote:

if you are the profile owner and viewing the page, you want to show the profile owners avatar, otherwise you want to show the no_avatar.gif
If I am the profile owner and visit my profile, show my avatar. Else, if visit others profile, show others avatar on their profile.

Lynne 05-25-2013 04:25 PM

But.... really what you are saying is showing the profile users avatar on the profile users profile - no? And, isn't the profile user's avatar already shown on their profile?

Simon Lloyd 05-25-2013 05:13 PM

Quote:

Originally Posted by Xexiu (Post 2424150)
If I am the profile owner and visit my profile, show my avatar. Else, if visit others profile, show others avatar on their profile.

This is how vbulletin works as standard???????

Xexiu 05-26-2013 11:44 PM

I think that I didn't explained myself.

I see my avatar "$prepared[avatarurl]" on my profile (avatar image). But when I visit others profile its "hidden" not showd.

Simon Lloyd 05-27-2013 12:05 AM

you mean the other peoples avatars are missing when you view their profile???


All times are GMT. The time now is 05:23 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01252 seconds
  • Memory Usage 1,774KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_code_printable
  • (4)bbcode_html_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (21)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete