4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: MrAndrew on June 03, 2010, 02:47:36 AM
-
Good Day!
Anyone can help me?
I need to show one or two users name on the main page sort by default every refresh page. Please help me with this..
Thx!
-
Hi!
search in index.php:
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
insert above:
//######################## Start Random Username ################################
$num_random_user = 2; //how many names, e.g. 2
$sql = "SELECT user_id, user_name
FROM ".USERS_TABLE."
ORDER BY RAND()
LIMIT $num_random_user
";
$result = $site_db->query($sql);
$random_user = "";
while ($user_row = $site_db->fetch_array($result)){
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $user_row['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$user_row['user_id'];
$random_user .="<p style=\"text-align:center\"><a href=\"".$site_sess->url($user_profile_link)."\">".format_text($user_row[$user_table_fields['user_name']])."</a></p>";
}
$site_template->register_vars("random_user", $random_user);
unset($random_user);
//######################## End Random Username ################################
write in your Templates home.html wherever you want:
{random_user}
mfg Andi
-
Some corrections for own needs and all works well!! Thanks Rembrandt
-
Thanks for this mod :D
I possible show the user pic above the name and work with a link for profile of the user.
Thanks
-
... show the user pic above the name .....
from which mod?
...and work with a link for profile of the user.
there was not a problem, i have edit my first post..
mfg Andi
-
Thanks my friend!
The link works nice.
The userpic is from the mod of Vano [MOD] Member personal photo v1.1.2 by V@no (2008-12-11)
http://www.4homepages.de/forum/index.php?topic=6797.msg29716#msg29716 (http://www.4homepages.de/forum/index.php?topic=6797.msg29716#msg29716)
-
hm.. all what you need, found here (step 1.):
http://www.4homepages.de/forum/index.php?topic=6797.msg60282#msg60282
-
Thanks,
Sorry the question.But how i can show the result in the home.html of the code from step1 :?
//--------------------------------------
//--- Random Userpic Images ------------
//--------------------------------------
$sql = "
SELECT DISTINCT ".get_user_table_field("", "user_id"). get_user_table_field(", ", "user_name"). get_user_table_field(", ", "user_level").", userpic
FROM ".USERS_TABLE."
WHERE ".get_user_table_field("", "user_level")." >= '".USER."'
ORDER BY RAND()
LIMIT 1
";
$result = $site_db->query($sql);
if (!$result) {
$userpic_img = $lang['no_random_userpic'];
} else {
while ($row = $site_db->fetch_array($result)) {
$userpic_img = ($config['userpic'] && @file_exists(ROOT_PATH."data/userpic/".$row['userpic']) && $user_info['user_level'] >= USER) ? "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['user_id']."&user_name=".$row['user_name'])."\"><img src=\"".ROOT_PATH."data/userpic/".$row['userpic']."\" width=\"".$config['userpic_width']."\" height=\"".$config['userpic_height']."\" border=\"0\"></a>" : $lang['no_random_userpic'];
$user_name = ($config['userpic'] && @file_exists(ROOT_PATH."data/userpic/".$row['userpic']) && $user_info['user_level'] >= USER) ? "<br /><a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['user_id']."&user_name=".$row['user_name'])."\">".$row['user_name']."</a>" : "<br /><br /><a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['user_id']."&user_name=".$row['user_name'])."\">".$row['user_name']."</a>";
} ###### End of while statement.
if ($user_info['user_level'] >= USER) {
$site_template->register_vars(array(
"user_name" => $user_name,
"userpic_img" => $userpic_img,
"lang_no_random_userpic" => $lang['no_random_userpic'],
"lang_random_userpic_images_title" => $lang['random_userpic_images_title']
));
} ###### End of if statement.
} ###### End of if statement.
unset ($userpic_img);
unset ($user_name);
-
step 2.) and step 3.) from @oracles mod
-
Hi,
Thanks a lot.
My fault!! You talk about step 1 and I not read more. :oops:
Works fine,
Thanks