Log in

View Full Version : Custom User Profile Field in My Template


yotsume
09-26-2009, 07:20 AM
Custom User Profile Field in My Template?

How can I add each member's custom profile fields they have entered in my template below. I need the fields to be their info in the fields and not my info.

I am trying to get this template to look like this:

User Name
Membership Category from Country
(Note the red are the fields I need to pull for each member. I used: $bbuserinfo this however makes all the information my information. How do I code this to be the specific user's custom fields and not mine?) I need the two custom fields to match the new member's fields.

(PLEASE SEE ATTACHED SCREEN SHOT)


<if condition="$latest_members_count%3 == '1'"><tr></if>
<td class="$bgclass" align="center">

<if condition="$vboptions[c_news_letter_show_avatar]">
<img src="$member[avatarurl]" alt="$member[username]'s $vbphrase[avatar]" />
</if>

<div class="smallfont"><a href="$vboptions[bburl]/member.php?u=$member[userid]">$member[username]</a></div>
$bbuserinfo[field10] from: $bbuserinfo[field24]
</td>
<if condition="$latest_members_count%3 == '0'"></tr></if>

Lynne
09-26-2009, 03:58 PM
What template are you adding this code to? What does the query look like that grabs this information? That will make a difference on the name of the variable to use.

yotsume
09-26-2009, 05:29 PM
What template are you adding this code to? What does the query look like that grabs this information? That will make a difference on the name of the variable to use.

The template here is not a standard vb template but it is for a custom mod by ProVB called Community Newsletter. I have sent a request to that developer as well... however I needed to ask here as well because I needed an answer in a more timely manner and that coder can often be quite busy.

I am not sure what more I could provide you to help here...

Lynne
09-26-2009, 07:04 PM
I need the variable name which is in the code where the query is. And, your query needs to have grabbed the needed fields, and since I don't know the query, I have no idea if the fields are including in the query.

yotsume
09-27-2009, 03:27 AM
I need the variable name which is in the code where the query is. And, your query needs to have grabbed the needed fields, and since I don't know the query, I have no idea if the fields are including in the query.

Ok so where would I find the query to send to you? I do not want to attached the mod here and your not receiving PMs so whats next?

Thanks!

--------------- Added 1254026413 at 1254026413 ---------------

Maybe this will help.

Here is the lite version of this mod. I have a paid for version...

https://vborg.vbsupport.ru/showthread.php?t=190082&highlight=community+newsletter

Lynne
09-27-2009, 03:47 AM
I have PMs turned off because even though my sig asks for users to post in the forums for help instead of PMing me, they do it anyway, so it's just easier to leave them off.

All that needs to be known is the query (to see if they grab the fields from the userfield table) and then a couple lines after that where the variable name is used (while ($this == $that.... ) line) so we know the name of the variable.

Have you tried just using the variable name $member for those fields? That would be my guess for the variable name since it is already used in the template.

yotsume
09-27-2009, 04:05 AM
Here is some portion for you... No i dea if its what you need to help:

// Get Members
$members = $db->query_read("
SELECT user.email, user.userid, user.username " . iif((!empty($vbulletin->options['c_news_letter_field'])),",userfield." . $vbulletin->options['c_news_letter_field'] . "") . "
FROM " . TABLE_PREFIX . "user AS user
" . iif((!empty($vbulletin->options['c_news_letter_field'])),"LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON (userfield.userid = user.userid)") . "
WHERE user.userid >= " . $vbulletin->GPC['startat'] . "
" . iif((!empty($vbulletin->options['c_news_letter_field']))," AND (userfield." . $vbulletin->options[c_news_letter_field] . " = '" . $vbulletin->options[c_news_letter_field_yes] . "' OR userfield." . $vbulletin->options[c_news_letter_field] . " = '')") . "
" . iif((!empty($vbulletin->GPC['usergroups'])), "AND user.usergroupid IN ('" . implode("','",$c_news_letter_filter_usergroups) . "')") . "
ORDER BY user.userid ASC
LIMIT " . $vbulletin->GPC['perpage']
);

while ($member = $db->fetch_array($members))

Just using: $member[field10] in the template doesn't show anything.

Lynne
09-27-2009, 04:17 AM
OK, yes, $member is the variable you would use. However, it doesn't look like the userfields are grabbed in the query. So, the query will have to be modified to include the needed fields from that table. Writing queries is not my strong point, so I don't even try to do it on here.

yotsume
09-27-2009, 04:23 AM
Well I am back to square zero and in the hands of the developer. His response time and support is unknown and always he answers what ever he decides to and in parts.

So I payed for a mod that has some bugs and as usual there is little support... HOHUM... I will give him a couple more days and then have to get third party help yet again...

Thanks so much for your time here. It will be nice when I have it all coded and working.

Lynne
09-27-2009, 04:31 AM
It may be that someone else who is good with queries can help out here. I'm just not willing to screw up a query for someone else. It looks like it shouldn't be too hard (it just needs to be rearranged a little cuz the join only happens if another condition is met).

toolblast
05-10-2010, 01:57 PM
Anyone know how to put the customfield into a vbulletin email to users?

Ie. I have a custom field called 'first name' and it's field 15. I want to be able to put in my email $bbuserinfo[field15] and be able to say "hello <firstname>!"

Ideas?