Skip to Content Skip to Menu

show CB-Fields in Joomlaboard

  • Rocko
  • Rocko
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
17 years 7 months ago #36230 by Rocko
show CB-Fields in Joomlaboard was created by Rocko
Hi Folks,
I like to show some Fields of "Additional Info" Tab of the Community Builder in Joomlaboard.
Something like:

Posting from Rocko
Hobbies: Photograph

I see that I have to change the Sourcecode of the file "view.php" in Joomlaboard.
There is a Line:
[code:1]$database->setQuery("SELECT a.posts,a.karma,a.signature,a.avatar,b.name,b.username,b.gid FROM #__sb_users as a LEFT JOIN #__users as b on b.id=a.userid where a.userid='$fmessage->userid'"«»);[/code:1]
in view.php which sets the SQL-query for loading some Data.
I think it should be possible to add a variable to the data list which tells SQL to load a CB-Field, but I don't know how to access the CB-Fields.
Something like:
[code:1]$database->setQuery("SELECT a.posts,a.karma, a.CB_hobbies, ...[/code:1]

but I dont know how to deal with the SQL-DB!
Any Hints?
thank you...

Rocko

Please Log in or Create an account to join the conversation.

  • mikko
  • mikko
  • OFFLINE
  • Posts: 703
  • Thanks: 0
  • Karma: 115
17 years 7 months ago #36239 by mikko
Replied by mikko on topic Re:show CB-Fields in Joomlaboard
I doubt that only modifying the query is sufficient, but it is a good starting point.

You need to do a join between the joomlaboard table and table which is called "jos_comprofiler". Google for SQL Join Tutorial to find out how to do this. ( I do not know the structure of joomlaboard table, so cannot give you the query right away)

You should use phpmyadmin or another query analyzer to test teh query before trying it inside a php file.

mikko

Please Log in or Create an account to join the conversation.

  • Rocko
  • Rocko
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
17 years 7 months ago #36250 by Rocko
Replied by Rocko on topic Re:show CB-Fields in Joomlaboard
Hello again, thx for the Hint.
So I googled for SQL Join Tutorial and found a Page which shows me some basics.
Now that I know a little bit more, I thought of modifying the querry of the comprofiler avatar reading:
[code:1]$database->setQuery('SELECT avatar FROM #__comprofiler WHERE user_id='.$fmessage->userid.' AND avatarapproved=\'1\'');
$str_cb_avatar=$database->loadResult();
[/code:1]
which uses the comprofiler database.
So I'd like to try:
[code:1]$database->setQuery('SELECT cb_hobby FROM #__comprofiler WHERE user_id='.$fmessage->userid ');
$str_cb_hobby=$database->loadResult();
[/code:1]
Where cb_hobby is the Field Name in CB, and my wanted string is now in $str_cb_hobby for further use!

afaik there is nothing written to the DB, so it cannot blow up my database?
I only whant to know if thats true, so I can do a little try an error with that!
thanks for help

Please Log in or Create an account to join the conversation.

  • mikko
  • mikko
  • OFFLINE
  • Posts: 703
  • Thanks: 0
  • Karma: 115
17 years 7 months ago #36251 by mikko
Replied by mikko on topic Re:show CB-Fields in Joomlaboard
Select does not write anything, so it is safe.

mikko

Please Log in or Create an account to join the conversation.

  • Rocko
  • Rocko
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
17 years 7 months ago #36291 by Rocko
Replied by Rocko on topic Re:show CB-Fields in Joomlaboard
Yes its safe and it worked!
(It worked many many hours after the first try, but I always looked at a empty database entry from a user which had no entry in the field (so the result '' was the right result :blush: !)
If anyone likes to do the same, here is my code:

[code:1]
$str_cb_footprint='';
$database->setQuery('SELECT cb_footprint FROM jos_comprofiler WHERE user_id='.$fmessage->userid );
$str_cb_footprint=$database->loadResult();
[/code:1]
DB-Prefix of my installation is "jos_" and the CB-Field showed up as "cb_footprint" in the comunity-builder component of the joomla-backend (so you dont have to add some prefix!)

greetings...

Rocko

Please Log in or Create an account to join the conversation.

  • p9939068
  • p9939068
  • OFFLINE
  • Posts: 186
  • Thanks: 0
  • Karma: 117
17 years 6 months ago #36368 by p9939068
Replied by p9939068 on topic Re:show CB-Fields in Joomlaboard
Changing jos_comprofiler to #__comprofiler will make sure it will work with any database table prefix.


Mike Feng
Creator of SIMGallery, SIMAnswers, and ParaInvite
www.simbunch.com
twitter.com/simbunch

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum