'Created By' to link to user?

More
14 years 3 months ago #20522 by ma57er
Item ang Category views.
Yes, i mean user contact page(sorry for confusion ) - Contacts, Location etc. (i use Community Builder and there will be the information about the user)

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

More
14 years 3 months ago #20523 by ggppdk
To link to contact info/form page of the users IF IT EXISTS for each user:

edit your category_items.php file of the default template (better duplicate the template and then replace) and

replace lines:
Code:
<!-- BOF item fields --> <?php foreach ($columns as $name => $label) : ?> <td><?php echo isset($item->positions['table']->{$name}->display) ? $item->positions['table']->{$name}->display : ''; ?></td> <?php endforeach; ?> <!-- EOF item fields -->
with the following lines:
Code:
<!-- BOF item fields --> <?php foreach ($columns as $name => $label) : ?> <?php $link=''; $link_title=''; if ($name=='created_by') { $query = "SELECT id FROM #__contact_details WHERE user_id=". $item->created_by; $db = & JFactory::getDBO(); $db->setQuery($query); $contact_id = $db->loadResult(); if ($contact_id) { $link = JRoute::_('index.php?option=com_contact&view=contact&id='.$contact_id); $link_title = JText::_('Contact Details'); } } ?> <td> <?php echo ($link) ? "<a href='$link' alt=='$link_title'>" : ""; ?> <?php echo isset($item->positions['table']->{$name}->display) ? $item->positions['table']->{$name}->display : ''; ?> <?php echo ($link) ? "" : ""; ?> </td> <?php endforeach; ?> <!-- EOF item fields -->

This will create links to the contact form of the user if his/her contacts exists.

Does community builder have a similar page?
In my old version i checked to create a menu item to contact/form/details, it did not have a menu item, only a personal profile.

If i get time to install new version i will check.

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

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

More
14 years 3 months ago #20524 by ma57er
Nothing happen with this code unfortunately :(

I make contact page for user Admin. Same user make atrice/item ... but Created by: Name is not link ...

The code for user page in Community Builder is:

For table -
Code:
#__comprofiler
user_id is same
For link generate is
Code:
index.php?option=com_comprofiler&task=userProfile&user=

I give you this only for your information.

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

More
14 years 3 months ago #20525 by ma57er
ggppdk its working! Im stupid and im sorry for bothering :oops: :oops:

My mistake is - i change template in Types, not in category i wish :oops:

Its working perfectly! Thanks a lot again!

EDIT: Code for link Author to his profil in Community Builder is:
Code:
<!-- BOF item fields --> <?php foreach ($columns as $name => $label) : ?> <?php $link=''; $link_title=''; if ($name=='created_by') { $query = "SELECT id FROM #__comprofiler WHERE user_id=". $item->created_by; $db = & JFactory::getDBO(); $db->setQuery($query); $contact_id = $db->loadResult(); if ($contact_id) { $link = JRoute::_('index.php?option=com_comprofiler&task=userProfile&user='.$contact_id); $link_title = JText::_('Contact Details'); } } ?> <td> <?php echo ($link) ? "<a href='$link' alt=='$link_title'>" : ""; ?> <?php echo isset($item->positions['table']->{$name}->display) ? $item->positions['table']->{$name}->display : ''; ?> <?php echo ($link) ? "" : ""; ?> </td> <?php endforeach; ?> <!-- EOF item fields -->

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

More
14 years 3 months ago #20526 by ggppdk
Your code will work but:

You don't need to make query for contact id for the community builder because the ids are the same so the following code will first try the get link
1. The Community Builder User Profile
2. and then the Standard Joomla Contact Details
(if CB component does not exist)

So you can use this code:
Code:
<!-- BOF item fields --> <?php foreach ($columns as $name => $label) : ?> <?php $link=''; $link_title=''; if ($name=='created_by') { // FIRST TRY community builder if ($mainframe->getParams('com_comprofiler')) { $link = JRoute::_('index.php?option=com_comprofiler&task=userprofile&user='.$item->created_by); $link_title = JText::_('Author Profile'); } // SECOND TRY standard Joomla Contact Details else { $query = "SELECT id FROM #__contact_details WHERE user_id=". $item->created_by; $db = & JFactory::getDBO(); $db->setQuery($query); $contact_id = $db->loadResult(); if ($contact_id) { $link = JRoute::_('index.php?option=com_contact&view=contact&id='.$contact_id); $link_title = JText::_('Contact Details'); } } } ?> <td> <?php echo ($link) ? "<a href='$link' alt=='$link_title'>" : ""; ?> <?php echo isset($item->positions['table']->{$name}->display) ? $item->positions['table']->{$name}->display : ''; ?> <?php echo ($link) ? "" : ""; ?> </td> <?php endforeach; ?> <!-- EOF item fields -->

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

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

More
14 years 3 months ago #20527 by ma57er
One more question - can this be done directly in the Field, not on current template?

I mean in "Core.php"?

I ask for this, because will use 10-20 different templates in one site

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

More
14 years 3 months ago #20529 by ggppdk
Yes, it can be done by adding one more parameter to FLEXIcontent --core-- field plugin that creates the all core fields.

The other way do this, would be to create a new field, which would allows to easily add more options to it such as creating links to other stuff too ...

I will make a new enhancement issue in the BUG Tracker for v1.5.7 ...

If you want to hack the core.php file inside the flexicontent plugins folder it should be easy to but your changes will be overwritten next time you upgrade.

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

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

More
14 years 3 months ago #20530 by ma57er
I know there will be overwriten in case of update, but i need this function :?

I dont know how to make new filed and what code to insert there.

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

More
13 years 7 months ago #26940 by carolineCSH
Hi,

I've just found this topic, and this is exactly what I want to do. I'm trying to put links from the field "created by" to the community builder profile page of the author.

I tried to follow these steps but it doesn't seems to work (but actually i'm not really good at coding). Is there a new manipulation to do with the latest versions of flexicontent and Joomla (I'm working with Joomla 2.5) or maybe is there a plugin or an extension that can do that more easily ?

Thank you,

Caroline

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

More
13 years 7 months ago #26941 by ggppdk
The above code works, you will need the help of someone with good enough knowledge to apply this code to a FLEXIcontent template.

Because i have taken time to write the above to create a new field for it is not too much work, at the time i had opened this issue too:

code.google.com/p/flexicontent/i ... %20Summary

Plus our Author Layout view can be extended to display the community builder profile


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

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

Moderators: vistamediajoomlacornerggppdk
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save