Using Profiles like social Media sites

More
11 years 10 months ago #32486 by igcorreia
This is something we just implemented :D workes like a charm. The idea is simple. Each user needs to have a personal page, a PROFILE PAGE.

Steps:
1 - Create and Category, Type and Template: WELCOME
2 - Link them together.(this should be a FC feature :D )
3 - Create and Category, Type and Template: PROFILE
4 - Link them together.
5 - Create an item: WELCOME using the category WELCOME.
6 - Create an menu item and link it to this item set it only for registered users.
7 - Create a login module and redirect it to this menu item after login

NOW LET GO TO THE CODE

8 - Open the item.php of the WELCOME template
9 - Add this lines:

//Get User ID
Code:
$user = JFactory::getUser();
//Define Category
Code:
$category = "1"; // This category ID for the PROFILE CATEGORY
//Define DB - Query
Code:
$db = JFactory::getDbo(); $query = $db->getQuery(true);
//Define Query
Code:
$query ->select('id') ->from('#__content') ->where('created_by="'.$user->id.'" and catid="'.$category.'" and state="1"');
//Query
Code:
$db->setQuery($query);
//Get Results
Code:
$results = $db->loadObjectList();
//Redirect the user if no profile is found
Code:
if ($results != 0 && $results != NULL && $results != "" && $results != Undefined) { //YES profile header( 'Location: /my-items-page.php' ) ; } else { //NO profile header( 'Location: /new-profile?tmpl=component' ) ; }
//Load Template
Code:
include(JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'tmpl_common'.DS.'item_layouts'.DS.'modular.php');

Basically what it does is, if the user does not have at least 1 item in the category profile then redirect him to the PROFILE submission page, if it already has redirect him to his profile page.

The advantages is that like this we can use FC custom fields, categories to list the users :D without the need to link anything. Like this the user is linked to a profile. Also you need to verify in the form is the current log in user already has a profile, basicly is to make sure the user does not submit 2 profiles :D

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

More
11 years 10 months ago #32503 by micker
great thanks for sharing !

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

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

More
11 years 10 months ago #32726 by igcorreia
I have update the code to work with JGroups.
Also I am leaving the print_r so we can debug it right away.
Code:
<?php //Get User ID $user = JFactory::getUser(); $userGroup = $user->groups; // echo "<pre>";print_r($userGroup);echo "</pre>"; if (count($userGroup) == 1 && $userGroup[2] == 2){ //echo "Mantém aqui"; } else { //Define Category $category = "13"; // This cateogry is profile //Define DB - Query $db = JFactory::getDbo(); $query = $db->getQuery(true); //Define Query $query ->select('id') ->from('#__content') ->where('created_by="'.$user->id.'" and catid="'.$category.'" '); //Query $db->setQuery($query); //Get Results $results = $db->loadObjectList(); // Override Author //echo "<pre>";print_r($this->item->created_by);echo "</pre>"; //$this->item->created_by = $user->id; //Teste Results //echo "<pre>";print_r($results);echo "</pre>"; //Redirect the user if no profile if ($results != 0 && $results != NULL && $results != "" && $results != Undefined) { //YES it has profile header( 'Location: /meus-projetos' ) ; } else { //NO it has profile header( 'Location: /criar-novo-perfil' ) ; } } ?>

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

More
11 years 10 months ago #32755 by gauthier
Very interesting,

I keep in mind to remove community builder from my system to manage myself users, lists with Flexicontent. Your idea is a good starting point. ;)

To still innovative, I think that FC should manage itself users.

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

More
11 years 10 months ago #32758 by igcorreia
This is working well for us :D

Put for future features we WANT user profiles :D

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

More
11 years 10 months ago #32759 by micker
A Flexicommunity component or addon ? ;)

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.481 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