'Created By' to link to user?

More
13 years 5 days 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
13 years 5 days 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
13 years 5 days 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...

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

More
13 years 5 days 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
13 years 5 days 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...

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

More
13 years 5 days 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.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.376 seconds
Save
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