minibb®
Fight the automated spam - protect your miniBB-forums,
getting the Captcha addon! Click here to read more.
Captcha Addon for miniBB
Community Forum
 | Forums | File Bank | Sign Up | Reply | Search | Statistics | Manual |
Master Class miniBB Community Forum / Master Class /

Getting parsed values of user profile fields specified under $userInfoInPosts

 Page:  1  2  3  »» 
gorin
Forums Member
#1 | Posted: 30 Mar 2005 21:42 | Edited by: gorin
Reply 
I don't understand what should I do to get this:
user-fields (e.g. $userInfo_user_website) should be displayed under user's nickname ONLY if this field is not emty.

Now I'm using this settings:
In setup_options.php:
$userInfoInPosts=array('user_website');

And in main_posts_cell.html:
<span class=txtSm><a href="{$userInfo_user_website[$poster_id]}">~www</a></span>

And if some user didn't fill this field during registration i've got a link under his name which pointed to current page. But i want get nothing about this field if it is emty (i don't need even '~www' in this case :)).

Another words I want to implement this as in this forum :)

If i'm clearly understood manual, templates are parsed only for variables substitution. Therefor i can't use 'if' statement inside templates or i'm wrong?

What should I do ?
Team
8-)
#2 | Posted: 31 Mar 2005 10:52
Reply 
Open bb_plugins.php and add that function:

function parseUserInfo_user_website($web){
if($web!='') return "<a href=\"$web\" target=\"_blank\"><span class=txtSm>~www</span></a>"; else return '';
}

It's not still documented because we still have ZERO time to do complete manuals...
Team
8-)
#3 | Posted: 31 Mar 2005 10:54
Reply 
Yeah, and add simply

<span class=txtSm>{$userInfo_user_website[$poster_id]}</span>

in a template.

Actually, for any specified user_info field, you may write the function with syntax function parseUserInfo_user_info($user_info_value).
gorin
Forums Member
#4 | Posted: 31 Mar 2005 23:42
Reply 
Thanks - now everything is fine =)
andreasm
Forums Member
#5 | Posted: 8 Apr 2005 17:11 | Edited by: andreasm
Reply 
Actually, for any specified user_info field, you may write the function with syntax function parseUserInfo_user_info($user_info_value).

I don't understand this !
Team
8-)
#6 | Posted: 8 Apr 2005 17:18
Reply 
Read my message at 31 Mar 2005 10:52.
andreasm
Forums Member
#7 | Posted: 8 Apr 2005 17:23
Reply 
I've already added the function in bb_plugins.php ....
what else must I modifiy ?
andreasm
Forums Member
#8 | Posted: 8 Apr 2005 17:26
Reply 
MY main_posts_cell.html:

<tr valign=top class={$bg}>
<td class=caption1><a name="{$anchor}" href="JavaScript:paste_strinL('{$posterName}',2)"><span

class=username>{$posterName}</span></a><br><span class=txtSm>{$viewReg}</span>
<br><br>
<span class=txtSm>{$userInfo_user_website[$poster_id]}</span>

</td>
<td class=caption1><span class=txtSm>{$l_posted}: {$postDate}{$editedBy}{$viewIP}<br><script

type="text/javascript">getQuotation('{$posterName}');</script>{$allowe d}</span><br><br>{$posterText}<br><br></td>
</tr>
andreasm
Forums Member
#9 | Posted: 8 Apr 2005 17:27 | Edited by: andreasm
Reply 
Where's the error ?

Sorry, but I'm a PHP and MYSQL beginner and from germany ;-)
andreasm
Forums Member
#10 | Posted: 8 Apr 2005 17:40
Reply 
In which file or template must I call the function "parseUserInfo_user_website" ???

Please help!
Fritzek
Forums Member
#11 | Posted: 8 Apr 2005 18:33
Reply 
Hi andreasm
there must be something wrong with your setup. Please check again. I will explain what I have done to get this working:
1. copy the code snippet from Team's post to bb_plugins.php
2. copy the $userInfoInPosts=array('user_website'); to setup_options.php
3. copy the <span class=txtSm>{$userInfo_user_website[$poster_id]}</span> to main_posts_cell.html
4. clear you cache or press shift+reload in your browser to really re-read the webpage

if point 1-3 is ok at your site, I believe the point 4 will do the job ;-)
PS: if necessary answer in German. I'm too.
andreasm
Forums Member
#12 | Posted: 9 Apr 2005 00:38
Reply 
Ok, Deutsch ist besser :-)

mann, ich hab nun den Fehler gefunden: Ich hatte zwar alles richtig implementiert, doch das FTP Programm hat die Dateien nicht überschrieben, da die Dateien auf dem Server neuer waren (irgendwie hat der Server ne andere Zeit eingestellt). An so einfachen Dingen scheitere ich meistens... arghhh :-)


Was ich aber gar nicht verstehe: Wie und wo wird die Funktion parseUserInfo_user_info aufgerufen? Da steht doch nirgends in den Dateien etwas davon drin, oder?
Fritzek
Forums Member
#13 | Posted: 9 Apr 2005 01:27
Reply 
mach dir keine gedanken darüber. die wird beim parsen der templates ausgeführt. wenn du die option eingeschaltet hast, schaut der template-parser in bb_plugins nach und findet die parse funktion. das is alles.
andreasm
Forums Member
#14 | Posted: 10 Apr 2005 14:25
Reply 
vielen dank für die erklärung! nun verstehe ich das
Anonymous
Guest
#15 | Posted: 10 Apr 2005 19:28
Reply 
Ok, everything works like it should be, just one question, when I add user_regdate in $userInfoInPosts I get date and time of user registration and I want to show just a date, Is this possible?
 Page:  1  2  3  »» 
Your reply
Bold Style  Italic Style  Image Link  URL Link 


» Username  » Password 
You are welcome to post anonymously by entering a nickname with no password (if that nickname has not been taken by another member) or by leaving both fields empty. If you have a forums membership account, you can also sign in from this page without posting a message, or sign in and post at once.

Before posting, be sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.

 
Online now: Guests - 19
Members - 0
Most users ever online: 191 [24 Dec 2007 14:33]
Guests - 191 / Members - 0

Forums are powered by miniBB®