gteigland VIP
Total posts: 159
30 Июнь 2015 14:45

I found this documenation from Easy Social that I was wondering from your perspective if it would allow deeper ES integration with cobalt. http://stackideas.com/docs/easysocial/developers/users/users

By grabbing these fields (including custom fields - noted at bottom)...

Could I code those into my cobalt templates especially the personalization (home page) of section records (btw what file would that be?)

If so this would open a lot of doors for ES and Cobalt integration.

Thanks!

Последние изменения: 27 Июль 2015


Sergey
Total posts: 13,748
01 Июль 2015 15:55

This is simple. You can insert this code whereever in cobalt template. It might be one of replicable templates or Joomla template override. Just use those example in template code, that is it.


gteigland VIP
Total posts: 159
01 Июль 2015 22:19

Perfect, Thanks for your confirmation!


gteigland VIP
Total posts: 159
08 Июль 2015 14:16

I wanted to add info on this thread as with your help - Cobalt and Stackideas Ive been able to solve some strong integration between Cobalt user home pages and Easy Social.

My goal has been integrating ES functions and views with Cobalt as I need both for my current site project. The issue lies in that I don't want two different systems to run the same function (follow function, points, badges, cover etc). My client wants the features of ES but the simplicity of Cobalt (as it relates to Artist Projects)... anyway I think below this will really help integrate the two more tightly.

  1. Easy Social has great documentation of their API and integrating their functions/data here: http://stackideas.com/docs/easysocial/developers/welcome

  2. To edit the user home page in Cobalt, Cobalt support (which has been fantastic) told me to edit these two files: default_markup_default.php (which I created a new template version) so I didn't overwrite the core file default_user_block.php (not sure how to create a new template version of this -- ANY IDEAS?) These are found in /components/com_cobalt/views/records/tmpl (Thanks Cobalt support!)

  3. Now in the cobalt personalization home page view in the url you get this string: user_id=65

When I just straight up put in the ES api code for example:

echo Foundry::user()->getName();

(This retrieve user name from ES).

I would GET THE LOGGED IN USER on this page... not the name of the page I'm actually viewing which in this case was user_id=65

So I asked stackideas what code would grab the url user id that cobalt shows in url stirng and tie it to their api so it would NOT Show logged in user but the actual ES data for the Cobalt user page I'm visting.

  1. This is the code they gave me
$userIdRaw = JRequest::getVar('user_id');
$userId = strstr($userIdRaw, ':', true) ?: $userIdRaw;
echo Foundry::user($userId)->getName();

So now instead of seeing my logged in user data.. It will now show the ES data of thepage of the user I'm viewing in Cobalt's personalization home page. So now its just a matter of me grabbing the different ES data I want and changing that last line to match ES documentation.

Now using all of this I can integrate and edit the Cobalt personalization home page the way I need to tying a TON of ES DATA and Function

Very cool and I though helpful for others.

Note: I just started the process so Ill report back in for any errors but you can begin to see the doors that open between these two great components.


gteigland VIP
Total posts: 159
08 Июль 2015 14:19

Here's a graphic I sent over to stackideas that better demonstrates what I shared above. http://www.awesomescreenshot.com/image/388345/b5bc0d73999a872b6190515277c49f7c


pepperstreet VIP
Total posts: 3,837
08 Июль 2015 23:38

+1 Cool stuff and project ;)
Always nice to read your reports and get feedback!

gteigland This is the code they gave me ... JRequest ...

I am not sure, but is the user's homepage ID# available anywhere else? I mean, apart from the URL. (@Sergey ?)

Regarding the JRequest. As far as I know it is deprecated. The Joomla v3 docs recommend to use JInput. It is slightly different, but should extract and find the ID# with help of the respective filter option. Alternatively, there is also a type specific method.


Sergey
Total posts: 13,748
10 Июль 2015 10:30

You can simplify code to this.

$userId = JFactory::getApplication()->input->getInt('user_id');
echo Foundry::user($userId)->getName();

Because JRequest though works is depricated and soon will be gone.


gteigland VIP
Total posts: 159
10 Июль 2015 13:52

THANKS for the simplified code. That works.

Related Question. Is there a way to template the file "default_user_block.php" as im working within that core file.


pepperstreet VIP
Total posts: 3,837
10 Июль 2015 21:22

gteigland Is there a way to template the file "default_user_block.php"

1.) Not by configuration, but you can either use the normal Joomla Override method...
by putting "views" files in your Site template's HTML folder.

2.) Or just make a copy in the original location.
Give it a new name e.g. default_mynewuser_block. Use that name to load your file in your custom MarkUp layout template! See around line# 39. Find and change this command loadTemplate('user_block')
Make sure to ommit the prefixed default_ portion ;)
Should look like this: loadTemplate('mynewuser_block.php')


gteigland VIP
Total posts: 159
18 Июль 2015 15:25

I'm going to continually update this thread with my progress in the hopes of helping others. Cobalt Rocks! and Easy Social is a strong Social Network app.

WHile ES does provide API info.. sometimes it's not quite complete so Ill post my final solutions here.

I have used the normal joomla ovveride as suggested by pepperstreet (THANKS!)

IN ES you can create custom fields. If you want display those results (therefore using ES as the base for user profiles) I use this code and place it in my default_user_block.php (placed in my joomla override template)

$userId = JFactory::getApplication()->input->getInt('user_id');
$key = 'TEXTBOX-1';
$my = FD::user($userId);
$fieldData = $my->getFieldValue($key);
echo $fieldData;

To get your $key - you can customize that in the backend of ES to whatever you want it to be. I've also created this same field in multiple user types in ES and just used the same key and it works.

http://www.awesomescreenshot.com/image/417239/3d5bda174e72045cf7b79ec4ed3e9ab6


Sergey
Total posts: 13,748
20 Июль 2015 06:16

Looks great!


gteigland VIP
Total posts: 159
27 Июль 2015 19:58

If you want to add your EasySocial Cover Image to the Cobalt user Home Page use this code:

<img src="/<?php echo Foundry::user($current_user->id)->getCover();?>">

Also remember the reference files you need at the top:

require_once( JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php' );
require_once(JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/easyblog.php');
Работает на Cobalt