Advertisement:

Author Topic: [SOLVED]help with a code for members list please  (Read 291 times)

joecoolll

  • Jr. Member
  • **
  • Posts: 86
[SOLVED]help with a code for members list please
« on: July 27, 2018, 01:19:05 am »
hi ... i found this code for the members list and i put it on a new page, but the username links go to a 404 not found.



<?php $users = User::newInstance()->listAll(); ?>

<?php foreach($users as $user) {

echo '<strong>Username</strong>: ' . '<a href="user/profile/'. $user['pk_i_id'] . '">' . $user['s_name'] . '</a>' . '<br /> ';

}?>




Im pressuming its the red bit that's wrong, our profile page is index.php?page=user&action=pub_profile&id=1





thank you




« Last Edit: July 27, 2018, 02:52:56 am by joecoolll »

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: help with a code for members list please
« Reply #1 on: July 27, 2018, 01:36:35 am »
Hello,

That's because you don't have permalinks enabled so URL is different, use

Code: [Select]
<?php
$users 
User::newInstance()->listAll();
foreach(
$users as $user) { 
    echo 
'<strong>Username</strong>: ' '<a href="'.osc_base_url(true).'?page=user&action=pub_profile&id='$user['pk_i_id'].'">' $user['s_name'] . '</a>' '<br /> ';
}
?>


instead.

Regards.

joecoolll

  • Jr. Member
  • **
  • Posts: 86
Re: help with a code for members list please
« Reply #2 on: July 27, 2018, 01:45:50 am »
thank you that's work