I have worked out why this mod was not working for me on some pages....
I have the phpbb gallery installed (heavily hacked by me!). This sits in a new set of folders on the server like this, but all the following will apply to any installation where there are accessible php pages which are not located in the root installation folder itself.
[root]/gallery/files.php
The "like" mod looks for urls by using the built-in $phpbb_root_path definition. We would expect this root path to be equal to "[root]/"
However....... *unfortunately* the real phpbb_root_path is not defined in a standard phpbb installation (see here:
https://area51.phpbb.com/phpBB/viewtopi ... 99&t=42239).
So the expression that phpbb pages encounter here will always revert to setting the root path as "./" and not as"[root]/"
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
The gallery mod is written to cope with this, but the Ajaxlike mod doesn't know about this issue. So the mod will use ./ as the root path, which in the context of [root]/gallery/files.php is incorrect (it will use [root]/gallery/).
This is a problem because the ajaxlike mod uses the overall header file to display the rcenet likes notifications. All is fine when viewing topics and so on because their php files sit in the root folder. The problem arises when viewing a page which is not in the root folder but nonetheless includes the overall header for the forum, and which therefore tries to use the ajaxlike functions for displaying notifications of likes.
In short...... the ajaxlike mod cannot reliably use the inbuilt phpbb definition of $phpbb_root_path where you are using subfolders for pages which include the main overall_header template.
It doesn't work to define the phpbb root path directly in constants.php because this file is parsed only after it's actually needed by the phpbb pages (how silly is that?).
So the ajaxlike mod needs to be changed to define the root path itself in each instance it uses it within the overall_header template. Which is annoying. The links in question are avatar, userid in memberlist.php and the post link in viewtopi.php. I have just gone into the relevant bits and hard-coded my own root path (
http://www.ukorchidforum.com) into them to fix it. Not ideal, but anyway. The file needing changes was /includes/functions_ajaxlike.php
This bit fixes avatar display:
Code: Select all
function get_avatar_ajaxlike($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR')
{
global $user, $config, $phpbb_root_path, $phpEx;
// Added the next line to redefine the root path
$phpbb_root_path = 'http://www.ukorchidforum.com/';
Weirdly, fixing the avatar bit above also fixed the profile link to memberlist.php. The next one fixes post-links within the notifications, but not for the first notification in the list:
Code: Select all
function get_notifications()
{
global $db, $user, $config, $phpbb_root_path, $phpEx;
// Added the next line to redefine the root path
$phpbb_root_path = 'http://www.ukorchidforum.com/';
This fixes all entries except the first one in the listbox. To fix the first one I eventually worked out I needed to add in that hardcoded $phpbb_root_path definition in the function get_liked_list() just before both of the two lines starting with this:
$textp = append_sid(
If I put it at the start of that function, the function hangs. Not sure why. It was easier not to try to find out
If someone were using other viewable php pages which used any ajaxlike functions called from those pages, those functions would also need this adjustment. Fortunately that doesn't apply to me here.
I'll try and fathom my other problems out as time goes on.
Thanks!