Hi all
I am trying to work out how I can get the Joomla user ID, actually via Community Builder as I want to link the owners name to their member profile within Community Builder.
I hope someone can help me out - here is what I have so far - note the ??????? is where I need the User ID.
{if !empty($showOwner)}
<div class="owner summary">
Owner: <a href='/index.php?option=com_comprofiler&task=userProfile&user=???????
{g->text text="%s" arg1=$item.owner.userName|default:$item.owner.fullName}
'>
{g->text text="%s" arg1=$item.owner.userName|default:$item.owner.fullName}
</a>
</div>
{/if}
Cheers
Posts: 314
you can get the J user id via a search into ExternalIdMap table.
this can be done in the php files (.inc) not in the template file (.tpl)
serbanc - www.e-poze.ro
Posts: 38
That sounds terrific but can you lend a noob a hand and give me a clearer pointer to what I need to look for and edit
Cheers for you help
Greg
Posts: 4
LEARN & EARN
King Saud University is organizing a regular weekly based competition: Knowledge for all contests to encourage knowledge web publishing worldwide. As a result helping in building knowledgeble society that can exchange information easily through the internet.
The question of this week is: What do we mean by the term “Electronic Publishing”?
By searching the king Saud university website;
I found the answer and the link for that answer is
www.ksu.edu.sa
http://faculty.ksu.edu.sa/Al-Arishee/Documents/النشر الإلكترونى
Its your chance to learn and earn
Posts: 4
LEARN & EARN
King Saud University is organizing a regular weekly based competition: Knowledge for all contests to encourage knowledge web publishing worldwide. As a result helping in building knowledgeble society that can exchange information easily through the internet.
The question of this week is: What do we mean by the term “Electronic Publishing”?
By searching the king Saud university website;
I found the answer and the link for that answer is
www.ksu.edu.sa
http://faculty.ksu.edu.sa/Al-Arishee/Documents/النشر الإلكترونى
Its your chance to learn and earn
Posts: 4
LEARN & EARN
King Saud University is organizing a regular weekly based competition: Knowledge for all contests to encourage knowledge web publishing worldwide. As a result helping in building knowledgeble society that can exchange information easily through the internet.
The question of this week is: What do we mean by the term “Electronic Publishing”?
By searching the king Saud university website;
I found the answer and the link for that answer is
www.ksu.edu.sa
http://faculty.ksu.edu.sa/Al-Arishee/Documents/النشر الإلكترونى
Its your chance to learn and earn
Posts: 4
LEARN & EARN
King Saud University is organizing a regular weekly based competition: Knowledge for all contests to encourage knowledge web publishing worldwide. As a result helping in building knowledgeble society that can exchange information easily through the internet.
The question of this week is: What do we mean by the term “Electronic Publishing”?
By searching the king Saud university website;
I found the answer and the link for that answer is
www.ksu.edu.sa
http://faculty.ksu.edu.sa/Al-Arishee/Documents/النشر الإلكترونى
Its your chance to learn and earn
Posts: 314
in .inc file, in view class.
global $gallery;
$userId = $gallery->getActiveUserId();
$query = 'SELECT [ExternalIdMap::externalId]
FROM [ExternalIdMap]
WHERE [ExternalIdMap::entityId] = ? AND
[ExternalIdMap::entityType] = ? LIMIT 1';
list($ret, $SearchResults) = $gallery->search($query, array($userId, 'GalleryUser'));
if ($ret) {
/* Serban: treat error */
}
while ($result = $SearchResults->nextResult()) {
$externalId = $result[0];
}
Now, add externalId to the list of variables available to the template. something like
$TemplateName['externalId'] = $externalId;
then, in template use this as
$TemplateName.externalId
enjoy!
serbanc - www.e-poze.ro
Posts: 38
OK what do you mean here - what .inc file or do I need to create a new one and do you mean GalleryView.class?
Thanks again
Greg
(P.S what is with all the spam?)
Posts: 314
I assume that you want to display that information in one of the existing pages of the gallery.
So , you need to enter the code in the .inc file that generates that page (view) and to display it via some code (your code!) in a .tpl file.
if you give more details, like "I want to display it in...." I can help you more.
serbanc - www.e-poze.ro
Posts: 38
OK thanks it is on the photo view (photo.tpl) and album view (album.tpl) where I have set the owner to show the username rather than the users real name. I am wanting to link that username to the users profile in Community Builder. So I am guessing the ShowItem.inc file?
Cheers again for your help
Posts: 314
in this case, you should put the code into theme.inc, into the functions showAlbumPage and showPhotoPage.
the code would change like (only in the last line)
$theme['externalId'] = $externalId;
and the reference in .tpl would be
$theme.externalId
serbanc - www.e-poze.ro
Posts: 38
serbanc I thank you for your patience with me but I must be doing something wrong as I cannot get it to work. In any case it is actually the ItemInfo.tpl file I need it in - sorry my mistake.
I'll keep fiddling and see what I can come up with
Cheers
Greg
Posts: 50
Hey, just wanted to post back a "thank you" to serbanc for pointing me in the right direction, and my gratitude to the folks at Drupal for the bulk of the function code.
I'm customizing the NZDI theme, and finally defined the variable $theme.item.owner.externalId so I now have my Joomla user Id (and therefore can build my CB link). So, for those searching for this solution, here is how I got it to work.
1) Backup your original theme.inc file. Unless I missed something in the documentation, it looks like you cannot use a "local" version of this file.
2) In my showAlbumPage and showAlbumPage functions, I added the following code before the line return array(null, 'theme.tpl'); (which, btw, is the last line in both functions):
You can now use the variable $theme.item.owner.externalId in your album and photo page templates to get the Joomla user id. Your function names may be different depending upon what theme you're using, but you get the idea - add this code to your "show" or "view" functions.
NOTE: only add the "$theme =&" line if you don't have it already in the function.
Hope this helps!
Posts: 4
I use the {runphp} plugin to accomplish this, here's the code. This should be useable (minus the {runphp} tags) in virtually any joomla component or module you might want to make.
This code determines the top-level gallery ID owned by the current user. The output of this code would be added to your gallery URL as the value of g2_itemId
From inside the gallery linking back to a user profile (like community builder), it's equally not so bad.
Personally, I use these code snippets in a strange way in Joomla. I've modified the core and database to allow me to use mambots inside menu items (text and URL), and just about anywhere else I can think of to stick them. So for me, the gallery, profiles, upload links, and everything reside in menuitems. I'm working on removing the gallery sidebar entirely, replaced with my styled menu items.
So, now that I feel I've contributed to this forum, I'll go to a different topic and post my question.
Enjoy!
Posts: 8
Ok, Im totally lost here.
I have Gallery 2.2.4 and Joomla 1.5.3
I use the X_treme Theme for the Gallery.
The Gallery is embedded into Joomla thanks to the "Gallery 2 bridge" component.
Users are mapped directly from Joomla database (so they are exactly the same one Gallery = Joomla)
What I'd like is that the Album "Owner" nickname links to the Community Builder user profile, in Joomla.
For example in this image:
[img]http://img177.imageshack.us/img177/7255/glinkqs7.jpg[/img]
I'd like that "Dukessa" becomes a link to my Community Builder profile page, in Joomla.
How can I do this?
Thank you!