Implemented Community Builder Fields in Author Info

More
3 years 8 months ago #1294 by Tim Davis
Community Builder Fields in Author Info was created by Tim Davis
Here's a weird one - but before we get to all the specific details what I am looking for is a way to display a Community Builder Field in the Author Info page of ochBlog. I can do it for registered viewers who are logged in, but not for public viewers.

OK, the gory details . . .

I am working on a site that uses Community Builder as the user management extension on the Joomla site. It integrates with Kunena through the "Kunena - Community Builder Integration" plugin in Kunena. There is no default "author bio" Community Builder field so I added one in Community Builder (cb_bio) and it appears in the profile management area nicely for users to fill out about their selves. We really want this because we want there to be only 1 place where authors manage all their info.

In ochBlog, setting "author avatar provider" to Kunena actually displays the avatar from Community Builder in ochBlog - that's what I want, great!

In ochBlog, setting "author profile provider" to Kunena actually displays the Kunena Forum user info page, but not the Community Builder user info - not so great.

If I change "author profile provider" to ochBlog blog I get the proper avatar from Community Builder on the nice ochBlog author page - that's what I want.

Here's the tricky and weird part. When setting "Author About text provider" to Kunena Signature" or "Kunena About" no author bio shows up on the ochBlog author page. This makes sense because there is no way to add or map the Community Builder "cb_bio" field to Kunena so why would it show up on the ochBlog author page?

So next, setting the "Author About text provider" to ochBlog, an option appears to select the Joomla Custom field with the bio info. So what I did was create Joomla custom field (just a text field) and I put the field name for the Community Builder bio field I created - "cb_bio" - in between square brackets - [cb_bio] - which works to include Community Builder Fields in Joomla content.

The result is that the info from the Community Builder Author Bio field DOES show up at the end of articles and on the ochBlog author page BUT only when a user is logged in to the front end.

Now, one possibility for this could be that the the Community Builder plugin is set to not show to public, however I have test this by putting "[cb_bio]" right in the article as well and it shows up when being viewed without being logged into the front end of the site. All settings in the field itself are set for public viewing.

So for some reason a Community Builder field embedded in the author image area (even if I put [cb_login] in "author info> author bio" or "author profile> author info" will not show up for public viewing.

I know this is a lot of info, and it's late here so hopefully it isn't too confusing, but does any of this ring a bell to you as to a cause or workaround?

Tim
The topic has been locked.
More
3 years 8 months ago - 3 years 8 months ago #1295 by Ruud van Lent
Replied by Ruud van Lent on topic Community Builder Fields in Author Info

Tim Davis wrote: The result is that the info from the Community Builder Author Bio field DOES show up at the end of articles and on the ochBlog author page BUT only when a user is logged in to the front end.

What happens when you disable the CB plugin that replaces the [cb bio] tag with the cb bio info? does it display the tag?

Now, one possibility for this could be that the the Community Builder plugin is set to not show to public, however I have test this by putting "[cb_bio]" right in the article as well and it shows up when being viewed without being logged into the front end of the site. All settings in the field itself are set for public viewing.

So for some reason a Community Builder field embedded in the author image area (even if I put [cb_login] in "author info> author bio" or "author profile> author info" will not show up for public viewing.

when not logged in, does it display the [cb bio] tag or just an empty string / nothing?

The way you have configured it is that ochBlog just displays the contents of the configured custom field. It injects this on the page with the ochBlog content plugin. the CB plugin is responsible for the actual cb bio tag replacement on the page. it should do that regardless of context (replacing in article or module or below the text / author page)
Last edit: 3 years 8 months ago by Ruud van Lent.
The topic has been locked.
More
3 years 8 months ago #1296 by Tim Davis
Replied by Tim Davis on topic Community Builder Fields in Author Info
Excellent question.

When I disable the plugin that replaces the [cb_bio]:

Only the [cb_bio] "tag" shows on the page if viewed as a guest and also if viewed as a registered user who is logged in.

So that narrows it down to the plugin finding the "tag" in the author area, removing it, but replacing it with nothing.

The plugin in question is named "Content - Community Builder" but it is a Joomla Plugins in Joomla, and not in the list of Community Builder plugins.

I tried turning on error reporting, but there is no error when it is not appearing.

I suppose a different method I could try would be to use PHP to display the properties of the cell with the bio info. Such a code would have to:

Display the contents of cell "cb_bio" for "user_id" (whatever the author user id number is) in table #comprofiler.

That makes sense to me, but actually coming up with the PHP code is well above my pay grade!




The table is fcp_comprofiler,
The topic has been locked.
More
3 years 8 months ago - 3 years 8 months ago #1297 by Ruud van Lent
Replied by Ruud van Lent on topic Community Builder Fields in Author Info
Is the cp plugin configured to run before or after the ochblog content plugin? It should be after. Just checking.

What the ochBlog content plugin does is add all the configured blocks as html to the article->text (no processing)

This means that [cb_bio] is in the article->text

the plugins that run after ochBlog content plugin will then receive the article with the new article->text in it.

So the only reason why it is replaced in the article text and on the same page NOT in the author profile is because the cb plugin runs first: it receives the article->text, replaces things > then ochBlog comes along and adds things to the article->text (which are then not parsed by the cb plugin because that one already ran)...

does that make sense?
Last edit: 3 years 8 months ago by Ruud van Lent.
The topic has been locked.
More
3 years 8 months ago #1298 by Tim Davis
Replied by Tim Davis on topic Community Builder Fields in Author Info
The ochBlog plugin is before CB Content in the plugin order.
The topic has been locked.
More
3 years 8 months ago #1299 by Ruud van Lent
Replied by Ruud van Lent on topic Community Builder Fields in Author Info
Maybe the view level of the custom field is wrong, maybe it displays only for registered? That could be it because for guest it doesn't show the cb bio code, so cb plug-in has nothing to replace?

Currently on mobile so cannot check what the values should be
The topic has been locked.
More
3 years 8 months ago #1300 by Tim Davis
Replied by Tim Davis on topic Community Builder Fields in Author Info
It's not that because the [cb_bio] tag is replaced when I put it in an article and view it as a guest.

A great option (and I know you've lots of those in the queue) would be the ability to select "community builder" as the "Author About text provider" and then have a dropdon to select the CB field to use.
The topic has been locked.
More
3 years 8 months ago #1301 by Tim Davis
Replied by Tim Davis on topic Community Builder Fields in Author Info
Hi Ruud,

I've got this working with an override that Chetan helped me with the php for.

Along the way he noticed the userid that the cb-content plugin was looking for was the the person logged into the site and not the the userid of the author being featured on the particular bio page. That's why I saw my bio when logged in, but not as a guest. Anybody logged in and viewing my bio page would still see a blank page unless they had a bio set up for their own user.

Here is the code for the override created in /templates/TEMPLATE NAME/html/com_ochblog/authorprofile/default.php

<?php
$userid = $author->id;
// Get a db connection.
$db = JFactory::getDbo();
$query = $db->getQuery(true);

$query->select($db->quoteName('cb_bio'));
$query->from($db->quoteName('#__comprofiler'));
$query->where($db->quoteName('user_id') . ' = ' . $db->quote($userid));
$db->setQuery($query);
$bio = $db->loadResult();
echo $bio;
?>

So that is a good workaround for me. The dropdown to select a Community Builder field would be great some day!

Thanks for helping me with different things to try and consider alang the way.
The topic has been locked.
More
3 years 8 months ago #1302 by Ruud van Lent
Replied by Ruud van Lent on topic Community Builder Fields in Author Info
Hi Tim, good you got it working. Current out of the office for holidays so really limited.
Having community builder as an option in ochBlog is certainly an option. Requests like these is how now features come in. End of August I will be back and will also start work on migrating ochBlog to Joomla 4. That is the extension that I have been waiting the longest with as that will have the most changes.
The topic has been locked.
More
3 years 8 months ago #1303 by Tim Davis
Replied by Tim Davis on topic Community Builder Fields in Author Info
I didn't realize you were on holidays already.

Have a great time and rest - all's good here! I'm sure we'll connect after.
The topic has been locked.