Using AG 5.31 and learning PHP.
In links-home.php, I have this custom link:
$homeLinks[] = array(
'url' => 'jeantable_view.php?FilterAnd[1]=&FilterField[1]=4&FilterOperator[1]=<=>&FilterValue[1]=products', ...
with this filter, all records in jeantable are displayed.
Since everyone has to know the creator of each record, I have a field auto-filled with <%%creatorUsername%%>
With one click, I want to display all the records created/owned by the current signed in member.
I know $memberInfo is available with the global hook function login_ok(), getMemberInfo() could also be used, but where to put the code and how to insert the username of the current signed in member in this second part of the url ?
... &FilterAnd[2]=and&FilterField[2]=3&FilterOperator[2]=<=>&FilterValue[2]=member_username', ...
Any suggestion ?
Thanks
Jean
links-home and filters in url
Re: links-home and filters in url
Answering to myself.
Found in home.php where validation of $homeLinks are done, the value of &FilterValue[2] could be replaced by the signed in user.
Searching for a solution !
Jean
Found in home.php where validation of $homeLinks are done, the value of &FilterValue[2] could be replaced by the signed in user.
Searching for a solution !
Jean
Re: links-home and filters in url
Found my solution:
in hooks/_global.php, modify function login_ok
function login_ok($memberInfo, &$args){
$_SESSION['signinmember']=$memberInfo['username'];
return '';
}
in hooks/links-home.php, modify the value of FilterValue[2]
$homeLinks[] = array( ...
'url' => 'jeantable_view.php?FilterAnd[1]=&FilterField[1]=4&FilterOperator[1]=<=>&FilterValue[1]=products&FilterAnd[2]=and&FilterField[2]=3&FilterOperator[2]=<=>&FilterValue[2]='.$_SESSION['signinmember'],
...
If invoked when no one signed in, then only the first filter is executed.
Jean
in hooks/_global.php, modify function login_ok
function login_ok($memberInfo, &$args){
$_SESSION['signinmember']=$memberInfo['username'];
return '';
}
in hooks/links-home.php, modify the value of FilterValue[2]
$homeLinks[] = array( ...
'url' => 'jeantable_view.php?FilterAnd[1]=&FilterField[1]=4&FilterOperator[1]=<=>&FilterValue[1]=products&FilterAnd[2]=and&FilterField[2]=3&FilterOperator[2]=<=>&FilterValue[2]='.$_SESSION['signinmember'],
...
If invoked when no one signed in, then only the first filter is executed.
Jean
Re: links-home and filters in url
Pat,
you're welcome, it's a pleasure to share.
Jean
you're welcome, it's a pleasure to share.
Jean