News:

Wondering if this will always be free?  See why free is better.

Main Menu

Guest WebSite

Started by SAFAD, September 08, 2009, 01:38:29 PM

Previous topic - Next topic

Arantor

So when Display.php gets it, and sees that it doesn't have data in $user_profile for that user, it uses poster_name. Specifically look for the queries where it uses IFNULL() on real_name and poster_name.

SAFAD


	
	
// What?  It's not like it *couldn't* be only guests in this topic...
	
	
if (!empty(
$posters))
	
	
	
loadMemberData($posters);
	
	
$messages_request $smcFunc['db_query']('''
	
	
	
SELECT
	
	
	
	
id_msg, icon, subject, poster_time, poster_ip, id_member, modified_time, modified_name, body,
	
	
	
	
smileys_enabled, poster_name, poster_email, approved,
	
	
	
	
id_msg_modified < {int:new_from} AS is_read
	
	
	
FROM {db_prefix}messages
	
	
	
WHERE id_msg IN ({array_int:message_list})
	
	
	
ORDER BY id_msg' 
. (empty($options['view_newest_first']) ? '' ' DESC'),
	
	
	
array(
	
	
	
	
'message_list' => $messages,
	
	
	
	
'new_from' => $topicinfo['new_from'],
	
	
	
)
	
	
);

still didn't get my fish
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

And where does it process from the contents of $messages_request?

SAFAD


// Start from the beginning...
	
if (
$reset)
	
	
return @
$smcFunc['db_data_seek']($messages_request0);

	
// Attempt to get the next message.
	
$message $smcFunc['db_fetch_assoc']($messages_request);
	
if (!
$message)
	
	
return 
false;

is this what are you talking about ?
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

Yes. And what happens further down that function, involving $message?

SAFAD


// $context['icon_sources'] says where each icon should come from - here we set up the ones which will always exist!
	
if (empty(
$context['icon_sources']))
	
{
	
	
$stable_icons = array('xx''thumbup''thumbdown''exclamation''question''lamp''smiley''angry''cheesy''grin''sad''wink''moved''recycled''wireless''clip');
	
	
$context['icon_sources'] = array();
	
	
foreach (
$stable_icons as $icon)
	
	
	
$context['icon_sources'][$icon] = 'images_url';
	
}

	
// Message Icon Management... check the images exist.
	
if (empty(
$modSettings['messageIconChecks_disable']))
	
{
	
	
// If the current icon isn't known, then we need to do something...
	
	
if (!isset(
$context['icon_sources'][$message['icon']]))
	
	
	
$context['icon_sources'][$message['icon']] = file_exists($settings['theme_dir'] . '/images/post/' $message['icon'] . '.gif') ? 'images_url' 'default_images_url';
	
}
	
elseif (!isset(
$context['icon_sources'][$message['icon']]))
	
	
$context['icon_sources'][$message['icon']] = 'images_url';

	
// If you're a lazy bum, you probably didn't give a subject...
	
$message['subject'] = $message['subject'] != '' $message['subject'] : $txt['no_subject'];

	
// Are you allowed to remove at least a single reply?
	
$context['can_remove_post'] |= allowedTo('delete_own') && (empty($modSettings['edit_disable_time']) || $message['poster_time'] + $modSettings['edit_disable_time'] * 60 >= time()) && $message['id_member'] == $user_info['id'];

	
// If it couldn't load, or the user was a guest.... someday may be done with a guest table.
	
if (!
loadMemberContext($message['id_member'], true))
	
{
	
	
// Notice this information isn't used anywhere else....
	
	
$memberContext[$message['id_member']]['name'] = $message['poster_name'];
	
	
$memberContext[$message['id_member']]['id'] = 0;
	
	
$memberContext[$message['id_member']]['group'] = $txt['guest_title'];
	
	
$memberContext[$message['id_member']]['link'] = $message['poster_name'];
	
	
$memberContext[$message['id_member']]['email'] = $message['poster_email'];
	
	
$memberContext[$message['id_member']]['show_email'] = showEmailAddress(true0);
	
	
$memberContext[$message['id_member']]['is_guest'] = true;
	
}
	
else
	
{
	
	
$memberContext[$message['id_member']]['can_view_profile'] = allowedTo('profile_view_any') || ($message['id_member'] == $user_info['id'] && allowedTo('profile_view_own'));
	
	
$memberContext[$message['id_member']]['is_topic_starter'] = $message['id_member'] == $context['topic_starter_id'];
	
}

	
$memberContext[$message['id_member']]['ip'] = $message['poster_ip'];

i guess our rock party is down here


// If it couldn't load, or the user was a guest.... someday may be done with a guest table.
	
if (!
loadMemberContext($message['id_member'], true))
	
{
	
	
// Notice this information isn't used anywhere else....
	
	
$memberContext[$message['id_member']]['name'] = $message['poster_name'];
	
	
$memberContext[$message['id_member']]['id'] = 0;
	
	
$memberContext[$message['id_member']]['group'] = $txt['guest_title'];
	
	
$memberContext[$message['id_member']]['link'] = $message['poster_name'];
	
	
$memberContext[$message['id_member']]['email'] = $message['poster_email'];
	
	
$memberContext[$message['id_member']]['show_email'] = showEmailAddress(true0);
	
	
$memberContext[$message['id_member']]['is_guest'] = true;
	
}
	
else
	
{
	
	
$memberContext[$message['id_member']]['can_view_profile'] = allowedTo('profile_view_any') || ($message['id_member'] == $user_info['id'] && allowedTo('profile_view_own'));
	
	
$memberContext[$message['id_member']]['is_topic_starter'] = $message['id_member'] == $context['topic_starter_id'];
	
}

	
$memberContext[$message['id_member']]['ip'] = $message['poster_ip'];
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

And there it is.

The if(loadMemberContext... ) establishes if it was a guest or not for that message. The lower block headed "Notice this information isn't used anywhere else" is where it is built for that message, see it's populating it from $message['poster_name'] like I said.

SAFAD

should i add

$memberContext
[$message['id_member']]['website'] = $message['poster_website'];

?????
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

No... You need to replace $memberContext[$message['id_member']]['link'] = $message['poster_name'];

SAFAD

Back After 10 Days Off No InterNet
I Feel Like I Am Reborn :)
But I Forgot Most Of All This :(
so you mean like this


if( $context['user']['is_guest'] )
$memberContext[$message['id_member']]['website'] = $message['poster_name']; 

Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

No.

That updates the website field. If - as I understand it - you want to replace the displayed name, you kinda have to edit the name being displayed - which is built into $memberContext[$message['id_member']]['link']

SAFAD

$memberContext[$message['id_member']]['name']
??
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

No. $memberContext[$message['id_member']]['link'] is what is displayed in the template.

SAFAD

Yes Now I Remember What Was Am I Trying To DO

if( $context['user']['is_guest'] )
echo '<h4>$message['poster_website'];</h4>';
else {
echo '<h4>', $message['member']['link'], '</h4>';
}
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

Did that work out for you? That'll display the websites if the current user viewing the page is a guest, nothing more.

If you want to display the website address instead of user name when the poster is a guest, you have to edit the line I already gave you.

SAFAD

hmmmmm
didn't test
but what i was looking is something similiare to this

if( $context['user']['is_guest'] )
echo '<h4><a href="$message['poster_website'];">$poster_name</a></h4>';
else {
echo '<h4>', $message['member']['link'], '</h4>';
}

And The current topic vars are not for this
they are for my mod
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

So are you trying to display URLs to guests or what?

If you want to replace the name of a guest with the URL you cannot do it with that code. You will have to modify Load.php's loadMemberContext function as I have already indicated - there is no better way of doing it.

SAFAD

argh we go again to the same circle
look
in normal condition
if guest post
his name has NO Link On It
And The Member When He Post
His Name Has a link To His Profile

So I Want It Like This
EX :
GuestName
Tada
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

Then you STILL have to modify the [link] parameter in loadMemberContext, as I have already said.

You cannot use $context['user']['is_guest'] for what you want. ALL that tells you is if the current user viewing the topic is a guest or not.

Advertisement: