Recent Topics

1 May 25, 2008 11:11    

My b2evolution Version: Not Entered

i d like to display logged in users name near the profile in the users tool widget; just like in the evotoolbar, seems easy but i just couldnt figure out how to..

user tools widg line:

		user_profile_link( $this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params[ 'user_profile_link' ] );

evotoolbar line:

			user_profile_link( '<li>', '</li>', T_('User profile').' (%s)' );

thank you in advance

2 May 25, 2008 12:10

user_profile_link( $this->disp_params['item_start'], $this->disp_params['item_end'], $current_User->get('preferredname') );

3 May 25, 2008 15:22

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

4 May 25, 2008 15:38

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') );

5 May 25, 2008 16:26

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

6 May 25, 2008 17:11

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!!!

7 May 25, 2008 17:33

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)' );

9 May 25, 2008 17:41

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 ;)

10 May 25, 2008 17:42

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 :)

11 May 25, 2008 17:43

:'( 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,

12 May 25, 2008 18:09

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 ;)

13 May 25, 2008 18:19

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


Form is loading...