WordpressEmbedded theme: changing the greeting

PaganRadio
PaganRadio's picture

Joined: 2008-02-07
Posts: 2
Posted: Thu, 2008-02-07 08:25

In which file can I change or delete completely the greeting that appears at the top of the main gallery page (using WordpressEmbedded theme)?

Quote:
Welcome, (username)

This is the main page of your Gallery

 
ozgreg
ozgreg's picture

Joined: 2003-10-18
Posts: 1378
Posted: Thu, 2008-02-07 21:54

Hiya,

The text "This is the main page of your Gallery" is in your Gallery2 Main Album, you can edit this Text and Remove this or change it to your tastes. I believe if the Main Album Item Text is blank, then the Welcome also does not get displayed.

____________________________________
Wordpress / Gallery2 (WPG2) Plugin, , WPG2 Documentation, WPG2 Demo

 
PaganRadio
PaganRadio's picture

Joined: 2008-02-07
Posts: 2
Posted: Fri, 2008-02-08 01:24

Thanks, ozgreg. I appreciate your reply.

- L.

 
trbailey
trbailey's picture

Joined: 2007-04-16
Posts: 172
Posted: Thu, 2008-03-06 16:37

You can also add the user name to the Wordpress theme by editing header.php and/or creating a wpg2header.php (copy of header.php)

<?php wp_head();
global $user_identity;
?>
</head>
<body>
  <div id="wrap">
    <div id="header">
    Welcome <em><?php echo $user_identity; ?></em>, to the 
    <a href="<?php echo get_option('home'); ?>/>
    ....

Author:Blog|Site

 
jmaentz

Joined: 2007-11-07
Posts: 19
Posted: Tue, 2008-06-03 00:24

This also works well when adding it to your header.php in wordpress.

<?php wp_head();
global $user_identity;
?>

</head>

<body>

<!-- User Start -->

<?php if ( $user_identity ) :

// here's the kicker
global $user_identity;
// really. that's it. ?>

Welcome <b><?php echo $user_identity; ?></b>!
( <a href="/wp-login.php?action=logout">Log Out</a> | <a href="/wp-admin/profile.php">Profile</a><?php wp_register(); ?> )

<?php else : ?>

Welcome <b>Guest</b>!
( <a href="/wp-login.php">Log In</><?php wp_register(); ?> )

<?php endif; ?>

<!-- User End --></a>

 
karnesb

Joined: 2008-07-15
Posts: 1
Posted: Tue, 2008-07-15 21:52

This is great. Just wondering if you, or another poster, knows how to display only the user's first name instead of his/her complete name. I've tried all kinds of test, and simply cannot get it right.

Suggestions?

 
trbailey
trbailey's picture

Joined: 2007-04-16
Posts: 172
Posted: Wed, 2008-07-16 14:50

I actually use this code just below the call to wp-head(); in header.php for my current theme:

Quote:
<?php wp_head();
global $user_identity;
if ($user_identity) {
$d_id=$user_identity;
}
else {
$d_id='Guest';
}

?>
</head>

<body>
<div id="wrap">
<div id="header"><a href=/>Home Page</a>&nbsp;
Welcome <em><?php echo $d_id; ?></em>, ------remainder of greeting---

When I'm logged in as admin this displays: "[url=#]Home[/url] Welcome Thomas, to the [url=#]Bailey Family Weblog[/url] and [url=#]Media Gallery[/url]" across the top of the page. I use the Home link to link to my site home page, the Bailey Family Weblog link to return to the front page and the Media Gallery links to wpg2.

The code above says, make the global variable $user_identity available. If it's not empty, copy it's contents to a local variable called $d_id. If there is no $user_identity (not logged in), assign $d_id a value of 'Guest' so something is always displayed. Then below it you'll see the php statement echo $d_id which actually displays the value we just assigned.

Now, something to think about RE: Displaying a users First name.

The $d_id is assigned either 'Guest', or the display name the user entered as a display for their login.

Isn't displaying a users first name a bit of a privacy issue?

If I use jarheadbonza as a login name and Joe Fresh as my user_nicename (aka nickname, see wp-users & wp_usermeta tables in your wp database) and you come along and take part of my real name and plug it up on the screen, it defeats the purpose of even having a nickname. The very reason it's in a separate meta data table is to deter easy loading. One would have to intentionally search for the user joined to the user_meta table to get the data so it wouldn't be an accident.

So, are you sure you really want to retrieve a users First name?

See wp_usermeta in the database. That's where first and last names are stored. Notice it's a meta data table it's not even part of the users table, so it's probably only loaded when you, the presumed administrator wants to see it or change it which means that unless you are in the admin screen, it's probably not even in memory. Notice it's the $global statement above that makes global session variables available to your theme's header.php. So, unless that variable is a global variable, it's not available unless you load it with a direct database hack. A very unsafe hack I might add...

If you really want to load the users first name you may need to write a separate database query for the user and join it to the user_meta table to get the actual users first name. I suspect it's not a global variable, even when it's loaded as part of wp-admin/users.php script; hint, hint, hint...

Why not just respect the users privacy and stick with the user id assigned to $d_id in the above code, that's what it's there for.
:)

Author:Blog|Site

 
ozgreg
ozgreg's picture

Joined: 2003-10-18
Posts: 1378
Posted: Thu, 2008-07-17 06:59
karnesb wrote:
This is great. Just wondering if you, or another poster, knows how to display only the user's first name instead of his/her complete name. I've tried all kinds of test, and simply cannot get it right.

Suggestions?

I do not believe you can, just remember the persons full name will only show up for the relevant user so it should not be a privacy issue.. The other alternative is do not supply the full name in Wordpress that way you will not have any concerns ;)

____________________________________
Wordpress / Gallery2 (WPG2) Plugin, , WPG2 Documentation, WPG2 Demo

 
trbailey
trbailey's picture

Joined: 2007-04-16
Posts: 172
Posted: Mon, 2008-07-21 16:31

Good point!
Author:Blog|Site