2 sam2kb May 25, 2008 12:10

sam2kb wrote:
user_profile_link( $this->disp_params['item_start'], $this->disp_params['item_end'], $current_User->get('preferredname') );
thanks sam2kb, but unfortunately this didn't work
Notice: Undefined variable: current_User in /home/prosoftwar/domains/prosoftwarez.com/public_html/inc/widgets/widgets/_user_tools.widget.php on line 148
Fatal error: Call to a member function get() on a non-object in /home/prosoftwar/domains/prosoftwarez.com/public_html/inc/widgets/widgets/_user_tools.widget.php on line 148
You must also add global $current_User; in this file
The whole thing will look like
global $current_User;
user_profile_link( $this->disp_params['item_start'], $this->disp_params['item_end'], $current_User->get('preferredname') );
oops sorry (:.. it worked out great, it is now displaying logged in user name instead of 'Profile' link, i can go on with this , i dont wanna be a bugger but, how can i make it display Profile (admin) .. i ve tried to do it on my own, but i just mix syntaxes up.. thank you in advance ..cheers ;)
edit:
and btw, most important of all, when you are not logged in it causes
Fatal error: Call to a member function get() on a non-object in /home/prosoftwar/domains/prosoftwarez.com/public_html/inc/widgets/widgets/_user_tools.widget.php on line 150
as you are not logged in yet;
we need to add somewhere if logged in i suppose
Here's something you might want to try in your inc/widgets/widgets/_user_tools.widget.php file at the appropriate place for it:
echo $this->disp_params['list_start'];
user_login_link( $this->disp_params['item_start'], $this->disp_params['item_end']."\n", $this->disp_params[ 'user_login_link' ] );
user_register_link( $this->disp_params['item_start'], $this->disp_params['item_end']."\n", $this->disp_params[ 'user_register_link' ] );
user_admin_link( $this->disp_params['item_start'], $this->disp_params['item_end']."\n", $this->disp_params[ 'user_admin_link' ] );
$tilqicoms_thing = $this->disp_params[ 'user_profile_link' ].' (%s)';
user_profile_link( $this->disp_params['item_start'], $this->disp_params['item_end']."\n", $tilqicoms_thing );
user_subs_link( $this->disp_params['item_start'], $this->disp_params['item_end']."\n", $this->disp_params[ 'user_subs_link' ] );
user_logout_link( $this->disp_params['item_start'], $this->disp_params['item_end']."\n", $this->disp_params[ 'user_logout_link' ] );
echo $this->disp_params['list_end']."\n";
You may notice there is a shiny new variable in there called "tilqicoms_thing"? What I am trying to do with it is make it send %s (actually (%s) ) to the user_profile_link function so that the function can do like it did for the evobar thing. It might actually work!
EDIT: the stupid php button causes the page to stretch beyond it's natural limits! GRRR!!!
Try this. You'll get Profile (admin) if you are logged in and nothing if not logged in.
user_profile_link( $this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params[ 'user_profile_link' ].' (%s)' );
I'm late :(
no you are not : P
Thank you guys both, i ve tried sam2kb's first as it seemed less complicated : P , and it worked very well, thanks to Edb too for tilqicom's thing ;)
Yeah that's probably even cooler. Simpler is cooler yah? For some reason I wasn't sure if it would take that way though, so I made up a new variable to hold both bits. Oh and also I wanted to name a variable after tilqicom :)
:'( maybe i ll try that later on, just to have a variable called after me :D but my mind is currently f'ed up right now, so i ve tried the simple looking one : P long=complicated, yah? no maybe it's not : P
ty very much really (:, it looks cool now,
tilqicom they are the same thing. sam2kb put on one line what I did with a variable on a new line. sam2kb's is actually a bit better because "simpler is cooler" to quote myself ;)
i know i know (:, you just copied the whole block not to allow any typo or sth, just seemed long, they r almost same, i'm aware of that, i was just jking