Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

Custom content routing on comment stream

6 years 7 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

Since Joomla has other content managers, showing link to content with default Joomla routing url when someone comments on content is not desirable.
Integrating comments on content is great option, we just need a way to customize url to content that is displayed in stream.

6 years 7 months ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

Hi,

Thank you for your idea, but for time being this idea cant be implemented, except you hack and hire the 3rd party developer :)

thank you!

6 years 7 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

Modifying is not the problem :)
Can you point me to right direction where routing for those links are made, so I can implement needed modifications?

6 years 7 months ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

Hi,

The modification wont be easy, because it related with Activities stream library, I suggest you track the controllers/system.php, look on function ajaxStreamAddComment()

6 years 7 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

I have located most of data that is presented in stream as post on Joomla content but where is url to Joomla content generated is eluding me.
When someone comments on Joomla content in header of that activity on wall there are 2 links and text between:

user test1 commented on content test

I'm interested in location where url for content test is generated.
Right now it uses Joomla router (or CRouter) to set:
index.php?option=com_content&view=article&id=???&catid=???&Itemid=???
for content test.
I need to change that url to Joomla content to something else.

6 years 7 months ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

Hi,

Seems we have bug on it, the link is not be generated to JRoute or CRoute, is it?

6 years 7 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

Link is generated correctly but I cannot find exact location of that procedure.

6 years 7 months ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

Please look this file components/com_community/controllers/system.php, and find this code

$wallParams->get('object_url')

6 years 7 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

It looks like it should be responsible for creation of that url but commenting out whole that part:

                //check if there is any links in object name url
                $wallParams = new CParameter($wallOptions->params);
                $wallLink = '';
                if ($wallParams->get('object_url')) {
                    if ($wallParams->get('object_title')) $wallLink = '<a href="'.$wallParams->get('object_url').'">'.$wallParams->get('object_title').'</a>';
                    else $wallLink = '<a href="'.$wallParams->get('object_url').'">'.$wallOptions->object_name.'</a>';
                } else {
                    //there is no link here
                    if ($wallParams->get('object_title')) $wallLink = $wallParams->get('object_title');
                    else $wallLink = $wallOptions->object_name;
                }
does not make a single change when it comes to desired link. As far as I can see that url generation has something to do with notifications.

6 years 7 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

Since "commented on" can be found in language as:
COM_COMMUNITY_THIRDPARTY_WALL_COMMENT_ACTIVITY_TITLE
that string really can be found few lines of code bellow mentioned.

I need to change url for link in red which points to joomla content.

Attachments:
6 years 7 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

I have found that url is located in database table:
*_community_thirdparty_wall_options - as params field -> object_url: {"object_url":"index.php?option=com_content&view=article&id=1&catid=2&Itemid=117","object_title":"test"}
*_community_activities - as title field -> {actor} commented on <a href="index.php?option=com_content&view=article&id=1&catid=2&Itemid=117">test</a>
In *_community_wall there is reference to other db data.

So new question is: Where is that url saved in db so I can change it before it is saved? :) or what is layout file used to modify url before it is displayed?

url to joomla content is processed on line 268 in \layout\stream\base.php. to avoid compatibility issues will do url manipulation on that location.

6 years 7 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

If someone else uses FlexiContent on Joomla and JomSocial, to get "correct" url in wall posts that display comments on FlexiContent content change:
...\components\com_community\templates\Your_Template\layouts\stream\base.php
before line 265 that looks like:

$title = $act->title;
put something like this:
if (JComponentHelper::getComponent('com_flexicontent', true)->enabled) // Check if FlexiContent is installed and enabled
{
	if ((strpos($act->title, 'option=com_content') !== false) && (strpos($act->title, 'view=article') !== false)) { // Check if url is content url to article
	$act->title = str_replace ('option=com_content', 'option=com_flexicontent', $act->title) ;
	$act->title = str_replace ('view=article', 'view=item', $act->title) ;
	$act->title = str_replace ('catid=', 'cid=', $act->title) ;
	}
}
This is ugly solution but works. If someone finds better way, please don't hesitate to share :)
JomSocial comments on FlexiContent items work "out-of-the-box". When setting Category in FlexiContent there is option to Route to FC Item View so use that instead of code above to achieve same result.

6 years 7 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

It would be nice to see some more "advanced" way of generating this url so we can implement custom routing (with article ID, category ID, article Title, category Title) in the future releases.

6 years 7 months ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

Hi,

I think that is the one solution for this hacking...:)

Thank you for your sharing.

cheers!

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW