11
blackrx
Re: Yogurt and Smartprofile
  • 2008/7/26 12:45

  • blackrx

  • Quite a regular

  • Posts: 227

  • Since: 2008/2/5 1


mariane & shiva

may i know what version of smartprofile you guys are using and where can i download it ?

what is the best version to work with XOOPS 2.0181

& mariane are you using the same method as shiva ?

can you share your code ?

12
ericktot
Re: Yogurt and Smartprofile
  • 2008/7/26 18:13

  • ericktot

  • Just popping in

  • Posts: 6

  • Since: 2003/2/21


No work for me, I'm doing something wrong, missing some code?

Thank you!

xoops 2.0.16
Smartprofile 1.03
Yogurt 3.2
Php5

13
philfire
Re: Yogurt and Smartprofile
  • 2008/7/26 21:12

  • philfire

  • Just popping in

  • Posts: 25

  • Since: 2008/7/13


I got the first two edits but couldn't get this one right, I'm unsure where it goes ...

3. Now you can refer to smartprofile vars in your yogurt social networking index template like so:
<{$user_book.value}>
<{$<fieldname>.value}> e.g. <{$user_ICQ.value}>


xoops 2.0.18.1
yogurt 3.2
smartprofile 1

14
demian
Re: Yogurt and Smartprofile
  • 2008/7/27 16:05

  • demian

  • Quite a regular

  • Posts: 225

  • Since: 2008/4/29



15
demian
Re: Yogurt and Smartprofile
  • 2008/7/27 16:55

  • demian

  • Quite a regular

  • Posts: 225

  • Since: 2008/4/29


I got this working with XOOPS 2.0181, Yogurt 3.2rc and smartprofile 1.0 (0fficial)

this is what i do based on shiva's instruction


1. Open yogurt/index.php

find this at the end on the file

/**
 * Closing the page
 */ 
include("../../footer.php");
?>


Before that line Add the following code

$gperm_handler = & xoops_gethandler'groupperm' );
$groups is_object($xoopsUser) ? $thisUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);

// Dynamic User Profiles
$thisUsergroups =& $thisUser->getGroups();
$fieldids xoops_getmodulehandler('visibility','smartprofile')->getVisibleFields($groups$thisUsergroups);

$profile_handler =& xoops_getmodulehandler('profile','smartprofile');
$fields =& $profile_handler->loadFields();

$profile $profile_handler->get($thisUser->getVar('uid'));
// Add dynamic fields
foreach (array_keys($fields) as $i) {
    
//If field should be shown
    
if (in_array($fields[$i]->getVar('fieldid'), $fieldids)) {
        
//echo "VAL0:".$value."<P>";
        
$value $fields[$i]->getOutputValue($thisUser$profile);
        if (
is_array($value)) {
            
$value implode('<br />'array_values($value));
        }
        if(
$value){
        
$fieldattr=array('title' => $fields[$i]->getVar('field_title'), 'value' => $value);
        
$fieldname=$fields[$i]->getVar('field_name');
        
$xoopsTpl->assign($fieldname$fieldattr);    
        }
    }
}



2. open smartprofile/class/field.php and go to somewhere in line 341

replace this
function getUserVars() {
        return 
xoops_getmodulehandler('profile')->getUserVars();
    }
}

with this one
function getUserVars() {
        return 
xoops_getmodulehandler('profile','smartprofile')->getUserVars();
}
    }


3. Now you can refer to smartprofile variables in your yogurt social networking index template:

(modules/yogurt/templates/yogurt_index.html)

example if you created a field named age

put this in the yogurt index template

Age: <{$age.value}>

* make sure to set the permission for the field you created in smartprofile module
* clear templates_c and cache
* don't forget to change the link for the register.php in the login block to modules/smartprofile/register.php, and also redirect the yogurt/edituser.php or root/edituser.php to smartprofile/edituser.php
you can do this manually or by using htaccess
* also edit root/userinfo.php to make the yogurt userpage as the main userpage of your site:

Open userinfo.php in the root of your site, search at the very beggining of the file for
$uid intval($_GET['uid']);
if (
$uid <= 0) {
    
redirect_header('index.php'3_US_SELECTNG);
    exit();
}

Add after this the following lines:
header("Location:".XOOPS_URL."/modules/yogurt/index.php?uid=".$uid);
exit();


thank you shiva......

16
philfire
Re: Yogurt and Smartprofile
  • 2008/7/27 20:48

  • philfire

  • Just popping in

  • Posts: 25

  • Since: 2008/7/13


That's very useful Denian thank you :)Quote:

demian wrote:
I got this working with XOOPS 2.0181, Yogurt 3.2rc and smartprofile 1.0 (0fficial)

this is what i do based on shiva's instruction


1. Open yogurt/index.php

find this at the end on the file

/**
 * Closing the page
 */ 
include("../../footer.php");
?>


Before that line Add the following code

$gperm_handler = & xoops_gethandler'groupperm' );
$groups is_object($xoopsUser) ? $thisUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);

// Dynamic User Profiles
$thisUsergroups =& $thisUser->getGroups();
$fieldids xoops_getmodulehandler('visibility','smartprofile')->getVisibleFields($groups$thisUsergroups);

$profile_handler =& xoops_getmodulehandler('profile','smartprofile');
$fields =& $profile_handler->loadFields();

$profile $profile_handler->get($thisUser->getVar('uid'));
// Add dynamic fields
foreach (array_keys($fields) as $i) {
    
//If field should be shown
    
if (in_array($fields[$i]->getVar('fieldid'), $fieldids)) {
        
//echo "VAL0:".$value."<P>";
        
$value $fields[$i]->getOutputValue($thisUser$profile);
        if (
is_array($value)) {
            
$value implode('<br />'array_values($value));
        }
        if(
$value){
        
$fieldattr=array('title' => $fields[$i]->getVar('field_title'), 'value' => $value);
        
$fieldname=$fields[$i]->getVar('field_name');
        
$xoopsTpl->assign($fieldname$fieldattr);    
        }
    }
}



2. open smartprofile/class/field.php and go to somewhere in line 341

replace this
function getUserVars() {
        return 
xoops_getmodulehandler('profile')->getUserVars();
    }
}

with this one
function getUserVars() {
        return 
xoops_getmodulehandler('profile','smartprofile')->getUserVars();

    }


3. Now you can refer to smartprofile variables in your yogurt social networking index template:

(modules/yogurt/templates/yogurt_index.html)

example if you created a field named age

put this in the yogurt index template

Age: <{$age.value}>

* make sure to set the permission for the field you created in smartprofile module
* clear templates_c and cache
* don't forget to change the link for the register.php in the login block to modules/smartprofile/register.php,
you can do this manually or by using htaccess
* also edit root/userinfo.php to make the yogurt userpage as the main userpage of your site:

Open userinfo.php in the root of your site, search at the very beggining of the file for
$uid intval($_GET['uid']);
if (
$uid <= 0) {
    
redirect_header('index.php'3_US_SELECTNG);
    exit();
}

Add after this the following lines:
header("Location:".XOOPS_URL."/modules/yogurt/index.php?uid=".$uid);
exit();


thank you shiva......

17
blackrx
Re: Yogurt and Smartprofile
  • 2008/7/28 2:11

  • blackrx

  • Quite a regular

  • Posts: 227

  • Since: 2008/2/5 1


thank you demian


one more thing i think we need to redirect the yogurt/edituser.php

to smartprofile/edituser.php

18
laguna
Re: Yogurt and Smartprofile
  • 2008/7/28 4:16

  • laguna

  • Just popping in

  • Posts: 46

  • Since: 2004/10/9


Really, it does not work…

In addition, when installing SmartObject 1.0.1 Final (oficial) get a blank page side admin...

I use:

XOOPS 2.0.18.1
Smartprofile 1 Final
Yogurt 3.2
PHP Version 5.2.3
MySQL 5.0.45-community-nt
Hi amigos!!!

19
demian
Re: Yogurt and Smartprofile
  • 2008/7/28 10:30

  • demian

  • Quite a regular

  • Posts: 225

  • Since: 2008/4/29


Quote:

thank you demian...one more thing i think we need to redirect the yogurt/edituser.php

to smartprofile/edituser.php

yup..forgot that one...

Quote:

Really, it does not work…

In addition, when installing SmartObject 1.0.1 Final (oficial) get a blank page side admin...

I use:

XOOPS 2.0.18.1
Smartprofile 1 Final
Yogurt 3.2
PHP Version 5.2.3
MySQL 5.0.45-community-nt



i use this php/mysql version and it works for me

# MySQL 5.0.51b
# PHP 5.2.6

maybe you can try enable debugging, reupload all files, clear templates_c, update module from admin etc...

20
demian
Re: Yogurt and Smartprofile
  • 2008/7/28 10:33

  • demian

  • Quite a regular

  • Posts: 225

  • Since: 2008/4/29


sorry..i justy rechecked the step #2...i missed a closing }

..i've edited the post...it should work now i think

Login

Who's Online

229 user(s) are online (143 user(s) are browsing Support Forums)


Members: 0


Guests: 229


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits