View previous topic :: View next topic |
Author |
Message |
sh0ck
Joined: 02 May 2004 Posts: 50 Location: Norway
|
Posted: Thu Feb 03, 2005 8:26 am Post subject: list stories by user |
|
|
Is there any way to list stories by user? such as e.g. index.php?userID=3 _________________ http://www.licklinux.com |
|
Back to top |
|
 |
Sigg3
Joined: 03 Jul 2003 Posts: 896 Location: Oslo, Norway
|
|
Back to top |
|
 |
sh0ck
Joined: 02 May 2004 Posts: 50 Location: Norway
|
Posted: Sat Feb 05, 2005 12:21 pm Post subject: |
|
|
lol. sorry, I guess i didn't read that part  _________________ http://www.licklinux.com |
|
Back to top |
|
 |
sh0ck
Joined: 02 May 2004 Posts: 50 Location: Norway
|
Posted: Sat Feb 05, 2005 12:32 pm Post subject: |
|
|
Another question though... How can I display the user ID outside the b2loop. To get the username I only need to:
Code: |
<?php echo $user_login; ?>
|
I thought that $user_ID would work, but it didn't...  _________________ http://www.licklinux.com |
|
Back to top |
|
 |
Sigg3
Joined: 03 Jul 2003 Posts: 896 Location: Oslo, Norway
|
Posted: Sat Feb 05, 2005 5:02 pm Post subject: |
|
|
Can't you just strip it?
top:
Code: | <?php /* Don't remove this line, it calls the b2 function files ! */ $blog=1; include ("blog.header.php"); ?> |
Then (stripped loop):
Code: |
<?php while($row = mysql_fetch_object($result)) { start_b2(); ?>
<!-- The appropriate code -->
<?php } ?>
|
But for a simple display of login it might be a little too much trouble.
And you'd have to _call_ it through a variable-include, or something, to make it fetch that n that data.
Thinking about it, it wouldn't work:p
But the b2 user info is stored in the b2users in your db.
Quote: | <?php the_author_ID() ?> - the author's ID number in b2. This number is automatically set when the user registers: to see the ID of an user, go to the Team page. This is static data too, so you can use it like the_author_login() in associating stuff with authors. | See readme for more author stuff
..but they'd have to be logged in. _________________ Sigg3.net - You know you're worth it! | b2 Cafelog Resource Center | Fight my BattleImp! |
|
Back to top |
|
 |
sh0ck
Joined: 02 May 2004 Posts: 50 Location: Norway
|
Posted: Sun Feb 06, 2005 11:40 pm Post subject: |
|
|
$the_author_ID variable is for each post in the b2loop. I need to fetch the user ID of a logged in user outside to loop. Since I'm building a journal system I want logged-in users to click a link called "myJournal" which will transfer them to index.php?author=theirIDnumber. _________________ http://www.licklinux.com |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 365
|
Posted: Mon Feb 07, 2005 3:23 pm Post subject: |
|
|
get_currentuserinfo() gives you $user_ID
get_currentuserinfo() needs Code: | require_once ('b2config.php');
require_once($b2inc."/b2functions.php");
dbconnect(); | before it is called |
|
Back to top |
|
 |
sh0ck
Joined: 02 May 2004 Posts: 50 Location: Norway
|
Posted: Thu Feb 10, 2005 11:36 pm Post subject: |
|
|
It only seems to be working inside the b2-account. If I use it in my template it displays nothing... Anything I might be doing wrong? _________________ http://www.licklinux.com |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 365
|
Posted: Fri Feb 11, 2005 4:05 pm Post subject: |
|
|
The code get_currentuserinfo uses is in b2functions.php and provided the user is logged in and allows cookies, it should show their details |
|
Back to top |
|
 |
|