phpBB

Development Wiki

Talk:Tutorial.Adding pages

From phpBB Development Wiki

Fatal error: Call to undefined function get_user_avatar() in C:\Program Files\xampp\htdocs\phpbb3\new_page.php on line 45

I received this error when I directly copied your code:

  Fatal error: Call to undefined function get_user_avatar() in C:\Program Files\xampp\htdocs\phpbb3\new_page.php on line 45

I thought others might be interested, the fix was found on phpbb.com by adding this line:

  include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
  AFTER this line:
  include($phpbb_root_path . 'common.' . $phpEx);

I really appreciate the tutorial. Thanks for your work! -B

Added, good catch. :) - Highway of Life (talk) 18:12, 3 January 2008 (UTC)

Include Errors

A really stupid one. I have my forum code unzipped to a 'devbb' folder in the webserver's root directory. In this case I had to change the line

 $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/';

to

 $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './devbb/';

As I said, a really simple one

bonus section about_us viewonline..

It's really nice.. But as I was struggling to get it working on a custom page, i noticed that a why are there () around the case name? I put it in with no () and I noticed another thing and that in the case 'name': name should be the name of the custom php file. It took me a few refreshes, a few curse words etc to finally got the bright idea...



Adding the following code to a page one directory above my forum results in a blank page


<?php

define('IN_PHPBB', true); // Specify the path to you phpBB3 installation directory. $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/'; $phpEx = substr(strrchr(__FILE__, '.'), 1); // The common.php file is required. include($phpbb_root_path . 'common.' . $phpEx);

// Start session management $user->session_begin(); $auth->acl($user->data);

$user->setup();


//your PHP and/or HTML code goes here

?>


Adding the above code to another page in a different folder in the same level as my forum results in a working page

I have been racking my brain trying to figure out why it would make any difference.