View Full Version : How to display homepage in memberinfo_profilefield_category?
pokusek
11-30-2012, 04:22 PM
I want to show homepage URL set by users in template memberinfo_profilefield_category (under all profile fields.) I've tried using conditions:
<vb:if condition="$show['homepage']">
<vb:if condition="$prepared['homepage']">
But one of them displayed the content even if the user of currently viewed profile has set their homepage.
Any advices?
Lynne
11-30-2012, 04:37 PM
Perhaps the $show variable isn't available for use in that template. Did you take a look at the code and see? I just took a look and the only variable registered for use in that template is $category. Did you try that?
pokusek
11-30-2012, 07:08 PM
Well, I don't really know where to find such information so I just copied pieces of code from other templates in a hope that it would work but for the reason you mentioned it didn't.
Using $category as a variable also doesn't help. I also tried pasting these conditions into other MEMBERINFO templates but without any luck.
How to make it work?
Lynne
12-01-2012, 12:35 AM
If $show[homepage] is a real variable, then it could be that $show isn't registered. Try using something like $show[member] (will only show to logged in members) and see if it works and then you will know if $show works there. If it doesn't, then that means the variable isn't registered. If it does work, then that means $show[homepage] isn't defined. So, we need to know which it is.
pokusek
12-03-2012, 09:43 AM
$show[member] is works, thus $show[homepage] isn't defined. What would you suggest to do about it?
Lynne
12-03-2012, 04:47 PM
You'll need to write a plugin to define it before you can use it.
pokusek
12-03-2012, 04:51 PM
I have not any experience with that, could you please tell me what code should be there or where can I find more relevant information?
Lynne
12-03-2012, 06:00 PM
I would try using the hook just above the code for the template which is member_profileblock_profilefield_category and perhaps set the $show variable based on $this->profile->prepared['homepage'] which is mentioned in that page (class_profileblock.php) also.
pokusek
12-03-2012, 06:25 PM
I tried using $show['homepage'] = $this->profile->prepared['homepage']; in my plugin but it didn't work ( <vb:if condition="$show['homepage']"> was not executed). I am not sure if I understood what you meant.
//This actually made some links from my navbar disappear, heh :)
I'm not sure what you're trying to do, are you trying to display the homepage only if a user has one entered? Maybe try this:
$show['homepage'] = !empty($this->profile->prepared['homepage']);
pokusek
12-03-2012, 08:34 PM
Exactly, I need to display it in template "memberinfo_profilefield_category".
Lynne: Are you sure that "member_profileblock_profilefield_category" is the right hook? The conditional tag still doesn't get executed.
Lynne
12-04-2012, 09:20 PM
You can try a different hook. I just did a search in the files for the template name and picked the one right above there. But, you may want to use one from before that. If you go into debug mode, you can see the order of the hooks and try picking one from before then.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.