Hi,

Thank you for your wonderful module. I have a function in my template.php which converts username to the real name and it appears fine throughout my site on modules.

As a greeting message when a user logs in with :

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
datetoday = new Date();
timenow=datetoday.getTime();
datetoday.setTime(timenow);
thehour = datetoday.getHours();
if (thehour > 18) display = "Evening ";
else if (thehour >12) display = "Afternoon  ";
else display = "Morning  ";
var greeting = ("Good " + display + " ");
document.write(greeting);
// End -->
</script> %username

the %username does not covert to real name and I see that I'm not able to insert php code only html.

Is there perhaps a way to make this work, would most appreciate any help.

Look forward to your reply.
Lilian

Comments

jvandyk’s picture

Status: Active » Postponed (maintainer needs more info)

Could you please say a bit more about what this has to do with the actions module?

liliplanet’s picture

Thank you for your super-fast reply.

When you create an Advanced Action with Actions: 'Display a message to the user'. In the 'Trigger: After a user has logged in', back in actions you are able to 'configure' the message. In the box available in Actions I've set:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
datetoday = new Date();
timenow=datetoday.getTime();
datetoday.setTime(timenow);
thehour = datetoday.getHours();
if (thehour > 18) display = "Evening ";
else if (thehour >12) display = "Afternoon  ";
else display = "Morning  ";
var greeting = ("Good " + display + " ");
document.write(greeting);
// End -->
</script> %username

well, the %username does not covert to real name and I see that I'm not able to insert php code only html. All other modules convert the username on my site.

Is there a way to insert php or 'author name' or something similar to output first name.

Hope this more clear, and look forward to your reply.
Lilian

jvandyk’s picture

Not sure what to say here. I've tried it with both 5.x-2.5 and HEAD and the it works fine for me. I get "Good Afternoon jvandyk". I'm running on PHP 5.2.5, Drupal 5.10. So it points to your function in template.php. What does it look like?

liliplanet’s picture

Thank you again. That's exactly it, I do not want the username 'jvandyk' but presuming :) John van Dyk ...

In template.php as follows:

function phptemplate_username($object, $link = TRUE) {
if ( $object->uid ) {
$type = "profile";
  $sql = "SELECT nid FROM {node} WHERE uid = %d AND type = '%s'";
  $nid = db_result(db_query($sql, $object->uid, $type));
   if ( $nid ) {
   $profile = node_load($nid);
  }
}
$name = $profile->field_name[0]['value'] . ' ' . $profile->field_lastname[0]['value'] ;
if ( $name ) { 
    if ( $link && user_access('access user profiles')) {
      return l($name, 'user/'. $object->uid, array('title' => t('View Member Profile.')));
    }
    else {
      return check_plain($name);
    }
}

Currently the above converts the username to full name everywhere on my site. I know that Facebook Statuses just had the same thing, yet now with their update works perfectly,

see http://drupal.org/node/307077

Do you think this is possible please John? Look forward to your reply. Lilian

jvandyk’s picture

Status: Postponed (maintainer needs more info) » Fixed

Ah, yes. We should be using theme_username() there instead of $user->name. Fixed in HEAD; will appear in 5.x-2.6. Thanks!

liliplanet’s picture

Hi John,

Hope this message finds you fabulous. John, I downloaded 5.x-2.6 but still seem to have only 'username' and not the full name as defined by the template. Is there something specific I should do .. have run update, but to no avail.

Look forward to hearing from you.
Lilian

liliplanet’s picture

Status: Fixed » Active

*bump* sorry, I needed to re-open this issue. John, please see my posting above and thank you!

pomliane’s picture

Status: Active » Closed (won't fix)

This version of Actions is not supported anymore. The issue is closed for this reason.
Please upgrade to a supported version and feel free to reopen the issue on the new version if applicable.

This issue has been automagically closed by a script.