Recent Topics

1 Dec 17, 2005 19:36    

user_admin_link();

where is the 'verbiage' for the admin link located, I'm finding that Blog users that are just posting and editing posts are confused by the default 'Admin' and I'd like to change the verbiage to something else.

Thanks!

www.nthview.com

2 Dec 17, 2005 19:58

http://doc.b2evolution.net/0.9.0/elementindex.html is one of my favorite resources because it's usually two clicks to a detailed answer to any function question. First the letter U then a bit of scrolling down gets me http://doc.b2evolution.net/0.9.0/evocore/_blogs_b2evocore__functions_users_php.html#functionuser_admin_link

Most skins put those user links in an unordered list, so here I'll pretend you're doing the same.

user_admin_link( '<li>', '</li>', 'b2edit.php', 'YOUR_LINKED_TEXT_HERE', 'this is  your mouseover text');

Had the same issue once. Users couldn't or didn't figure out admin meant "go to where you post" so I changed the text to say "admin / post" and the mouseover to say "click here to write a new post".

4 Dec 17, 2005 20:30

I don't think #s are appropriate for the first three items since the techdoc page doesn't use them. Also looking at the function it doesn't say "if this is # then use blah" as is the cases with #ed params. Better to fill them in with content or leave them as '' (where '' is two single quotes).

5 Dec 17, 2005 20:35

I thought those made it use the default values. Empty quotes will make it use nothing, won't it?

6 Dec 17, 2005 20:36

Might help sort out confusion:
(1.6 Pheonix)

//Fix the php tag problem

**
 * Template tag: Provide a link to the backoffice
 */
function user_admin_link( $before = '', $after = '', $page = 'b2edit.php', $link_text = '', $link_title = '#' )
{
	global $admin_url, $blog, $current_User;

	if( ! is_logged_in() ) return false;

	if( ! $current_User->check_perm( 'admin', 'visible' ) )
	{ // If user should NOT see admin link:
		return false;
	}

	if( $link_text == '' ) $link_text = T_('Admin');
	if( $link_title == '#' ) $link_title = T_('Go to the back-office');
	// add the blog param to $page if it is not already in there
	if( !preg_match('/(&|&amp;|\?)blog=/', $page) ) $page = url_add_param( $page, 'blog='.$blog );

	echo $before;
	echo '<a href="'.$admin_url.$page.'" title="'.$link_title.'">';
	echo $link_text ;
	echo '</a>';
	echo $after;
}

Edit:
personman posted the exact same time i did,
I think what ur asking personman, is that if i do '#' its a php thing like "\r\n" and will automaticly use the default value.
I have never seen or heard about this and php.net mentions nothing about it.
So passing '#' will actually USE the value '#' and not the default value.
Is that what u were asking personman?

7 Dec 17, 2005 20:57

Great Stuff!

Thanks for the help.

NOTE: # due infact get returned as #

Although a great deal of the above is superb information, is there a simpler way to for instance just specify one change in the php tag. Example: say all I wanted to do was change the Mouse Over, is there a way to specify that what I'm entering into the () is to do just that. [I think the posting with the '#' idea was heading this way]

Thanks again!

8 Dec 17, 2005 20:59

In the case of link_title # will equal a default value. Normally in b2evolution we see this in params in the middle of a string, thus allowing the tweaker to use a bunch of stock stuff when their intention is to change a param towards the end of the list. For example:

fake_function( '#', '#', '#', '#', 'custom_value' );

This is entirely dependent on the function of course! In this fake case the first four params will use #, and one assumes that # is defined to equal something. For example inside the actual function you would find:

if( $first_param == '#' ) {
$first_param = 'default value';
}

Also, for the benefit of all readers of this thread, ALL params in ALL functions have a default value. The only time you need to define them is if you happen to want to change any of them. In the fake example above it is possible that there are 10 params, but since we only wanted to customize the fifth we can ignore 6 through 10 when we tweak our skin.

Anyway the bottom line is if the techdoc page shows = '#' as the default value then you can use # to mean "give me the default value" instead of having to retype the default values leading up to the param you want to change. If OTOH the techdoc page shows some specific thing (such as = 'b2edit.php') as default then you have to restate it in order to customize a parameter beyond it.

Groovy eh? Dunno if this is the 'normal' way php programs are written, but it's completely normal for b2evolution.

9 Dec 17, 2005 21:25

If someone has the time or knows from experience can you do this:

CallingMyFunction(,,,,,,,,'Cool',,,,,'NotCool');

I'm not sure wether php chucks a sad or not.

And also this would be cool:

CallingMyFunction('5thParam'=>'Cool');

I know you can do the 2nd one but u need to pass it as an array and it gets messy.

Just contributing my question ;)


Form is loading...