PDA

View Full Version : Setting the MyInfo view to Default View


bootswalker
26-02-05, 05:06 PM
Using version 1.0.2 and trying to Set the MyInfo view to the Default View.

I modifyed the *Today as the Default View* code from the documentation site:
http://sites.sakienvirotech.com/dp_docs/tiki/tiki-index.php?page=Setting+the+Today+View+to+Default+v iew
/* Change
$m = 'calendar';
$a = 'day_view';
to */
$m = 'admin';
$a = 'viewuser';

That works very well, passing the $m and $a variables and opening the myInfo view. But the message *Invalid User ID* appears where the view name would normally show up and the current users info does not show up.

This *Invalid User ID* message is the same message returned when removing the &user_id=1 parameter from the MyInfo link.
index.php?m=admin&a=viewuser[&user_id=1]
So I'm thinking that paramater is not getting passed.


My question is, is it possable and how to pass the user_id variable?

cyberhorse
27-02-05, 03:56 AM
the user_id variable for you as a user is accessible from $AppUI->user_id so making '$user_id = $AppUI->user_id' on the right place (top of modules/admin/viewuser.php, after the $user_id setting), should solve your problem (with side effects).

bootswalker
27-02-05, 08:11 AM
Thanks for the reply cyberhorse. I appreciate the help on this.

Yes, it seems to me that would work. I've tried:
$user_id = $AppUI->user_id;
and
$u = $AppUI->user_id;
with no success.

A little further up in the code are these lines of code:
// clear out main url parameters
$m = '';
$a = '';
$u = '';
That's why I also tried the $u variable.

Even if I hard code a valid user id:
$user_id = '1';
and
$u = '1';
no luck.

The last line it the block of code that sets the entry page is:
$AppUI->setState('CompVwTab', 1);

There is a setState function in classes/ui.class.php:
/**
* Set the value of a temporary state variable.
*
* The state is only held for the duration of a session. It is not stored in the database.
* @param string The label or key of the state variable
* @param mixed Value to assign to the label/key
*/
function setState( $label, $value ) {
$this->state[$label] = $value;
}

Wouldn't that be like:
$AppUI->setState('CompVwTab', 1);

and the function: would be
function setState( 'CompVwTab', 1) {
$this->state['CompVwTab'] = 1;
}
??

I don't understand how $m & $a are being passed in with this function.

Are $a and $m globle variables, 'CompVwTab' a view name?

Thanks again. I appreciate the help with this.

bootswalker
27-02-05, 11:01 AM
cyberhorse:

After rereading your suggestion and putting '$user_id = $AppUI->user_id;' in the correct file this modification does exactly what I wanted.

And after putting it in the correct file I believe my secont set of questions were answeres by some of the surrounding code.

Sorry for being so thick. As least I'm persistant.

Thank you for your help.

cyberhorse
27-02-05, 11:44 AM
happy to hear this.

Just beware - the side effect I was talking about is that now you won't be able to see other users information (from the user administration page).
There are ways of fixing this, but that's beyond this discussion :)